本文整理汇总了PHP中LocalFile::getArchiveVirtualUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP LocalFile::getArchiveVirtualUrl方法的具体用法?PHP LocalFile::getArchiveVirtualUrl怎么用?PHP LocalFile::getArchiveVirtualUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalFile
的用法示例。
在下文中一共展示了LocalFile::getArchiveVirtualUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$this->params = $this->extractRequestParams();
// Extract the file and archiveName from the request parameters
$this->validateParameters();
// Check whether we're allowed to revert this file
$this->checkPermissions($this->getUser());
$sourceUrl = $this->file->getArchiveVirtualUrl($this->archiveName);
$status = $this->file->upload($sourceUrl, $this->params['comment'], $this->params['comment'], 0, false, false, $this->getUser());
if ($status->isGood()) {
$result = array('result' => 'Success');
} else {
$result = array('result' => 'Failure', 'errors' => $this->getResult()->convertStatusToArray($status));
}
$this->getResult()->addValue(null, $this->getModuleName(), $result);
}
示例2: getHashes
/**
* @return array
*/
protected function getHashes()
{
$hashes = array();
list($oldRels, $deleteCurrent) = $this->getOldRels();
if ($deleteCurrent) {
$hashes['.'] = $this->file->getSha1();
}
if (count($oldRels)) {
$dbw = $this->file->repo->getMasterDB();
$res = $dbw->select('oldimage', array('oi_archive_name', 'oi_sha1'), array('oi_archive_name' => array_keys($oldRels)), __METHOD__);
foreach ($res as $row) {
if (rtrim($row->oi_sha1, "") === '') {
// Get the hash from the file
$oldUrl = $this->file->getArchiveVirtualUrl($row->oi_archive_name);
$props = $this->file->repo->getFileProps($oldUrl);
if ($props['fileExists']) {
// Upgrade the oldimage row
$dbw->update('oldimage', array('oi_sha1' => $props['sha1']), array('oi_name' => $this->file->getName(), 'oi_archive_name' => $row->oi_archive_name), __METHOD__);
$hashes[$row->oi_archive_name] = $props['sha1'];
} else {
$hashes[$row->oi_archive_name] = false;
}
} else {
$hashes[$row->oi_archive_name] = $row->oi_sha1;
}
}
}
$missing = array_diff_key($this->srcRels, $hashes);
foreach ($missing as $name => $rel) {
$this->status->error('filedelete-old-unregistered', $name);
}
foreach ($hashes as $name => $hash) {
if (!$hash) {
$this->status->error('filedelete-missing', $this->srcRels[$name]);
unset($hashes[$name]);
}
}
return $hashes;
}