Module: nagvis Branch: master Commit: ff72ebf9c4ce5a14265eb4c4f0c13b9b53d9c29b URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=ff72ebf9c4ce5a14265eb4c4f0c13b9b53d9c29b
Author: LaMi <[email protected]> Date: Fri Jan 29 21:13:35 2010 +0100 #184 Removing cache of map configuration after modification --- share/server/core/classes/GlobalMapCfg.php | 10 +++++++--- share/server/core/classes/WuiMapCfg.php | 15 +++++++++++---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/share/server/core/classes/GlobalMapCfg.php b/share/server/core/classes/GlobalMapCfg.php index 283d311..367f39c 100644 --- a/share/server/core/classes/GlobalMapCfg.php +++ b/share/server/core/classes/GlobalMapCfg.php @@ -35,7 +35,7 @@ class GlobalMapCfg { protected $mapConfig; private $configFile = ''; - private $cacheFile; + protected $cacheFile = ''; // Array for config validation protected $validConfig; @@ -1157,6 +1157,10 @@ class GlobalMapCfg { if($this->configFile === '') { $this->setConfigFile($this->CORE->getMainCfg()->getValue('paths', 'mapcfg').$name.'.cfg'); } + + if($this->cacheFile === '') { + $this->cacheFile = $this->CORE->getMainCfg()->getValue('paths','var').$name.'.cfg-'.CONST_VERSION.'-cache'; + } // Initialize the map configuration cache $this->initCache(); @@ -1239,8 +1243,8 @@ class GlobalMapCfg { * @author Lars Michelsen <[email protected]> */ protected function initCache() { - if($this->name !== '') { - $this->CACHE = new GlobalFileCache($this->CORE, $this->configFile, $this->CORE->getMainCfg()->getValue('paths','var').$this->name.'.cfg-'.CONST_VERSION.'-cache'); + if($this->cacheFile !== '') { + $this->CACHE = new GlobalFileCache($this->CORE, $this->configFile, $this->cacheFile); } } diff --git a/share/server/core/classes/WuiMapCfg.php b/share/server/core/classes/WuiMapCfg.php index 8b73b10..11dc309 100644 --- a/share/server/core/classes/WuiMapCfg.php +++ b/share/server/core/classes/WuiMapCfg.php @@ -113,6 +113,9 @@ class WuiMapCfg extends GlobalMapCfg { // is file writeable? if($this->checkMapConfigWriteable($printErr)) { if(unlink($this->CORE->getMainCfg()->getValue('paths', 'mapcfg').$this->name.'.cfg')) { + // Also remove cache file + @unlink($this->cacheFile); + return TRUE; } else { if($printErr) { @@ -264,10 +267,14 @@ class WuiMapCfg extends GlobalMapCfg { } // open file for writing and replace it - $fp = fopen($this->CORE->getMainCfg()->getValue('paths', 'mapcfg').$this->name.'.cfg','w'); - fwrite($fp,implode('',$file)); - fclose($fp); - return TRUE; + $fp = fopen($this->CORE->getMainCfg()->getValue('paths', 'mapcfg').$this->name.'.cfg','w'); + fwrite($fp,implode('',$file)); + fclose($fp); + + // Also remove cache file + @unlink($this->cacheFile); + + return TRUE; } else { return FALSE; } ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
