/** * Tests File::getMTime */ public function testGetMTime() { $spl = $this->getFileInfo(); $file = new File($spl); $time = $file->getMTime(); $this->assertEquals($spl->getMTime(), $time); }
/** * Delete all values from the cache * * @param boolean $check Optional - only delete expired cache items * @return boolean True if the cache was successfully cleared, false otherwise */ public function clear($check) { if (!$this->_init) { return false; } $dir = dir($this->settings['path']); if ($check) { $now = time(); $threshold = $now - $this->settings['duration']; } $prefixLength = strlen($this->settings['prefix']); while (($entry = $dir->read()) !== false) { if (substr($entry, 0, $prefixLength) !== $this->settings['prefix']) { continue; } if ($this->_setKey($entry) === false) { continue; } if ($check) { $mtime = $this->_File->getMTime(); if ($mtime > $threshold) { continue; } $expires = (int)$this->_File->current(); if ($expires > $now) { continue; } } $path = $this->_File->getRealPath(); $this->_File = null; if (file_exists($path)) { unlink($path); } } $dir->close(); return true; }
$xml_time = strtotime($h1['Last-Modified']); } else { $xml_time = strtotime($h1['last-modified']); } unset($h1); unset($h2); } } else { $xml_stats = new File($_CONFIG['stats.xml'][$system->as], 'r'); if (!$xml_stats->exists()) { die("Error, File: \"{$_CONFIG['stats.xml'][$system->as]}\" not exists"); } if (!$xml_stats->open()) { $xml_time = -2; } else { $xml_time = $xml_stats->getMTime(); } // die("Error, File: \"{$_CONFIG['stats.xml'][$system->as]}\" can't read"); object_checkError($xml_time); $xml_stats->close(); } extract($system->cache->c_get("XML", "xml-stats", array('xml_time' => $xml_time, '_CONFIG' => $_CONFIG)), EXTR_OVERWRITE); $system->xmlfix(); if (count($system->tpl) < 1) { die("Error, tpl not found"); } $tpl = new Template($system->_root . $_CONFIG['tpl'] . $system->tpl[$_SESSION['tplsl']]['name'] . "/"); if ($tpl->setFile('page', "main.tpl")) { $tpl->parseFile('page'); } else { if ($_SESSION['tplsl'] == $system->d_tpl) {
/** * Returns information about a media file * ファイルの詳細情報 * @param string $page ページ名 * @param string $filename ファイル名 * @return struct */ public function getAttachmentInfo($page, $filename) { $wiki = Factory::Wiki($pagename); if (!$wiki->isValied() || !$wiki->isReadable()) { return false; } $attach = Factory::Attach($page, $filename); if (!$attach->has()) { return false; } $f = new File(UPLOAD_DIR . $this->files[0]); return array('mime' => $attach->getMime(), 'size' => $f->getSize(), 'lastModified' => $f->getMTime(), 'md5' => $f->md5()); }