@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | foreach ($domains as $domain => $routes) { |
| 38 | 38 | $pDomain = str_replace('@', '', $domain); |
| 39 | 39 | $pDomain = str_replace('/', '', $pDomain); |
| 40 | - $response[] = strtolower($pDomain) . '.api.secret'; |
|
| 40 | + $response[] = strtolower($pDomain).'.api.secret'; |
|
| 41 | 41 | } |
| 42 | 42 | return $this->json($response); |
| 43 | 43 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function config() |
| 55 | 55 | { |
| 56 | - Logger::log("Config loaded executed by " . $this->getRequest()->getRequestUri()); |
|
| 56 | + Logger::log("Config loaded executed by ".$this->getRequest()->getRequestUri()); |
|
| 57 | 57 | if (defined('PSFS_UNIT_TESTING_EXECUTION')) { |
| 58 | 58 | throw new ConfigException('CONFIG'); |
| 59 | 59 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | Security::getInstance()->setFlash("callback_message", t("Configuración actualizada correctamente")); |
| 94 | 94 | Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-config", true)); |
| 95 | - } else { |
|
| 95 | + }else { |
|
| 96 | 96 | throw new HttpException(t('Error al guardar la configuración, prueba a cambiar los permisos'), 403); |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | $objects = scandir($dir); |
| 25 | 25 | foreach ($objects as $object) { |
| 26 | 26 | if ($object != "." && $object != "..") { |
| 27 | - if (filetype($dir . "/" . $object) == "dir") { |
|
| 28 | - self::deleteDir($dir . "/" . $object); |
|
| 29 | - } else { |
|
| 30 | - unlink($dir . "/" . $object); |
|
| 27 | + if (filetype($dir."/".$object) == "dir") { |
|
| 28 | + self::deleteDir($dir."/".$object); |
|
| 29 | + }else { |
|
| 30 | + unlink($dir."/".$object); |
|
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | } |
@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | $rootDirs = array("css", "js", "media", "font"); |
| 45 | 45 | foreach ($rootDirs as $dir) { |
| 46 | - if (file_exists(WEB_DIR . DIRECTORY_SEPARATOR . $dir)) { |
|
| 46 | + if (file_exists(WEB_DIR.DIRECTORY_SEPARATOR.$dir)) { |
|
| 47 | 47 | try { |
| 48 | - self::deleteDir(WEB_DIR . DIRECTORY_SEPARATOR . $dir); |
|
| 49 | - } catch (\Exception $e) { |
|
| 48 | + self::deleteDir(WEB_DIR.DIRECTORY_SEPARATOR.$dir); |
|
| 49 | + }catch (\Exception $e) { |
|
| 50 | 50 | syslog(LOG_INFO, $e->getMessage()); |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -63,12 +63,12 @@ discard block |
||
| 63 | 63 | if (!empty($dir)) { |
| 64 | 64 | try { |
| 65 | 65 | if (!is_dir($dir) && @mkdir($dir, 0775, true) === false) { |
| 66 | - throw new \Exception(t('Can\'t create directory ') . $dir); |
|
| 66 | + throw new \Exception(t('Can\'t create directory ').$dir); |
|
| 67 | 67 | } |
| 68 | - } catch (\Exception $e) { |
|
| 68 | + }catch (\Exception $e) { |
|
| 69 | 69 | syslog(LOG_WARNING, $e->getMessage()); |
| 70 | 70 | if (!file_exists(dirname($dir))) { |
| 71 | - throw new GeneratorException($e->getMessage() . $dir); |
|
| 71 | + throw new GeneratorException($e->getMessage().$dir); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public static function getTemplatePath() |
| 82 | 82 | { |
| 83 | - $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR; |
|
| 83 | + $path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR; |
|
| 84 | 84 | return realpath($path); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | } elseif (!$reflector->isAbstract()) { |
| 110 | 110 | throw new GeneratorException(t('La clase definida debe ser abstracta'), 501); |
| 111 | 111 | } |
| 112 | - } else { |
|
| 112 | + }else { |
|
| 113 | 113 | throw new GeneratorException(t('La clase definida para extender la API no existe'), 501); |
| 114 | 114 | } |
| 115 | 115 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | GeneratorHelper::createDir($path); |
| 132 | 132 | $paths = array("js", "css", "img", "media", "font"); |
| 133 | 133 | foreach ($paths as $htmlPath) { |
| 134 | - GeneratorHelper::createDir($path . DIRECTORY_SEPARATOR . $htmlPath); |
|
| 134 | + GeneratorHelper::createDir($path.DIRECTORY_SEPARATOR.$htmlPath); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | // Generates the root needed files |
@@ -141,31 +141,31 @@ discard block |
||
| 141 | 141 | 'crossdomain' => 'crossdomain.xml', |
| 142 | 142 | 'humans' => 'humans.txt', |
| 143 | 143 | 'robots' => 'robots.txt', |
| 144 | - 'docker' => '..' . DIRECTORY_SEPARATOR . 'docker-compose.yml', |
|
| 144 | + 'docker' => '..'.DIRECTORY_SEPARATOR.'docker-compose.yml', |
|
| 145 | 145 | ]; |
| 146 | 146 | $verificable = ['humans', 'robots', 'docker']; |
| 147 | 147 | $output->writeln('Start creating html files'); |
| 148 | 148 | foreach ($files as $template => $filename) { |
| 149 | - if (in_array($template, $verificable) && file_exists($path . DIRECTORY_SEPARATOR . $filename)) { |
|
| 150 | - $output->writeln($filename . ' already exists'); |
|
| 149 | + if (in_array($template, $verificable) && file_exists($path.DIRECTORY_SEPARATOR.$filename)) { |
|
| 150 | + $output->writeln($filename.' already exists'); |
|
| 151 | 151 | continue; |
| 152 | 152 | } |
| 153 | - $text = Template::getInstance()->dump("generator/html/" . $template . '.html.twig'); |
|
| 154 | - if (false === file_put_contents($path . DIRECTORY_SEPARATOR . $filename, $text)) { |
|
| 153 | + $text = Template::getInstance()->dump("generator/html/".$template.'.html.twig'); |
|
| 154 | + if (false === file_put_contents($path.DIRECTORY_SEPARATOR.$filename, $text)) { |
|
| 155 | 155 | if (!$quiet) { |
| 156 | - $output->writeln('Can\t create the file ' . $filename); |
|
| 156 | + $output->writeln('Can\t create the file '.$filename); |
|
| 157 | 157 | } |
| 158 | - } else { |
|
| 158 | + }else { |
|
| 159 | 159 | if (!$quiet) { |
| 160 | - $output->writeln($filename . ' created successfully'); |
|
| 160 | + $output->writeln($filename.' created successfully'); |
|
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | //Export base locale translations |
| 166 | - if (!file_exists(BASE_DIR . DIRECTORY_SEPARATOR . 'locale')) { |
|
| 167 | - GeneratorHelper::createDir(BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
| 168 | - self::copyr(SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'locale', BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
| 166 | + if (!file_exists(BASE_DIR.DIRECTORY_SEPARATOR.'locale')) { |
|
| 167 | + GeneratorHelper::createDir(BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
| 168 | + self::copyr(SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'locale', BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
@@ -181,12 +181,12 @@ discard block |
||
| 181 | 181 | { |
| 182 | 182 | if (file_exists($filenamePath)) { |
| 183 | 183 | $destfolder = basename($filenamePath); |
| 184 | - if (!file_exists(WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) || $debug || $force) { |
|
| 184 | + if (!file_exists(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) || $debug || $force) { |
|
| 185 | 185 | if (is_dir($filenamePath)) { |
| 186 | - self::copyr($filenamePath, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder); |
|
| 187 | - } else { |
|
| 188 | - if (@copy($filenamePath, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) === FALSE) { |
|
| 189 | - throw new ConfigException("Can't copy " . $filenamePath . " to " . WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder); |
|
| 186 | + self::copyr($filenamePath, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
|
| 187 | + }else { |
|
| 188 | + if (@copy($filenamePath, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) { |
|
| 189 | + throw new ConfigException("Can't copy ".$filenamePath." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | } |
@@ -204,10 +204,10 @@ discard block |
||
| 204 | 204 | self::createDir($dst); |
| 205 | 205 | while (false !== ($file = readdir($dir))) { |
| 206 | 206 | if (($file != '.') && ($file != '..')) { |
| 207 | - if (is_dir($src . '/' . $file)) { |
|
| 208 | - self::copyr($src . '/' . $file, $dst . '/' . $file); |
|
| 209 | - } elseif (@copy($src . '/' . $file, $dst . '/' . $file) === false) { |
|
| 210 | - throw new ConfigException("Can't copy " . $src . " to " . $dst); |
|
| 207 | + if (is_dir($src.'/'.$file)) { |
|
| 208 | + self::copyr($src.'/'.$file, $dst.'/'.$file); |
|
| 209 | + } elseif (@copy($src.'/'.$file, $dst.'/'.$file) === false) { |
|
| 210 | + throw new ConfigException("Can't copy ".$src." to ".$dst); |
|
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | } |
@@ -21,10 +21,10 @@ |
||
| 21 | 21 | $now = new \DateTime(); |
| 22 | 22 | $now->setTimezone(new \DateTimeZone(Config::getParam('project.timezone', 'Europe/Madrid'))); |
| 23 | 23 | $config = Config::getInstance()->dumpConfig(); |
| 24 | - if (file_exists(CACHE_DIR . DIRECTORY_SEPARATOR . $config[self::CACHE_VAR_TAG] . '.file.cache')) { |
|
| 25 | - unlink(CACHE_DIR . DIRECTORY_SEPARATOR . $config[self::CACHE_VAR_TAG] . '.file.cache'); |
|
| 24 | + if (file_exists(CACHE_DIR.DIRECTORY_SEPARATOR.$config[self::CACHE_VAR_TAG].'.file.cache')) { |
|
| 25 | + unlink(CACHE_DIR.DIRECTORY_SEPARATOR.$config[self::CACHE_VAR_TAG].'.file.cache'); |
|
| 26 | 26 | } |
| 27 | - $config[self::CACHE_VAR_TAG] = 'v' . $now->format('Ymd.His'); |
|
| 27 | + $config[self::CACHE_VAR_TAG] = 'v'.$now->format('Ymd.His'); |
|
| 28 | 28 | Config::save($config); |
| 29 | 29 | return $config[self::CACHE_VAR_TAG]; |
| 30 | 30 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | protected function init() |
| 98 | 98 | { |
| 99 | - if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE)) { |
|
| 99 | + if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE)) { |
|
| 100 | 100 | $this->loadConfigData(); |
| 101 | 101 | } |
| 102 | 102 | return $this; |
@@ -211,13 +211,13 @@ discard block |
||
| 211 | 211 | $finalData = self::saveExtraParams($data); |
| 212 | 212 | $saved = false; |
| 213 | 213 | try { |
| 214 | - $finalData = array_filter($finalData, function ($key, $value) { |
|
| 214 | + $finalData = array_filter($finalData, function($key, $value) { |
|
| 215 | 215 | return in_array($key, self::$required, true) || !empty($value); |
| 216 | 216 | }, ARRAY_FILTER_USE_BOTH); |
| 217 | - $saved = (false !== file_put_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE, json_encode($finalData, JSON_PRETTY_PRINT))); |
|
| 217 | + $saved = (false !== file_put_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE, json_encode($finalData, JSON_PRETTY_PRINT))); |
|
| 218 | 218 | self::getInstance()->loadConfigData(); |
| 219 | 219 | $saved = true; |
| 220 | - } catch (ConfigException $e) { |
|
| 220 | + }catch (ConfigException $e) { |
|
| 221 | 221 | Logger::log($e->getMessage(), LOG_ERR); |
| 222 | 222 | } |
| 223 | 223 | return $saved; |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | public function loadConfigData() |
| 251 | 251 | { |
| 252 | - $this->config = json_decode(file_get_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE), true) ?: []; |
|
| 252 | + $this->config = json_decode(file_get_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE), true) ?: []; |
|
| 253 | 253 | $this->debug = array_key_exists('debug', $this->config) ? (bool)$this->config['debug'] : FALSE; |
| 254 | 254 | if (array_key_exists('cache.var', $this->config)) { |
| 255 | 255 | Security::getInstance()->setSessionKey('config.cache.var', $this->config['cache.var']); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | public static function getParam($key, $defaultValue = null, $module = null) |
| 275 | 275 | { |
| 276 | 276 | if (null !== $module) { |
| 277 | - return self::getParam(strtolower($module) . '.' . $key, self::getParam($key, $defaultValue)); |
|
| 277 | + return self::getParam(strtolower($module).'.'.$key, self::getParam($key, $defaultValue)); |
|
| 278 | 278 | } |
| 279 | 279 | $param = self::getInstance()->get($key); |
| 280 | 280 | return (null !== $param) ? $param : $defaultValue; |
@@ -291,8 +291,8 @@ discard block |
||
| 291 | 291 | $configs = ['domains.json', 'urls.json']; |
| 292 | 292 | $done = true; |
| 293 | 293 | foreach ($configs as $configFile) { |
| 294 | - if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . $configFile)) { |
|
| 295 | - if (!unlink(CONFIG_DIR . DIRECTORY_SEPARATOR . $configFile)) { |
|
| 294 | + if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.$configFile)) { |
|
| 295 | + if (!unlink(CONFIG_DIR.DIRECTORY_SEPARATOR.$configFile)) { |
|
| 296 | 296 | $done = false; |
| 297 | 297 | } |
| 298 | 298 | } |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | $filePath = ''; |
| 46 | 46 | if (!file_exists($filePath)) { |
| 47 | - $filePath = BASE_DIR . $string; |
|
| 47 | + $filePath = BASE_DIR.$string; |
|
| 48 | 48 | } |
| 49 | 49 | $filenamePath = AssetsHelper::findDomainPath($string, $filePath); |
| 50 | 50 | |
| 51 | 51 | $filePath = self::processAsset($string, $name, $return, $filenamePath); |
| 52 | 52 | $basePath = Config::getParam('resources.cdn.url', Request::getInstance()->getRootUrl()); |
| 53 | - $returnPath = empty($name) ? $basePath . '/' . $filePath : $name; |
|
| 53 | + $returnPath = empty($name) ? $basePath.'/'.$filePath : $name; |
|
| 54 | 54 | return $return ? $returnPath : ''; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $router = Router::getInstance(); |
| 68 | 68 | try { |
| 69 | 69 | return $router->getRoute($path, $absolute, $params); |
| 70 | - } catch (\Exception $e) { |
|
| 70 | + }catch (\Exception $e) { |
|
| 71 | 71 | return $router->getRoute('', $absolute, $params); |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -161,12 +161,12 @@ discard block |
||
| 161 | 161 | $domains = Template::getDomains(true); |
| 162 | 162 | $filenamePath = self::extractPathname($path, $domains); |
| 163 | 163 | // Check if resources has been copied to public folders |
| 164 | - if(!$debug) { |
|
| 165 | - $cacheFilename = Config::getParam('cache.var', '__initial__') . '.file.cache'; |
|
| 164 | + if (!$debug) { |
|
| 165 | + $cacheFilename = Config::getParam('cache.var', '__initial__').'.file.cache'; |
|
| 166 | 166 | $cachedFiles = Cache::getInstance()->readFromCache($cacheFilename, |
| 167 | 167 | 1, fn() => [], Cache::JSON, true) ?: []; |
| 168 | 168 | // Force the resource copy |
| 169 | - if(!in_array($filenamePath, $cachedFiles) || $force) { |
|
| 169 | + if (!in_array($filenamePath, $cachedFiles) || $force) { |
|
| 170 | 170 | $force = true; |
| 171 | 171 | $cachedFiles[] = $filenamePath; |
| 172 | 172 | Cache::getInstance()->storeData($cacheFilename, $cachedFiles, Cache::JSON); |
@@ -226,9 +226,9 @@ discard block |
||
| 226 | 226 | { |
| 227 | 227 | $data = file_get_contents($filenamePath); |
| 228 | 228 | if (!empty($name)) { |
| 229 | - file_put_contents(WEB_DIR . DIRECTORY_SEPARATOR . $name, $data); |
|
| 230 | - } else { |
|
| 231 | - file_put_contents($base . $filePath, $data); |
|
| 229 | + file_put_contents(WEB_DIR.DIRECTORY_SEPARATOR.$name, $data); |
|
| 230 | + }else { |
|
| 231 | + file_put_contents($base.$filePath, $data); |
|
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | 234 | |
@@ -247,9 +247,9 @@ discard block |
||
| 247 | 247 | if (file_exists($filenamePath)) { |
| 248 | 248 | list($base, $htmlBase, $filePath) = AssetsHelper::calculateAssetPath($string, $name, $return, $filenamePath); |
| 249 | 249 | //Creamos el directorio si no existe |
| 250 | - GeneratorHelper::createDir($base . $htmlBase); |
|
| 250 | + GeneratorHelper::createDir($base.$htmlBase); |
|
| 251 | 251 | //Si se ha modificado |
| 252 | - if (!file_exists($base . $filePath) || filemtime($base . $filePath) < filemtime($filenamePath)) { |
|
| 252 | + if (!file_exists($base.$filePath) || filemtime($base.$filePath) < filemtime($filenamePath)) { |
|
| 253 | 253 | if ($htmlBase === 'css') { |
| 254 | 254 | self::processCssLines($filenamePath); |
| 255 | 255 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | GeneratorHelper::createDir(dirname($path)); |
| 58 | 58 | if (false === FileHelper::writeFile($path, $data)) { |
| 59 | - throw new ConfigException(t('No se tienen los permisos suficientes para escribir en el fichero ') . $path); |
|
| 59 | + throw new ConfigException(t('No se tienen los permisos suficientes para escribir en el fichero ').$path); |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | { |
| 71 | 71 | Inspector::stats('[Cache] Gathering data from cache', Inspector::SCOPE_DEBUG); |
| 72 | 72 | $data = null; |
| 73 | - $absolutePath = $absolute ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
| 73 | + $absolutePath = $absolute ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
| 74 | 74 | if (file_exists($absolutePath)) { |
| 75 | 75 | $data = FileHelper::readFile($absolutePath); |
| 76 | 76 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | private function hasExpiredCache($path, $expires = 300, $absolute = false) |
| 87 | 87 | { |
| 88 | 88 | Inspector::stats('[Cache] Checking expiration', Inspector::SCOPE_DEBUG); |
| 89 | - $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
| 89 | + $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
| 90 | 90 | $lasModificationDate = filemtime($absolutePath); |
| 91 | 91 | return ($lasModificationDate + $expires <= time()); |
| 92 | 92 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | { |
| 154 | 154 | Inspector::stats('[Cache] Store data in cache', Inspector::SCOPE_DEBUG); |
| 155 | 155 | $data = self::transformData($data, $transform); |
| 156 | - $absolutePath = $absolute ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
| 156 | + $absolutePath = $absolute ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
| 157 | 157 | $this->saveTextToFile($data, $absolutePath); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | public function readFromCache($path, $expires = 300, $function = null, $transform = Cache::TEXT, $ignoreExpiration = false) |
| 171 | 171 | { |
| 172 | 172 | $data = null; |
| 173 | - Inspector::stats('[Cache] Reading data from cache: ' . json_encode(['path' => $path]), Inspector::SCOPE_DEBUG); |
|
| 174 | - if (file_exists(CACHE_DIR . DIRECTORY_SEPARATOR . $path)) { |
|
| 173 | + Inspector::stats('[Cache] Reading data from cache: '.json_encode(['path' => $path]), Inspector::SCOPE_DEBUG); |
|
| 174 | + if (file_exists(CACHE_DIR.DIRECTORY_SEPARATOR.$path)) { |
|
| 175 | 175 | if (is_callable($function) && $this->hasExpiredCache($path, $expires) && !$ignoreExpiration) { |
| 176 | 176 | $data = $function(); |
| 177 | 177 | $this->storeData($path, $data, $transform); |
| 178 | - } else { |
|
| 178 | + }else { |
|
| 179 | 179 | $data = $this->getDataFromFile($path, $transform); |
| 180 | 180 | } |
| 181 | 181 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $query[Api::HEADER_API_LANG] = Request::header(Api::HEADER_API_LANG, 'es'); |
| 222 | 222 | $filename = FileHelper::generateHashFilename($action['http'], $action['slug'], $query); |
| 223 | 223 | $hashPath = FileHelper::generateCachePath($action, $query); |
| 224 | - Inspector::stats('[Cache] Cache file calculated: ' . json_encode(['file' => $filename, 'hash' => $hashPath]), Inspector::SCOPE_DEBUG); |
|
| 224 | + Inspector::stats('[Cache] Cache file calculated: '.json_encode(['file' => $filename, 'hash' => $hashPath]), Inspector::SCOPE_DEBUG); |
|
| 225 | 225 | Logger::log('Cache file calculated', LOG_DEBUG, ['file' => $filename, 'hash' => $hashPath]); |
| 226 | 226 | } |
| 227 | 227 | return [$hashPath, $filename]; |
@@ -233,9 +233,9 @@ discard block |
||
| 233 | 233 | Inspector::stats('[Cache] Flushing cache', Inspector::SCOPE_DEBUG); |
| 234 | 234 | $action = Security::getInstance()->getSessionKey(self::CACHE_SESSION_VAR); |
| 235 | 235 | if (is_array($action)) { |
| 236 | - $hashPath = FileHelper::generateCachePath($action, $action['params']) . '..' . DIRECTORY_SEPARATOR . ' .. ' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; |
|
| 236 | + $hashPath = FileHelper::generateCachePath($action, $action['params']).'..'.DIRECTORY_SEPARATOR.' .. '.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR; |
|
| 237 | 237 | if (!file_exists($hashPath)) { |
| 238 | - $hashPath = CACHE_DIR . DIRECTORY_SEPARATOR . $hashPath; |
|
| 238 | + $hashPath = CACHE_DIR.DIRECTORY_SEPARATOR.$hashPath; |
|
| 239 | 239 | } |
| 240 | 240 | FileHelper::deleteDir($hashPath); |
| 241 | 241 | } |