本文整理汇总了PHP中ArchivedFile::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP ArchivedFile::exists方法的具体用法?PHP ArchivedFile::exists怎么用?PHP ArchivedFile::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArchivedFile
的用法示例。
在下文中一共展示了ArchivedFile::exists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute($par)
{
$this->useTransactionalTimeLimit();
$user = $this->getUser();
$this->setHeaders();
$this->outputHeader();
$this->loadRequest($par);
$this->checkPermissions();
// Needs to be after mTargetObj is set
$out = $this->getOutput();
if (is_null($this->mTargetObj)) {
$out->addWikiMsg('undelete-header');
# Not all users can just browse every deleted page from the list
if ($user->isAllowed('browsearchive')) {
$this->showSearchForm();
}
return;
}
$this->addHelpLink('Help:Undelete');
if ($this->mAllowed) {
$out->setPageTitle($this->msg('undeletepage'));
} else {
$out->setPageTitle($this->msg('viewdeletedpage'));
}
$this->getSkin()->setRelevantTitle($this->mTargetObj);
if ($this->mTimestamp !== '') {
$this->showRevision($this->mTimestamp);
} elseif ($this->mFilename !== null && $this->mTargetObj->inNamespace(NS_FILE)) {
$file = new ArchivedFile($this->mTargetObj, '', $this->mFilename);
// Check if user is allowed to see this file
if (!$file->exists()) {
$out->addWikiMsg('filedelete-nofile', $this->mFilename);
} elseif (!$file->userCan(File::DELETED_FILE, $user)) {
if ($file->isDeleted(File::DELETED_RESTRICTED)) {
throw new PermissionsError('suppressrevision');
} else {
throw new PermissionsError('deletedtext');
}
} elseif (!$user->matchEditToken($this->mToken, $this->mFilename)) {
$this->showFileConfirmationForm($this->mFilename);
} else {
$this->showFile($this->mFilename);
}
} elseif ($this->mRestore && $this->mAction == 'submit') {
$this->undelete();
} else {
$this->showHistory();
}
}
示例2: execute
function execute($par)
{
$this->setHeaders();
if (!$this->userCanExecute($this->getUser())) {
$this->displayRestrictionError();
return;
}
$this->outputHeader();
$this->loadRequest();
$out = $this->getOutput();
if ($this->mAllowed) {
$out->setPageTitle(wfMsg('undeletepage'));
} else {
$out->setPageTitle(wfMsg('viewdeletedpage'));
}
if ($par != '') {
$this->mTarget = $par;
}
if ($this->mTarget !== '') {
$this->mTargetObj = Title::newFromURL($this->mTarget);
$this->getSkin()->setRelevantTitle($this->mTargetObj);
} else {
$this->mTargetObj = null;
}
if (is_null($this->mTargetObj)) {
# Not all users can just browse every deleted page from the list
if ($this->getUser()->isAllowed('browsearchive')) {
$this->showSearchForm();
# List undeletable articles
if ($this->mSearchPrefix) {
$result = PageArchive::listPagesByPrefix($this->mSearchPrefix);
$this->showList($result);
}
} else {
$out->addWikiMsg('undelete-header');
}
return;
}
if ($this->mTimestamp !== '') {
return $this->showRevision($this->mTimestamp);
}
if ($this->mFilename !== null) {
$file = new ArchivedFile($this->mTargetObj, '', $this->mFilename);
// Check if user is allowed to see this file
if (!$file->exists()) {
$out->addWikiMsg('filedelete-nofile', $this->mFilename);
return;
} elseif (!$file->userCan(File::DELETED_FILE)) {
if ($file->isDeleted(File::DELETED_RESTRICTED)) {
$out->permissionRequired('suppressrevision');
} else {
$out->permissionRequired('deletedtext');
}
return false;
} elseif (!$this->getUser()->matchEditToken($this->mToken, $this->mFilename)) {
$this->showFileConfirmationForm($this->mFilename);
return false;
} else {
return $this->showFile($this->mFilename);
}
}
if ($this->mRestore && $this->mAction == 'submit') {
global $wgUploadMaintenance;
if ($wgUploadMaintenance && $this->mTargetObj && $this->mTargetObj->getNamespace() == NS_FILE) {
$out->wrapWikiMsg("<div class='error'>\n\$1\n</div>\n", array('filedelete-maintenance'));
return;
}
return $this->undelete();
}
if ($this->mInvert && $this->mAction == 'submit') {
return $this->showHistory();
}
return $this->showHistory();
}