• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP FileRepo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: storeit

 /**
  * Store a file or virtual URL source into a media file name.
  *
  * @param $originalName string The title of the image
  * @param $srcPath string The filepath or virtual URL
  * @param $flags integer Flags to pass into repo::store().
  * @return FileRepoStatus
  */
 private function storeit($originalName, $srcPath, $flags)
 {
     $hashPath = $this->repo->getHashPath($originalName);
     $dstRel = "{$hashPath}{$this->date}!{$originalName}";
     $dstUrlRel = $hashPath . $this->date . '!' . rawurlencode($originalName);
     $result = $this->repo->store($srcPath, 'temp', $dstRel, $flags);
     $result->value = $this->repo->getVirtualUrl('temp') . '/' . $dstUrlRel;
     $this->createdFiles[] = $result->value;
     return $result;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:18,代码来源:StoreBatchTest.php


示例2: newFile

 /**
  * Per docs in FileRepo, this needs to return false if we don't support versioned
  * files. Well, we don't.
  */
 function newFile($title, $time = false)
 {
     if ($time) {
         return false;
     }
     return parent::newFile($title, $time);
 }
开发者ID:josephdye,项目名称:wikireader,代码行数:11,代码来源:ForeignAPIRepo.php


示例3: MWException

 /**
  * Create an UnregisteredLocalFile based on a path or a (title,repo) pair.
  * A FileRepo object is not required here, unlike most other File classes.
  *
  * @throws MWException
  * @param Title|bool $title
  * @param FileRepo|bool $repo
  * @param string|bool $path
  * @param string|bool $mime
  */
 function __construct($title = false, $repo = false, $path = false, $mime = false)
 {
     if (!($title && $repo) && !$path) {
         throw new MWException(__METHOD__ . ': not enough parameters, must specify title and repo, or a full path');
     }
     if ($title instanceof Title) {
         $this->title = File::normalizeTitle($title, 'exception');
         $this->name = $repo->getNameFromTitle($title);
     } else {
         $this->name = basename($path);
         $this->title = File::normalizeTitle($this->name, 'exception');
     }
     $this->repo = $repo;
     if ($path) {
         $this->path = $path;
     } else {
         $this->assertRepoDefined();
         $this->path = $repo->getRootDirectory() . '/' . $repo->getHashPath($this->name) . $this->name;
     }
     if ($mime) {
         $this->mime = $mime;
     }
     $this->dims = array();
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:34,代码来源:UnregisteredLocalFile.php


示例4: getFileProps

 function getFileProps($fileName)
 {
     if (FileRepo::isVirtualUrl($fileName)) {
         list($repoName, , ) = $this->splitVirtualUrl($fileName);
         if ($repoName === '') {
             $repoName = 'local';
         }
         $repo = $this->getRepo($repoName);
         return $repo->getFileProps($fileName);
     } else {
         return File::getPropsFromPath($fileName);
     }
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:13,代码来源:RepoGroup.php


示例5: getInfo

 /**
  * Return information about the repository.
  *
  * @return array
  * @since 1.22
  */
 function getInfo()
 {
     return FileRepo::getInfo();
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:10,代码来源:ForeignDBRepo.php


示例6: doOperations

 protected function doOperations(FileRepo $tempRepo, array $ops)
 {
     $status = $tempRepo->getBackend()->doQuickOperations($ops);
     if (!$status->isOK()) {
         $this->error(print_r($status->getErrorsArray(), true));
     }
 }
开发者ID:admonkey,项目名称:mediawiki,代码行数:7,代码来源:cleanupUploadStash.php


示例7: getVignetteUrl

 /**
  * @param Masthead $masthead
  * @param int $width
  * @param $timestamp
  * @return \Wikia\Vignette\UrlGenerator
  */
 public static function getVignetteUrl(Masthead $masthead, $width, $timestamp)
 {
     $relativePath = $masthead->mUser->getGlobalAttribute(AVATAR_USER_OPTION_NAME);
     if ($relativePath) {
         if (strpos($relativePath, '/') !== false) {
             // custom avatar
             $url = self::vignetteCustomUrl($width, $relativePath, $timestamp);
         } else {
             // wikia-provided avatars
             $hash = FileRepo::getHashPathForLevel($relativePath, 2);
             $bucket = VignetteRequest::parseBucket($masthead->mDefaultPath);
             $relativePath = $hash . $relativePath;
             $url = self::buildVignetteUrl($width, $bucket, $relativePath, $timestamp, false);
         }
     } else {
         // default avatar
         $legacyDefaultUrl = $masthead->getDefaultAvatars('thumb/')[0];
         $bucket = VignetteRequest::parseBucket($legacyDefaultUrl);
         $relativePath = VignetteRequest::parseRelativePath($legacyDefaultUrl);
         $url = self::buildVignetteUrl($width, $bucket, $relativePath, $timestamp, false);
     }
     return $url;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:29,代码来源:AvatarService.class.php


示例8: getFileProps

 /**
  * @param string $fileName
  * @return array
  */
 function getFileProps($fileName)
 {
     if (FileRepo::isVirtualUrl($fileName)) {
         list($repoName, , ) = $this->splitVirtualUrl($fileName);
         if ($repoName === '') {
             $repoName = 'local';
         }
         $repo = $this->getRepo($repoName);
         return $repo->getFileProps($fileName);
     } else {
         $mwProps = new MWFileProps(MimeMagic::singleton());
         return $mwProps->getPropsFromPath($fileName, true);
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:18,代码来源:RepoGroup.php


示例9: __construct

	function __construct( $info ) {
		// We don't call parent::_construct because it requires $this->directory,
		// which doesn't exist in Swift.
		FileRepo::__construct( $info );

		// Required settings
		$this->url = $info['url'];

		// Optional settings
		$this->hashLevels = isset( $info['hashLevels'] ) ? $info['hashLevels'] : 2;
		$this->deletedHashLevels = isset( $info['deletedHashLevels'] ) ?
			$info['deletedHashLevels'] : $this->hashLevels;

		// This relationship is also hard-coded in rewrite.py, another part of this
		// extension. If you want to change this here, you might have to change it
		// there, too.
		$this->thumbUrl = "{$this->url}/thumb";

		// we don't have directories
		$this->deletedDir = false;

		// Required settings
		$this->swiftuser = $info['user'];
		$this->swiftkey = $info['key'];
		$this->authurl = $info['authurl'];
		$this->container = $info['container'];
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:27,代码来源:SwiftMedia.body.php


示例10: __construct

 /**
  * A LocalFile wrapper around a file that has been temporarily stashed,
  * so we can do things like create thumbnails for it. Arguably
  * UnregisteredLocalFile should be handling its own file repo but that
  * class is a bit retarded currently.
  *
  * @param FileRepo $repo Repository where we should find the path
  * @param string $path Path to file
  * @param string $key Key to store the path and any stashed data under
  * @throws UploadStashBadPathException
  * @throws UploadStashFileNotFoundException
  */
 public function __construct($repo, $path, $key)
 {
     $this->fileKey = $key;
     // resolve mwrepo:// urls
     if ($repo->isVirtualUrl($path)) {
         $path = $repo->resolveVirtualUrl($path);
     } else {
         // check if path appears to be sane, no parent traversals,
         // and is in this repo's temp zone.
         $repoTempPath = $repo->getZonePath('temp');
         if (!$repo->validateFilename($path) || strpos($path, $repoTempPath) !== 0) {
             wfDebug("UploadStash: tried to construct an UploadStashFile " . "from a file that should already exist at '{$path}', but path is not valid\n");
             throw new UploadStashBadPathException('path is not valid');
         }
         // check if path exists! and is a plain file.
         if (!$repo->fileExists($path)) {
             wfDebug("UploadStash: tried to construct an UploadStashFile from " . "a file that should already exist at '{$path}', but path is not found\n");
             throw new UploadStashFileNotFoundException('cannot find path, or not a plain file');
         }
     }
     parent::__construct(false, $repo, $path, false);
     $this->name = basename($this->path);
 }
开发者ID:ngertrudiz,项目名称:mediawiki,代码行数:35,代码来源:UploadStash.php


示例11:

 /**
  * @param bool|FileRepo $repo
  */
 function __construct($repo = false)
 {
     if ($repo) {
         $this->cleanCallback = $repo->getErrorCleanupFunction();
     }
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:9,代码来源:FileRepoStatus.php


示例12: getHashPath

 static function getHashPath($name)
 {
     return FileRepo::getHashPathForLevel($name, 2);
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:4,代码来源:Avatar.body.php


示例13: getDefaultAvatars

 /**
  * @brief Gets an array of sample avatars
  *
  * @desc Method based on Masthead::getDefaultAvatars()
  *
  * @param string $thumb a thumb
  *
  * @return array multidimensional array with default avatars defined on messaging.wikia.com
  *
  * @author Andrzej 'nAndy' Łukaszewski
  */
 private function getDefaultAvatars($thumb = '')
 {
     wfProfileIn(__METHOD__);
     // parse message only once per request
     if (empty($thumb) && is_array($this->defaultAvatars) && count($this->defaultAvatars) > 0) {
         wfProfileOut(__METHOD__);
         return $this->defaultAvatars;
     }
     $this->defaultAvatars = array();
     $images = getMessageForContentAsArray('blog-avatar-defaults');
     if (is_array($images)) {
         foreach ($images as $image) {
             $hash = FileRepo::getHashPathForLevel($image, 2);
             $this->defaultAvatars[] = array('name' => $image, 'url' => $this->defaultAvatarPath . $thumb . $hash . $image);
         }
     }
     wfProfileOut(__METHOD__);
     return $this->defaultAvatars;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:30,代码来源:UserProfilePageController.class.php


示例14: wfFiArticleSave

/**
 * Diese Hook-Funktion aktualisiert die Index-Sektion, sollte es sich um einen FileUpload handeln
 * und ein neuer Inhalt fuer diese Sektion vorbereitet worden sein.
 * In jedem Fall wird die global abgelegte Index-Sektions-Inhalts-Variable wieder geleert.
 *
 * @param $oArticle OBJECT Der Artikel
 * @param $oUser OBJECT Der Benutzer
 * @param $sContent STRING Inhalt des Artikels
 * @param $sSummary STRING Zusammenfassung fuer das Update
 * @param $minor SIEHE WIKIDOKU
 * @param $watch SIEHE WIKIDOKU
 * @param $sectionanchor SIEHE WIKIDOKU
 * @param $flags SIEHE WIKIDOKU
 * @return BOOL TRUE
 */
function wfFiArticleSave(&$oArticle, &$oUser, &$sContent, &$sSummary, $minor, $watch, $sectionanchor, &$flags)
{
    global $wgFiPrefix, $wgFiPostfix, $wgUploadDirectory, $wgHashedUploadDirectory, $wgRequest, $wgFiCreateIndexThisTime;
    // Spezialseite und UploadFormular setzen $wgFiCreateIndexThisTime auf true zur Indexerstellung
    if ($wgFiCreateIndexThisTime === true || !is_null($wgRequest->getVal('wpProcessIndex')) && $wgRequest->getVal('wpProcessIndex') == "true") {
        // Datei holen und Index erstellen
        $sFilepath = $wgUploadDirectory . "/" . FileRepo::getHashPathForLevel($oArticle->mTitle->mDbkeyform, $wgHashedUploadDirectory ? 2 : 0) . $oArticle->mTitle->mDbkeyform;
        $sIndex = wfFiGetIndex($sFilepath);
        if (is_numeric($sIndex)) {
            // kein Index aus Datei erzeugt
            switch ($sIndex) {
                case WC_FI_ERR_MISSING_SYSTEMCOMMAND:
                    $sReason = wfMsg('fileindexer_index_creation_failed_comment_missing_systemcommand');
                    break;
                case WC_FI_ERR_UNKNOWN_FILETYPE:
                    $sReason = wfMsg('fileindexer_index_creation_failed_comment_unknown_filetype');
                    break;
                default:
                    $sReason = wfMsg('fileindexer_index_creation_failed_comment_unknown_reason');
            }
            $sSummary .= (substr($sSummary, strlen($sSummary) - 1, 1) == "\n" ? "" : "\n") . wfMsg('fileindexer_index_creation_failed_comment') . $sReason;
            return true;
        }
        // Index suchen und Text in Fragmente splitten
        $aFragments = wfFiGetIndexFragments($sContent);
        if ($aFragments === false) {
            // kein Index gefunden
            if (substr($sContent, strlen($sContent) - 1, 1) != "\n") {
                $sContent .= "\n";
            }
            $sContent .= $sIndex;
            $sSummary .= (substr($sSummary, strlen($sSummary) - 1, 1) == "\n" ? "" : "\n") . wfMsg('fileindexer_index_creation_complete_comment');
            return true;
        } else {
            // Index gefunden
            $sContent = $aFragments['pre'] . $sIndex . $aFragments['post'];
            $sSummary .= (substr($sSummary, strlen($sSummary) - 1, 1) == "\n" ? "" : "\n") . wfMsg('fileindexer_index_update_complete_comment');
            return true;
        }
    }
    return true;
}
开发者ID:Ratin,项目名称:Taken,代码行数:57,代码来源:FileIndexer.php


示例15: view

 public function view()
 {
     global $wgShowEXIF;
     $out = $this->getContext()->getOutput();
     $request = $this->getContext()->getRequest();
     $diff = $request->getVal('diff');
     $diffOnly = $request->getBool('diffonly', $this->getContext()->getUser()->getOption('diffonly'));
     if ($this->getTitle()->getNamespace() != NS_FILE || $diff !== null && $diffOnly) {
         parent::view();
         return;
     }
     $this->loadFile();
     if ($this->getTitle()->getNamespace() == NS_FILE && $this->mPage->getFile()->getRedirected()) {
         if ($this->getTitle()->getDBkey() == $this->mPage->getFile()->getName() || $diff !== null) {
             // mTitle is the same as the redirect target so ask Article
             // to perform the redirect for us.
             $request->setVal('diffonly', 'true');
             parent::view();
             return;
         } else {
             // mTitle is not the same as the redirect target so it is
             // probably the redirect page itself. Fake the redirect symbol
             $out->setPageTitle($this->getTitle()->getPrefixedText());
             $out->addHTML($this->viewRedirect(Title::makeTitle(NS_FILE, $this->mPage->getFile()->getName()), true, true));
             $this->mPage->doViewUpdates($this->getContext()->getUser(), $this->getOldID());
             return;
         }
     }
     if ($wgShowEXIF && $this->displayImg->exists()) {
         // @todo FIXME: Bad interface, see note on MediaHandler::formatMetadata().
         $formattedMetadata = $this->displayImg->formatMetadata();
         $showmeta = $formattedMetadata !== false;
     } else {
         $showmeta = false;
     }
     if (!$diff && $this->displayImg->exists()) {
         $out->addHTML($this->showTOC($showmeta));
     }
     if (!$diff) {
         $this->openShowImage();
     }
     # No need to display noarticletext, we use our own message, output in openShowImage()
     if ($this->mPage->getID()) {
         # NS_FILE is in the user language, but this section (the actual wikitext)
         # should be in page content language
         $pageLang = $this->getTitle()->getPageViewLanguage();
         $out->addHTML(Xml::openElement('div', array('id' => 'mw-imagepage-content', 'lang' => $pageLang->getHtmlCode(), 'dir' => $pageLang->getDir(), 'class' => 'mw-content-' . $pageLang->getDir())));
         parent::view();
         $out->addHTML(Xml::closeElement('div'));
     } else {
         # Just need to set the right headers
         $out->setArticleFlag(true);
         $out->setPageTitle($this->getTitle()->getPrefixedText());
         $this->mPage->doViewUpdates($this->getContext()->getUser(), $this->getOldID());
     }
     # Show shared description, if needed
     if ($this->mExtraDescription) {
         $fol = wfMessage('shareddescriptionfollows');
         if (!$fol->isDisabled()) {
             $out->addWikiText($fol->plain());
         }
         $out->addHTML('<div id="shared-image-desc">' . $this->mExtraDescription . "</div>\n");
     }
     $this->closeShowImage();
     $this->imageHistory();
     // TODO: Cleanup the following
     $out->addHTML(Xml::element('h2', array('id' => 'filelinks'), wfMessage('imagelinks')->text()) . "\n");
     $this->imageDupes();
     # @todo FIXME: For some freaky reason, we can't redirect to foreign images.
     # Yet we return metadata about the target. Definitely an issue in the FileRepo
     $this->imageLinks();
     # Allow extensions to add something after the image links
     $html = '';
     wfRunHooks('ImagePageAfterImageLinks', array($this, &$html));
     if ($html) {
         $out->addHTML($html);
     }
     if ($showmeta) {
         $out->addHTML(Xml::element('h2', array('id' => 'metadata'), wfMessage('metadata')->text()) . "\n");
         $out->addWikiText($this->makeMetadataTable($formattedMetadata));
         $out->addModules(array('mediawiki.action.view.metadata'));
     }
     // Add remote Filepage.css
     if (!$this->repo->isLocal()) {
         $css = $this->repo->getDescriptionStylesheetUrl();
         if ($css) {
             $out->addStyle($css);
         }
     }
     // always show the local local Filepage.css, bug 29277
     $out->addModuleStyles('filepage');
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:92,代码来源:ImagePage.php


示例16: getVidDirPath

 public static function getVidDirPath($filename)
 {
     return FileRepo::getHashPathForLevel($filename, self::NUM_DIR_LEVELS);
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:4,代码来源:WHVid.body.php


示例17: getZoneUrl

 /**
  * @see FileRepo::getZoneUrl()
  */
 function getZoneUrl($zone)
 {
     switch ($zone) {
         case 'public':
             return $this->url;
         case 'thumb':
             return $this->thumbUrl;
         default:
             return parent::getZoneUrl($zone);
     }
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:14,代码来源:ForeignAPIRepo.php


示例18: getPurgeUrl

 /**
  * getPurgeUrl -- the basic URL (without image server rewriting, cachebuster,
  * etc.) of the avatar.  This can be sent to squid to purge it.
  *
  * @access public
  *
  * @param $thumb String  -- if defined will be added as part of base path
  *      default empty string ""
  *
  * @return String
  */
 public function getPurgeUrl($thumb = "")
 {
     global $wgBlogAvatarPath;
     $url = $this->mUser->getOption(AVATAR_USER_OPTION_NAME);
     if ($url) {
         /**
          * if default avatar we glue with messaging.wikia.com
          * if uploaded avatar we glue with common avatar path
          */
         if (strpos($url, '/') !== false) {
             /**
              * uploaded file, we are adding common/avatars path
              */
             $url = $wgBlogAvatarPath . rtrim($thumb, '/') . $url;
         } else {
             /**
              * default avatar, path from messaging.wikia.com
              */
             $hash = FileRepo::getHashPathForLevel($url, 2);
             $url = $this->mDefaultPath . trim($thumb, '/') . '/' . $hash . $url;
         }
     } else {
         $defaults = $this->getDefaultAvatars(trim($thumb, "/") . "/");
         $url = array_shift($defaults);
     }
     return $url;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:38,代码来源:Masthead.class.php


示例19: dirname

 function __construct($info)
 {
     parent::__construct($info);
     $this->mApiBase = $info['apibase'];
     // http://commons.wikimedia.org/w/api.php
     if (!$this->scriptDirUrl) {
         // hack for description fetches
         $this->scriptDirUrl = dirname($this->mApiBase);
     }
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:10,代码来源:ForeignAPIRepo.php


示例20: isset

 /**
  * @param $info array
  * @throws MWException
  */
 function __construct(array $info)
 {
     if (!isset($info['backend'])) {
         // B/C settings...
         $directory = $info['directory'];
         $deletedDir = isset($info['deletedDir']) ? $info['deletedDir'] : false;
         $thumbDir = isset($info['thumbDir']) ? $info['thumbDir'] : "{$directory}/thumb";
         $fileMode = isset($info['fileMode']) ? $info['fileMode'] : 0644;
         $repoName = $info['name'];
         // Get the FS backend configuration
         $backend = new FSFileBackend(array('name' => $info['name'] . '-backend', 'lockManager' => 'fsLockManager', 'containerPaths' => array("{$repoName}-public" => "{$directory}", "{$repoName}-temp" => "{$directory}/temp", "{$repoName}-thumb" => $thumbDir, "{$repoName}-deleted" => $deletedDir), 'fileMode' => $fileMode));
         // Update repo config to use this backend
         $info['backend'] = $backend;
     }
     parent::__construct($info);
     if (!$this->backend instanceof FSFileBackend) {
         throw new MWException("FSRepo only supports FSFileBackend.");
     }
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:23,代码来源:FSRepo.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP FileSet类代码示例发布时间:2022-05-23
下一篇:
PHP FileReader类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap