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


PHP FileBackend::normalizeStoragePath方法代码示例

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


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

示例1: primeFileCache

 /**
  * Do a batch lookup from cache for file stats for all paths
  * used in a list of storage paths or FileOp objects.
  * This loads the persistent cache values into the process cache.
  *
  * @param array $items List of storage paths
  */
 protected final function primeFileCache(array $items)
 {
     $ps = $this->scopedProfileSection(__METHOD__ . "-{$this->name}");
     $paths = [];
     // list of storage paths
     $pathNames = [];
     // (cache key => storage path)
     // Get all the paths/containers from the items...
     foreach ($items as $item) {
         if (self::isStoragePath($item)) {
             $paths[] = FileBackend::normalizeStoragePath($item);
         }
     }
     // Get rid of any paths that failed normalization...
     $paths = array_filter($paths, 'strlen');
     // remove nulls
     // Get all the corresponding cache keys for paths...
     foreach ($paths as $path) {
         list(, $rel, ) = $this->resolveStoragePath($path);
         if ($rel !== null) {
             // valid path for this backend
             $pathNames[$this->fileCacheKey($path)] = $path;
         }
     }
     // Get all cache entries for these file cache keys...
     $values = $this->memCache->getMulti(array_keys($pathNames));
     foreach ($values as $cacheKey => $val) {
         $path = $pathNames[$cacheKey];
         if (is_array($val)) {
             $val['latest'] = false;
             // never completely trust cache
             $this->cheapCache->set($path, 'stat', $val);
             if (isset($val['sha1'])) {
                 // some backends store SHA-1 as metadata
                 $this->cheapCache->set($path, 'sha1', ['hash' => $val['sha1'], 'latest' => false]);
             }
             if (isset($val['xattr'])) {
                 // some backends store headers/metadata
                 $val['xattr'] = self::normalizeXAttributes($val['xattr']);
                 $this->cheapCache->set($path, 'xattr', ['map' => $val['xattr'], 'latest' => false]);
             }
         }
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:51,代码来源:FileBackendStore.php

示例2: testNormalizeStoragePath

 /**
  * @dataProvider provider_normalizeStoragePath
  */
 public function testNormalizeStoragePath($path, $res)
 {
     $this->assertEquals($res, FileBackend::normalizeStoragePath($path), "FileBackend::normalizeStoragePath on path '{$path}'");
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:7,代码来源:FileBackendTest.php

示例3: normalizeIfValidStoragePath

 /**
  * Normalize a string if it is a valid storage path
  *
  * @param $path string
  * @return string
  */
 protected static function normalizeIfValidStoragePath($path)
 {
     if (FileBackend::isStoragePath($path)) {
         $res = FileBackend::normalizeStoragePath($path);
         return $res !== null ? $res : $path;
     }
     return $path;
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:14,代码来源:FileOp.php

示例4: primeFileCache

 /**
  * Do a batch lookup from cache for file stats for all paths
  * used in a list of storage paths or FileOp objects.
  * This loads the persistent cache values into the process cache.
  *
  * @param array $items List of storage paths or FileOps
  * @return void
  */
 protected final function primeFileCache(array $items)
 {
     wfProfileIn(__METHOD__);
     wfProfileIn(__METHOD__ . '-' . $this->name);
     $paths = array();
     // list of storage paths
     $pathNames = array();
     // (cache key => storage path)
     // Get all the paths/containers from the items...
     foreach ($items as $item) {
         if ($item instanceof FileOp) {
             $paths = array_merge($paths, $item->storagePathsRead());
             $paths = array_merge($paths, $item->storagePathsChanged());
         } elseif (self::isStoragePath($item)) {
             $paths[] = FileBackend::normalizeStoragePath($item);
         }
     }
     // Get rid of any paths that failed normalization...
     $paths = array_filter($paths, 'strlen');
     // remove nulls
     // Get all the corresponding cache keys for paths...
     foreach ($paths as $path) {
         list(, $rel, ) = $this->resolveStoragePath($path);
         if ($rel !== null) {
             // valid path for this backend
             $pathNames[$this->fileCacheKey($path)] = $path;
         }
     }
     // Get all cache entries for these container cache keys...
     $values = $this->memCache->getMulti(array_keys($pathNames));
     foreach ($values as $cacheKey => $val) {
         if (is_array($val)) {
             $path = $pathNames[$cacheKey];
             $this->cheapCache->set($path, 'stat', $val);
             if (isset($val['sha1'])) {
                 // some backends store SHA-1 as metadata
                 $this->cheapCache->set($path, 'sha1', array('hash' => $val['sha1'], 'latest' => $val['latest']));
             }
         }
     }
     wfProfileOut(__METHOD__ . '-' . $this->name);
     wfProfileOut(__METHOD__);
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:51,代码来源:FileBackendStore.php


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