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


PHP FileBackend::splitStoragePath方法代码示例

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


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

示例1: backendFromPath

 /**
  * Get an appropriate backend object from a storage path
  *
  * @param string $storagePath
  * @return FileBackend|null Backend or null on failure
  */
 public function backendFromPath($storagePath)
 {
     list($backend, , ) = FileBackend::splitStoragePath($storagePath);
     if ($backend !== null && isset($this->backends[$backend])) {
         return $this->get($backend);
     }
     return null;
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:14,代码来源:FileBackendGroup.php

示例2: getBackendPaths

 /**
  * Translate legacy "title" paths to their "sha1" counterparts
  *
  * E.g. mwstore://local-backend/local-public/a/ab/<name>.jpg
  * => mwstore://local-backend/local-original/x/y/z/<sha1>.jpg
  *
  * @param array $paths
  * @param bool $latest
  * @return array Translated paths in same order
  */
 public function getBackendPaths(array $paths, $latest = true)
 {
     $db = $this->getDB($latest ? DB_MASTER : DB_SLAVE);
     $origBasePath = $this->backend->getContainerStoragePath("{$this->repoName}-original");
     // @TODO: batching
     $resolved = array();
     foreach ($paths as $i => $path) {
         if (!$latest && $this->resolvedPathCache->has($path, 'target', 10)) {
             $resolved[$i] = $this->resolvedPathCache->get($path, 'target');
             continue;
         }
         list(, $container, $rel) = FileBackend::splitStoragePath($path);
         if ($container === "{$this->repoName}-public") {
             $name = basename($path);
             if (strpos($path, '!') !== false) {
                 $sha1 = $db->selectField('oldimage', 'oi_sha1', array('oi_archive_name' => $name), __METHOD__);
             } else {
                 $sha1 = $db->selectField('image', 'img_sha1', array('img_name' => $name), __METHOD__);
             }
             if (!strlen($sha1)) {
                 $resolved[$i] = $path;
                 // give up
                 continue;
             }
             $resolved[$i] = $this->getPathForSHA1($sha1);
             $this->resolvedPathCache->set($path, 'target', $resolved[$i]);
         } elseif ($container === "{$this->repoName}-deleted") {
             $name = basename($path);
             // <hash>.<ext>
             $sha1 = substr($name, 0, strpos($name, '.'));
             // ignore extension
             $resolved[$i] = $this->getPathForSHA1($sha1);
             $this->resolvedPathCache->set($path, 'target', $resolved[$i]);
         } else {
             $resolved[$i] = $path;
         }
     }
     $res = array();
     foreach ($paths as $i => $path) {
         $res[$i] = $resolved[$i];
     }
     return $res;
 }
开发者ID:nanasess,项目名称:mediawiki,代码行数:53,代码来源:FileBackendDBRepoWrapper.php

示例3: initDirectory

 /**
  * Creates a directory with the appropriate zone permissions.
  * Callers are responsible for doing read-only and "writable repo" checks.
  *
  * @param string $dir Virtual URL (or storage path) of directory to clean
  * @return Status
  */
 protected function initDirectory($dir)
 {
     $path = $this->resolveToStoragePath($dir);
     list(, $container, ) = FileBackend::splitStoragePath($path);
     $params = array('dir' => $path);
     if ($this->isPrivate || $container === $this->zones['deleted']['container']) {
         # Take all available measures to prevent web accessibility of new deleted
         # directories, in case the user has not configured offline storage
         $params = array('noAccess' => true, 'noListing' => true) + $params;
     }
     return $this->backend->prepare($params);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:19,代码来源:FileRepo.php

示例4: testSplitStoragePath

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

示例5: getFileListInternal

 /**
  * @see FileBackendStore::getFileListInternal()
  * @param string $fullCont
  * @param string $dirRel
  * @param array $params
  * @return array|FSFileBackendFileList|null
  */
 public function getFileListInternal($fullCont, $dirRel, array $params)
 {
     list(, $shortCont, ) = FileBackend::splitStoragePath($params['dir']);
     $contRoot = $this->containerFSRoot($shortCont, $fullCont);
     // must be valid
     $dir = $dirRel != '' ? "{$contRoot}/{$dirRel}" : $contRoot;
     $exists = is_dir($dir);
     if (!$exists) {
         wfDebug(__METHOD__ . "() given directory does not exist: '{$dir}'\n");
         return array();
         // nothing under this dir
     } elseif (!is_readable($dir)) {
         wfDebug(__METHOD__ . "() given directory is unreadable: '{$dir}'\n");
         return null;
         // bad permissions?
     }
     return new FSFileBackendFileList($dir, $params);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:25,代码来源:FSFileBackend.php


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