当前位置: 首页>>代码示例>>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;未经允许,请勿转载。