本文整理汇总了PHP中FileRepo::getHashPathForLevel方法的典型用法代码示例。如果您正苦于以下问题:PHP FileRepo::getHashPathForLevel方法的具体用法?PHP FileRepo::getHashPathForLevel怎么用?PHP FileRepo::getHashPathForLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileRepo
的用法示例。
在下文中一共展示了FileRepo::getHashPathForLevel方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHashPath
static function getHashPath($name)
{
return FileRepo::getHashPathForLevel($name, 2);
}
示例2: getVidDirPath
public static function getVidDirPath($filename)
{
return FileRepo::getHashPathForLevel($filename, self::NUM_DIR_LEVELS);
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: getHashPath
/**
* Get a relative path including trailing slash, e.g. f/fa/
* If the repo is not hashed, returns an empty string
*/
function getHashPath($name)
{
return FileRepo::getHashPathForLevel($name, $this->hashLevels);
}