private function doTestGetFileStat($path, $content, $alreadyExists) { $backendName = $this->backendClass(); if ($alreadyExists) { $this->prepare(array('dir' => dirname($path))); $status = $this->create(array('dst' => $path, 'content' => $content)); $this->assertGoodStatus($status, "Creation of file at {$path} succeeded ({$backendName})."); $size = $this->backend->getFileSize(array('src' => $path)); $time = $this->backend->getFileTimestamp(array('src' => $path)); $stat = $this->backend->getFileStat(array('src' => $path)); $this->assertEquals(strlen($content), $size, "Correct file size of '{$path}'"); $this->assertTrue(abs(time() - wfTimestamp(TS_UNIX, $time)) < 10, "Correct file timestamp of '{$path}'"); $size = $stat['size']; $time = $stat['mtime']; $this->assertEquals(strlen($content), $size, "Correct file size of '{$path}'"); $this->assertTrue(abs(time() - wfTimestamp(TS_UNIX, $time)) < 10, "Correct file timestamp of '{$path}'"); $this->backend->clearCache(array($path)); $size = $this->backend->getFileSize(array('src' => $path)); $this->assertEquals(strlen($content), $size, "Correct file size of '{$path}'"); $this->backend->preloadCache(array($path)); $size = $this->backend->getFileSize(array('src' => $path)); $this->assertEquals(strlen($content), $size, "Correct file size of '{$path}'"); } else { $size = $this->backend->getFileSize(array('src' => $path)); $time = $this->backend->getFileTimestamp(array('src' => $path)); $stat = $this->backend->getFileStat(array('src' => $path)); $this->assertFalse($size, "Correct file size of '{$path}'"); $this->assertFalse($time, "Correct file timestamp of '{$path}'"); $this->assertFalse($stat, "Correct file stat of '{$path}'"); } }
public function clearCache(array $paths = null) { $this->backend->clearCache(null); // clear all }