/** * Returns array with cache statistics data. * Returns an empty array in case of disabled html cache. * * @return array */ public function readStatistic() { $result = array(); if ($this->statFile && $this->statFile->isExists()) { $fileValues = explode(",", $this->statFile->getContents()); $result = array("HITS" => intval($fileValues[0]), "MISSES" => intval($fileValues[1]), "QUOTA" => intval($fileValues[2]), "POSTS" => intval($fileValues[3]), "FILE_SIZE" => doubleval($fileValues[4])); } return $result; }
private function reindexFile($siteId, $rootPath, $path, $maxFileSize = 0) { $pathAbs = IO\Path::combine($rootPath, $path); if (!UrlRewriter::checkPath($pathAbs)) { return 0; } $file = new IO\File($pathAbs); if ($maxFileSize > 0 && $file->getFileSize() > $maxFileSize * 1024) { return 0; } $fileSrc = $file->getContents(); if (!$fileSrc || $fileSrc == "") { return 0; } $arComponents = \PHPParser::parseScript($fileSrc); for ($i = 0, $cnt = count($arComponents); $i < $cnt; $i++) { Component\ParametersTable::add(array('SITE_ID' => $siteId, 'COMPONENT_NAME' => $arComponents[$i]["DATA"]["COMPONENT_NAME"], 'TEMPLATE_NAME' => $arComponents[$i]["DATA"]["TEMPLATE_NAME"], 'REAL_PATH' => $path, 'SEF_MODE' => $arComponents[$i]["DATA"]["PARAMS"]["SEF_MODE"] == "Y" ? Component\ParametersTable::SEF_MODE : Component\ParametersTable::NOT_SEF_MODE, 'SEF_FOLDER' => $arComponents[$i]["DATA"]["PARAMS"]["SEF_MODE"] == "Y" ? $arComponents[$i]["DATA"]["PARAMS"]["SEF_FOLDER"] : null, 'START_CHAR' => $arComponents[$i]["START"], 'END_CHAR' => $arComponents[$i]["END"], 'PARAMETERS' => serialize($arComponents[$i]["DATA"]["PARAMS"]))); if ($arComponents[$i]["DATA"]["PARAMS"]["SEF_MODE"] == "Y") { $arFields = array("CONDITION" => "#^" . $arComponents[$i]["DATA"]["PARAMS"]["SEF_FOLDER"] . "#", "RULE" => "", "ID" => $arComponents[$i]["DATA"]["COMPONENT_NAME"], "PATH" => $path, "SORT" => self::DEFAULT_SORT); UrlRewriter::add($siteId, $arFields); } } return true; }