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


PHP eZFileHandler::instance方法代码示例

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


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

示例1: clearItem

 /**
  *
  * Clears or purges the cache item $cacheItem.
  *
  * If $purge is true then the system will ensure the entries are removed from
  * local storage or database backend, otherwise it will use possible optimizations
  * which might only invalidate the cache entry directly or use global expiry values.
  *
  * @param $cacheItem Cache item array taken from fetchList()
  * @param $purge     Controls whether clearing/invalidation or purge is used.
  * @param $reporter  Callback which is called when the system has purged files from the system, called with filename and purge count as parameters.
  * @param $iterationSleep The amount of microseconds to sleep between each purge iteration, false means no sleep.
  * @param $iterationMax   The maximum number of items to purge in one iteration, false means use default limit.
  * @param $expiry         A timestamp which is matched against all cache items, if the modification of the cache is older than the expiry the cache is purged, false means no expiry checking.
  */
 static function clearItem($cacheItem, $purge = false, $reporter = false, $iterationSleep = false, $iterationMax = false, $expiry = false)
 {
     // Get the global expiry value if one is set and compare it with supplied $expiry value.
     // Use the largest value of the two.
     if (isset($cacheItem['expiry-key'])) {
         $key = $cacheItem['expiry-key'];
         eZExpiryHandler::registerShutdownFunction();
         $expiryHandler = eZExpiryHandler::instance();
         $keyValue = $expiryHandler->getTimestamp($key);
         if ($keyValue !== false) {
             if ($expiry !== false) {
                 $expiry = max($expiry, $keyValue);
             } else {
                 $expiry = $keyValue;
             }
         }
     }
     $cacheItem['purge'] = $purge;
     $cacheItem['reporter'] = $reporter;
     $cacheItem['iterationSleep'] = $iterationSleep;
     $cacheItem['iterationMax'] = $iterationMax;
     $cacheItem['expiry'] = $expiry;
     $functionName = false;
     if ($purge && isset($cacheItem['purge-function'])) {
         $functionName = 'purge-function';
     } else {
         if (!$purge && isset($cacheItem['function'])) {
             $functionName = 'function';
         }
     }
     if ($functionName) {
         $function = $cacheItem[$functionName];
         if (is_callable($function)) {
             call_user_func_array($function, array($cacheItem));
         } else {
             eZDebug::writeError("Could not call cache item {$functionName} for id '{$cacheItem['id']}', is it a static public function?", __METHOD__);
         }
     } else {
         if (!isset($cacheItem['path']) || strlen($cacheItem['path']) < 1) {
             eZDebug::writeError("No path specified for cache item '{$cacheItem['name']}', can not clear cache.", __METHOD__);
             return;
         }
         $cachePath = eZSys::cacheDirectory() . "/" . $cacheItem['path'];
         if (isset($cacheItem['is-clustered'])) {
             $isClustered = $cacheItem['is-clustered'];
         } else {
             $isClustered = false;
         }
         if ($isClustered) {
             $fileHandler = eZClusterFileHandler::instance($cachePath);
             if ($purge) {
                 $fileHandler->purge($reporter, $iterationSleep, $iterationMax, $expiry);
             } else {
                 $fileHandler->delete();
             }
             return;
         }
         if (is_file($cachePath)) {
             $handler = eZFileHandler::instance(false);
             $handler->unlink($cachePath);
         } else {
             eZDir::recursiveDelete($cachePath);
         }
     }
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:80,代码来源:ezcache.php

示例2: delete

 /**
  * Deletes specified file/directory.
  *
  * If a directory specified it is deleted recursively.
  *
  * \public
  * \static
  */
 function delete()
 {
     $path = $this->filePath;
     eZDebugSetting::writeDebug('kernel-clustering', "fs::delete( '{$path}' )", __METHOD__);
     eZDebug::accumulatorStart('dbfile', false, 'dbfile');
     if (is_file($path)) {
         $handler = eZFileHandler::instance(false);
         $handler->unlink($path);
         if (file_exists($path)) {
             eZDebug::writeError("File still exists after removal: '{$path}'", __METHOD__);
         }
     } elseif (is_dir($path)) {
         eZDir::recursiveDelete($path);
     }
     eZClusterFileHandler::cleanupEmptyDirectories($path);
     $this->loadMetaData(true);
     eZDebug::accumulatorStop('dbfile');
 }
开发者ID:schwabokaner,项目名称:ezpublish-legacy,代码行数:26,代码来源:ezfsfilehandler.php

示例3: clearActiveExtensionsCache

 /**
  * Clears (removes) active extension cache files from the cache folder.
  * @return void
  */
 public static function clearActiveExtensionsCache()
 {
     $filesList = glob(self::CACHE_DIR . 'active_extensions_*.php');
     foreach ($filesList as $path) {
         if (is_file($path)) {
             $handler = eZFileHandler::instance(false);
             $handler->unlink($path);
         }
     }
 }
开发者ID:odnarb,项目名称:ezpublish-legacy,代码行数:14,代码来源:ezextension.php


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