@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | { |
| 51 | 51 | GeneratorHelper::createDir(dirname($path)); |
| 52 | 52 | if (false === FileHelper::writeFile($path, $data)) { |
| 53 | - throw new ConfigException(_('No se tienen los permisos suficientes para escribir en el fichero ') . $path); |
|
| 53 | + throw new ConfigException(_('No se tienen los permisos suficientes para escribir en el fichero ').$path); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | Logger::log('Gathering data from cache', LOG_DEBUG, ['path' => $path]); |
| 67 | 67 | $data = null; |
| 68 | - $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
| 68 | + $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
| 69 | 69 | if (file_exists($absolutePath)) { |
| 70 | 70 | $data = FileHelper::readFile($absolutePath); |
| 71 | 71 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | private function hasExpiredCache($path, $expires = 300, $absolute = false) |
| 83 | 83 | { |
| 84 | 84 | Logger::log('Checking expiration', LOG_DEBUG, ['path' => $path]); |
| 85 | - $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
| 85 | + $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
| 86 | 86 | $lasModificationDate = filemtime($absolutePath); |
| 87 | 87 | return ($lasModificationDate + $expires <= time()); |
| 88 | 88 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | { |
| 152 | 152 | Logger::log('Store data in cache', LOG_DEBUG, ['path' => $path]); |
| 153 | 153 | $data = Cache::transformData($data, $transform); |
| 154 | - $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
| 154 | + $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
| 155 | 155 | $this->saveTextToFile($data, $absolutePath); |
| 156 | 156 | } |
| 157 | 157 | |
@@ -167,11 +167,11 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | $data = null; |
| 169 | 169 | Logger::log('Reading data from cache', LOG_DEBUG, ['path' => $path]); |
| 170 | - if (file_exists(CACHE_DIR . DIRECTORY_SEPARATOR . $path)) { |
|
| 170 | + if (file_exists(CACHE_DIR.DIRECTORY_SEPARATOR.$path)) { |
|
| 171 | 171 | if (is_callable($function) && $this->hasExpiredCache($path, $expires)) { |
| 172 | 172 | $data = call_user_func($function); |
| 173 | 173 | $this->storeData($path, $data, $transform, false, $expires); |
| 174 | - } else { |
|
| 174 | + }else { |
|
| 175 | 175 | $data = $this->getDataFromFile($path, $transform); |
| 176 | 176 | } |
| 177 | 177 | } |
@@ -228,13 +228,13 @@ discard block |
||
| 228 | 228 | * Flush cache when save a registry |
| 229 | 229 | */ |
| 230 | 230 | public function flushCache() { |
| 231 | - if(Config::getParam('cache.data.enable', false)) { |
|
| 231 | + if (Config::getParam('cache.data.enable', false)) { |
|
| 232 | 232 | Logger::log('Flushing cache', LOG_DEBUG); |
| 233 | 233 | $action = Security::getInstance()->getSessionKey("__CACHE__"); |
| 234 | - if(is_array($action)) { |
|
| 235 | - $hashPath = FileHelper::generateCachePath($action, $action['params']) . '..' . DIRECTORY_SEPARATOR . ' .. ' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; |
|
| 236 | - if(!file_exists($hashPath)) { |
|
| 237 | - $hashPath = CACHE_DIR . DIRECTORY_SEPARATOR . $hashPath; |
|
| 234 | + if (is_array($action)) { |
|
| 235 | + $hashPath = FileHelper::generateCachePath($action, $action['params']).'..'.DIRECTORY_SEPARATOR.' .. '.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR; |
|
| 236 | + if (!file_exists($hashPath)) { |
|
| 237 | + $hashPath = CACHE_DIR.DIRECTORY_SEPARATOR.$hashPath; |
|
| 238 | 238 | } |
| 239 | 239 | FileHelper::deleteDir($hashPath); |
| 240 | 240 | } |