本文整理汇总了PHP中FileRepo::resolveVirtualUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP FileRepo::resolveVirtualUrl方法的具体用法?PHP FileRepo::resolveVirtualUrl怎么用?PHP FileRepo::resolveVirtualUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileRepo
的用法示例。
在下文中一共展示了FileRepo::resolveVirtualUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
protected function tearDown()
{
$this->repo->cleanupBatch($this->createdFiles);
// delete files
foreach ($this->createdFiles as $tmp) {
// delete dirs
$tmp = $this->repo->resolveVirtualUrl($tmp);
while ($tmp = FileBackend::parentStoragePath($tmp)) {
$this->repo->getBackend()->clean(array('dir' => $tmp));
}
}
parent::tearDown();
}
示例2: __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);
}