/** * Tries to load the logfile from a cached request. * * @return string cachecontent, false if cache is invalid or no cached log was found */ private function getContentFromCache() { //search for a cached file $strFilename = $this->generateCachename(); if (is_file(SVN2RSS_PROJECT_ROOT . "/" . SVN2RSS_SYSTEM_FOLDER . "/" . SVN2RSS_CACHE_FOLDER . "/" . $strFilename)) { //file exists, read content $strFileContent = file_get_contents(SVN2RSS_PROJECT_ROOT . "/" . SVN2RSS_SYSTEM_FOLDER . "/" . SVN2RSS_CACHE_FOLDER . "/" . $strFilename); //validate cache-lease-time, so get first row $strFirstRow = trim(substr($strFileContent, 0, strpos($strFileContent, "\r\n"))); //format: projectname | version | generation time hr | gentime in secs $arrFirstRowParts = explode("|", $strFirstRow); $intTimestamp = trim($arrFirstRowParts[3]); //validate the timestamp against the refreh interval if ($intTimestamp >= time() - $this->objConfig->getIntRefreshInterval()) { $strLogContent = substr($strFileContent, strpos($strFileContent, "\r\n") + 2); return $strLogContent; } } return false; }