當前位置: 首頁>>代碼示例>>PHP>>正文


PHP eZClusterFileHandler::cleanupGeneratingFiles方法代碼示例

本文整理匯總了PHP中eZClusterFileHandler::cleanupGeneratingFiles方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZClusterFileHandler::cleanupGeneratingFiles方法的具體用法?PHP eZClusterFileHandler::cleanupGeneratingFiles怎麽用?PHP eZClusterFileHandler::cleanupGeneratingFiles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在eZClusterFileHandler的用法示例。


在下文中一共展示了eZClusterFileHandler::cleanupGeneratingFiles方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testShutdownHandler

 /**
  * Tests the cluster shutdown handler.
  * Handlers that support stalecache should cleanup their generating files if any
  */
 public function testShutdownHandler()
 {
     // Call the cleanup handler called by eZExecution::cleanExit()
     self::assertFalse(eZClusterFileHandler::cleanupGeneratingFiles());
     $path1 = 'var/tests/' . __FUNCTION__ . '/uncleanfile1.txt';
     $path2 = 'var/tests/' . __FUNCTION__ . '/uncleanfile2.txt';
     $path3 = 'var/tests/' . __FUNCTION__ . '/uncleanfile3.txt';
     // start generation of a couple files
     $file1 = eZClusterFileHandler::instance($path1);
     $file1->startCacheGeneration();
     $file1->storeContents(__METHOD__);
     $file2 = eZClusterFileHandler::instance($path2);
     $file2->startCacheGeneration();
     $file2->storeContents(__METHOD__);
     $file3 = eZClusterFileHandler::instance($path3);
     $file3->startCacheGeneration();
     $file3->storeContents(__METHOD__);
     // terminate one of them
     $file2->endCacheGeneration();
     // check that the generating status is as expected
     self::assertStringEndsWith('.generating', $file1->filePath, '$file1 is not generating');
     self::assertStringEndsNotWith('.generating', $file2->filePath, '$file2 is generating');
     self::assertStringEndsWith('.generating', $file3->filePath, '$file3 is not generating');
     // Call the cleanup handler called by eZExecution::cleanExit()
     self::assertTrue(eZClusterFileHandler::cleanupGeneratingFiles(), 'eZClusterFileHandler::cleanupGeneratingFiles() returned false');
     // Check that all files are no longer marked as generating
     self::assertStringEndsNotWith('.generating', $file1->filePath, '$file1 is still generating');
     self::assertStringEndsNotWith('.generating', $file2->filePath, '$file2 is still generating');
     self::assertStringEndsNotWith('.generating', $file3->filePath, '$file3 is still generating');
 }
開發者ID:mugoweb,項目名稱:ezpublish-legacy,代碼行數:34,代碼來源:ezclusterstalecache_test.php


注:本文中的eZClusterFileHandler::cleanupGeneratingFiles方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。