Commit 71bdb577e1a0b320fcd7bd77998e7c5ba447ca18
1 parent
168e8c75
Delete all caches before and after registering plugins
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5739 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
33 additions
and
0 deletions
lib/plugins/pluginutil.inc.php
| ... | ... | @@ -117,6 +117,11 @@ class KTPluginUtil { |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | function registerPlugins () { |
| 120 | + KTPluginUtil::_deleteSmartyFiles(); | |
| 121 | + require_once(KT_LIB_DIR . '/cache/cache.inc.php'); | |
| 122 | + $oCache =& KTCache::getSingleton(); | |
| 123 | + $oCache->deleteAllCaches(); | |
| 124 | + | |
| 120 | 125 | $files = array(); |
| 121 | 126 | KTPluginUtil::_walk(KT_DIR . '/plugins', $files); |
| 122 | 127 | foreach ($files as $sFile) { |
| ... | ... | @@ -145,10 +150,38 @@ class KTPluginUtil { |
| 145 | 150 | } |
| 146 | 151 | } |
| 147 | 152 | KTPluginEntity::clearAllCaches(); |
| 153 | + | |
| 154 | + KTPluginUtil::_deleteSmartyFiles(); | |
| 155 | + require_once(KT_LIB_DIR . '/cache/cache.inc.php'); | |
| 156 | + $oCache =& KTCache::getSingleton(); | |
| 157 | + $oCache->deleteAllCaches(); | |
| 158 | + | |
| 148 | 159 | $sPluginCache = KT_DIR . '/var/plugin-cache'; |
| 149 | 160 | @unlink($sPluginCache); |
| 150 | 161 | } |
| 151 | 162 | |
| 163 | + function _deleteSmartyFiles() { | |
| 164 | + $oConfig =& KTConfig::getSingleton(); | |
| 165 | + $dir = sprintf('%s/%s', $oConfig->get('urls/varDirectory'), 'tmp'); | |
| 166 | + | |
| 167 | + $dh = @opendir($dir); | |
| 168 | + if (empty($dh)) { | |
| 169 | + return; | |
| 170 | + } | |
| 171 | + $aFiles = array(); | |
| 172 | + while (false !== ($sFilename = readdir($dh))) { | |
| 173 | + if (substr($sFilename, -10) == "smarty.inc") { | |
| 174 | + $aFiles[] = sprintf('%s/%s', $dir, $sFilename); | |
| 175 | + } | |
| 176 | + if (substr($sFilename, -10) == "smarty.php") { | |
| 177 | + $aFiles[] = sprintf('%s/%s', $dir, $sFilename); | |
| 178 | + } | |
| 179 | + } | |
| 180 | + foreach ($aFiles as $sFile) { | |
| 181 | + @unlink($sFile); | |
| 182 | + } | |
| 183 | + } | |
| 184 | + | |
| 152 | 185 | function _walk ($path, &$files) { |
| 153 | 186 | if (!is_dir($path)) { |
| 154 | 187 | return; | ... | ... |