本文整理汇总了PHP中FileRepo::getZonePath方法的典型用法代码示例。如果您正苦于以下问题:PHP FileRepo::getZonePath方法的具体用法?PHP FileRepo::getZonePath怎么用?PHP FileRepo::getZonePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileRepo
的用法示例。
在下文中一共展示了FileRepo::getZonePath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getZonePath
/**
* Get the local directory corresponding to one of the basic zones
* @param string $zone
* @return bool|null|string
*/
function getZonePath($zone)
{
$supported = ['public', 'thumb'];
if (in_array($zone, $supported)) {
return parent::getZonePath($zone);
}
return false;
}
示例2: getTranscodedPath
/**
* Get the path of the transcoded directory, or a particular file if $suffix is specified
*
* @param bool|string $suffix if not false, the name of a media file
*
* @return string
*/
function getTranscodedPath($suffix = false)
{
$this->assertRepoDefined();
return $this->repo->getZonePath('transcoded') . '/' . $this->getThumbRel($suffix);
}
示例3: __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);
}