Commit 21d68a9b96d282169c1fe51364e8aab173e8fd5e

Authored by conradverm
1 parent 83d1c8c9

KTS-2386

"Add some basic plugin caching to improve performance"
Added.

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7246 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/plugins/pluginutil.inc.php
... ... @@ -60,8 +60,8 @@ class KTPluginResourceRegistry {
60 60  
61 61 class KTPluginUtil {
62 62 static function loadPlugins () {
63   - $sPluginCache = KT_DIR . '/var/plugin-cache';
64   - if (file_exists($sPluginCache)) {
  63 +
  64 + if (session_is_registered('__KT_PLUGIN_CACHE')) {
65 65 require_once(KT_LIB_DIR . "/plugins/plugin.inc.php");
66 66 require_once(KT_LIB_DIR . '/actions/actionregistry.inc.php');
67 67 require_once(KT_LIB_DIR . '/actions/portletregistry.inc.php');
... ... @@ -76,7 +76,7 @@ class KTPluginUtil {
76 76 require_once(KT_LIB_DIR . "/authentication/interceptorregistry.inc.php");
77 77 require_once(KT_LIB_DIR . "/widgets/widgetfactory.inc.php");
78 78 require_once(KT_LIB_DIR . "/validation/validatorfactory.inc.php");
79   - $GLOBALS['_KT_PLUGIN'] = unserialize(file_get_contents($sPluginCache));
  79 + $GLOBALS['_KT_PLUGIN'] = $_SESSION['__KT_PLUGIN_CACHE'];
80 80 $GLOBALS['_KT_PLUGIN']['oKTPluginRegistry']->_aPlugins = array();
81 81 return;
82 82 }
... ... @@ -121,7 +121,7 @@ class KTPluginUtil {
121 121 $oPlugin->load();
122 122 }
123 123 }
124   - // file_put_contents($sPluginCache, serialize($GLOBALS['_KT_PLUGIN']));
  124 + $_SESSION['__KT_PLUGIN_CACHE'] = $GLOBALS['_KT_PLUGIN'];
125 125 }
126 126  
127 127 function registerPlugins () {
... ... @@ -164,8 +164,7 @@ class KTPluginUtil {
164 164 $oCache =& KTCache::getSingleton();
165 165 $oCache->deleteAllCaches();
166 166  
167   - $sPluginCache = KT_DIR . '/var/plugin-cache';
168   - @unlink($sPluginCache);
  167 + session_unset('__KT_PLUGIN_CACHE');
169 168 }
170 169  
171 170 function _deleteSmartyFiles() {
... ... @@ -264,4 +263,4 @@ class KTPluginUtil {
264 263 }
265 264 }
266 265  
267 266 -?>
  267 +?>
268 268 \ No newline at end of file
... ...