当前位置: 首页>>代码示例>>PHP>>正文


PHP ezpObject::purge方法代码示例

本文整理汇总了PHP中ezpObject::purge方法的典型用法代码示例。如果您正苦于以下问题:PHP ezpObject::purge方法的具体用法?PHP ezpObject::purge怎么用?PHP ezpObject::purge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ezpObject的用法示例。


在下文中一共展示了ezpObject::purge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testIssue15155

 /**
  * Regression test for issue #15155
  *
  * @link http://issues.ez.no/15155
  */
 public function testIssue15155()
 {
     // figure out the max versions for images
     $contentINI = eZINI::instance('content.ini');
     $versionlimit = $contentINI->variable('VersionManagement', 'DefaultVersionHistoryLimit');
     $limitList = eZContentClass::classIDByIdentifier($contentINI->variable('VersionManagement', 'VersionHistoryClass'));
     $classID = 5;
     // image class, can remain hardcoded, I guess
     foreach ($limitList as $key => $value) {
         if ($classID == $key) {
             $versionlimit = $value;
         }
     }
     if ($versionlimit < 2) {
         $versionlimit = 2;
     }
     $baseImagePath = dirname(__FILE__) . '/ezimagealiashandler_regression_issue15155.png';
     $parts = pathinfo($baseImagePath);
     $imagePattern = $parts['dirname'] . DIRECTORY_SEPARATOR . $parts['filename'] . '_%s_%d.' . $parts['extension'];
     $toDelete = array();
     // Create version 1
     $imagePath = sprintf($imagePattern, md5(1), 1);
     copy($baseImagePath, $imagePath);
     $toDelete[] = $imagePath;
     $image = new ezpObject('image', 43);
     $image->name = __FUNCTION__;
     $image->image = $imagePath;
     $image->publish();
     $image->refresh();
     $contentObjectID = $image->object->attribute('id');
     $dataMap = eZContentObject::fetch($contentObjectID)->dataMap();
     $originalAliases[1] = $image->image->imageAlias('original');
     for ($i = 2; $i <= 20; $i++) {
         // Create a new image file
         $imagePath = sprintf($imagePattern, md5($i), $i);
         copy($baseImagePath, $imagePath);
         $toDelete[] = $imagePath;
         $newVersion = $image->createNewVersion();
         $dataMap = $newVersion->dataMap();
         $dataMap['image']->fromString($imagePath);
         ezpObject::publishContentObject($image->object, $newVersion);
         $image->refresh();
         $originalAliases[$i] = $image->image->imageAlias('original');
         if ($i > $versionlimit) {
             $removeVersion = $i - $versionlimit;
             $aliasPath = $originalAliases[$removeVersion]['url'];
             $this->assertFalse(file_exists($aliasPath), "Alias {$aliasPath} for version {$removeVersion} should have been removed");
         }
     }
     array_map('unlink', $toDelete);
     $image->purge();
 }
开发者ID:schwabokaner,项目名称:ezpublish-legacy,代码行数:57,代码来源:ezimagealiashandler_regression.php


注:本文中的ezpObject::purge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。