本文整理匯總了PHP中Zend_Search_Lucene_Storage_Directory_Filesystem::fileModified方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Search_Lucene_Storage_Directory_Filesystem::fileModified方法的具體用法?PHP Zend_Search_Lucene_Storage_Directory_Filesystem::fileModified怎麽用?PHP Zend_Search_Lucene_Storage_Directory_Filesystem::fileModified使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Search_Lucene_Storage_Directory_Filesystem
的用法示例。
在下文中一共展示了Zend_Search_Lucene_Storage_Directory_Filesystem::fileModified方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testFilesystem
public function testFilesystem()
{
$tempPath = dirname(__FILE__) . '/_tempFiles/_files';
if (is_dir($tempPath)) {
// remove files from temporary direcytory
$dir = opendir($tempPath);
while (($file = readdir($dir)) !== false) {
if (!is_dir($tempPath . '/' . $file)) {
@unlink($tempPath . '/' . $file);
}
}
closedir($dir);
}
$directory = new Zend_Search_Lucene_Storage_Directory_Filesystem($tempPath);
$this->assertTrue($directory instanceof Zend_Search_Lucene_Storage_Directory);
$this->assertEquals(count($directory->fileList()), 0);
$fileObject = $directory->createFile('file1');
$this->assertTrue($fileObject instanceof Zend_Search_Lucene_Storage_File);
unset($fileObject);
$this->assertEquals($directory->fileLength('file1'), 0);
$this->assertEquals(count(array_diff($directory->fileList(), array('file1'))), 0);
$directory->deleteFile('file1');
$this->assertEquals(count($directory->fileList()), 0);
$this->assertFalse($directory->fileExists('file2'));
$fileObject = $directory->createFile('file2');
$this->assertEquals($directory->fileLength('file2'), 0);
$fileObject->writeBytes('0123456789');
unset($fileObject);
$this->assertEquals($directory->fileLength('file2'), 10);
$directory->renameFile('file2', 'file3');
$this->assertEquals(count(array_diff($directory->fileList(), array('file3'))), 0);
$modifiedAt1 = $directory->fileModified('file3');
clearstatcache();
$directory->touchFile('file3');
$modifiedAt2 = $directory->fileModified('file3');
sleep(1);
clearstatcache();
$directory->touchFile('file3');
$modifiedAt3 = $directory->fileModified('file3');
$this->assertTrue($modifiedAt2 >= $modifiedAt1);
$this->assertTrue($modifiedAt3 > $modifiedAt2);
$fileObject = $directory->getFileObject('file3');
$this->assertEquals($fileObject->readBytes($directory->fileLength('file3')), '0123456789');
unset($fileObject);
$fileObject = $directory->createFile('file3');
$this->assertEquals($fileObject->readBytes($directory->fileLength('file3')), '');
unset($fileObject);
$directory->deleteFile('file3');
$this->assertEquals(count($directory->fileList()), 0);
$directory->close();
}