Ejemplo n.º 1
0
 function undelete()
 {
     if ($this->getConfig()->get('UploadMaintenance') && $this->mTargetObj->getNamespace() == NS_FILE) {
         throw new ErrorPageError('undelete-error', 'filedelete-maintenance');
     }
     $this->checkReadOnly();
     $out = $this->getOutput();
     $archive = new PageArchive($this->mTargetObj, $this->getConfig());
     Hooks::run('UndeleteForm::undelete', array(&$archive, $this->mTargetObj));
     $ok = $archive->undelete($this->mTargetTimestamp, $this->mComment, $this->mFileVersions, $this->mUnsuppress, $this->getUser());
     if (is_array($ok)) {
         if ($ok[1]) {
             // Undeleted file count
             Hooks::run('FileUndeleteComplete', array($this->mTargetObj, $this->mFileVersions, $this->getUser(), $this->mComment));
         }
         $link = Linker::linkKnown($this->mTargetObj);
         $out->addHTML($this->msg('undeletedpage')->rawParams($link)->parse());
     } else {
         $out->setPageTitle($this->msg('undelete-error'));
     }
     // Show revision undeletion warnings and errors
     $status = $archive->getRevisionStatus();
     if ($status && !$status->isGood()) {
         $out->addWikiText('<div class="error">' . $status->getWikiText('cannotundelete', 'cannotundelete') . '</div>');
     }
     // Show file undeletion warnings and errors
     $status = $archive->getFileStatus();
     if ($status && !$status->isGood()) {
         $out->addWikiText('<div class="error">' . $status->getWikiText('undelete-error-short', 'undelete-error-long') . '</div>');
     }
 }
Ejemplo n.º 2
0
 function undelete()
 {
     global $wgUploadMaintenance;
     if ($wgUploadMaintenance && $this->mTargetObj->getNamespace() == NS_FILE) {
         throw new ErrorPageError('undelete-error', 'filedelete-maintenance');
     }
     if (wfReadOnly()) {
         throw new ReadOnlyError();
     }
     # <Wikia> - use Phalanx to check recovered page title
     if (!wfRunHooks('CreatePageTitleCheck', array($this->mTargetObj, false))) {
         throw new ErrorPageError('undelete-error', 'spamprotectiontext');
     }
     # </Wikia>
     $out = $this->getOutput();
     $archive = new PageArchive($this->mTargetObj);
     wfRunHooks('UndeleteForm::undelete', array(&$archive, $this->mTargetObj));
     $ok = $archive->undelete($this->mTargetTimestamp, $this->mComment, $this->mFileVersions, $this->mUnsuppress);
     if (is_array($ok)) {
         if ($ok[1]) {
             // Undeleted file count
             wfRunHooks('FileUndeleteComplete', array($this->mTargetObj, $this->mFileVersions, $this->getUser(), $this->mComment));
         }
         $link = Linker::linkKnown($this->mTargetObj);
         $out->addHTML($this->msg('undeletedpage')->rawParams($link)->parse());
     } else {
         $out->setPageTitle($this->msg('undelete-error'));
         $out->addWikiMsg('cannotundelete');
         $out->addWikiMsg('undeleterevdel');
     }
     // Show file deletion warnings and errors
     $status = $archive->getFileStatus();
     if ($status && !$status->isGood()) {
         $out->addWikiText($status->getWikiText('undelete-error-short', 'undelete-error-long'));
     }
 }
Ejemplo n.º 3
0
 function undelete()
 {
     if (wfReadOnly()) {
         throw new ReadOnlyError();
     }
     if (!is_null($this->mTargetObj)) {
         $archive = new PageArchive($this->mTargetObj);
         wfRunHooks('UndeleteForm::undelete', array(&$archive, $this->mTargetObj));
         $ok = $archive->undelete($this->mTargetTimestamp, $this->mComment, $this->mFileVersions, $this->mUnsuppress);
         if (is_array($ok)) {
             if ($ok[1]) {
                 // Undeleted file count
                 wfRunHooks('FileUndeleteComplete', array($this->mTargetObj, $this->mFileVersions, $this->getUser(), $this->mComment));
             }
             $link = Linker::linkKnown($this->mTargetObj);
             $this->getOutput()->addHTML(wfMessage('undeletedpage')->rawParams($link)->parse());
         } else {
             $this->getOutput()->showFatalError(wfMsg('cannotundelete'));
             $this->getOutput()->addWikiMsg('undeleterevdel');
         }
         // Show file deletion warnings and errors
         $status = $archive->getFileStatus();
         if ($status && !$status->isGood()) {
             $this->getOutput()->addWikiText($status->getWikiText('undelete-error-short', 'undelete-error-long'));
         }
     } else {
         $this->getOutput()->showFatalError(wfMsg('cannotundelete'));
     }
     return false;
 }
 function undelete()
 {
     global $wgOut, $wgUser;
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     if (!is_null($this->mTargetObj)) {
         $archive = new PageArchive($this->mTargetObj);
         $ok = $archive->undelete($this->mTargetTimestamp, $this->mComment, $this->mFileVersions);
         if (is_array($ok)) {
             $skin = $wgUser->getSkin();
             $link = $skin->makeKnownLinkObj($this->mTargetObj);
             $wgOut->addHtml(wfMsgWikiHtml('undeletedpage', $link));
         } else {
             $wgOut->showFatalError(wfMsg("cannotundelete"));
         }
         // Show file deletion warnings and errors
         $status = $archive->getFileStatus();
         if ($status && !$status->isGood()) {
             $wgOut->addWikiText($status->getWikiText('undelete-error-short', 'undelete-error-long'));
         }
     } else {
         $wgOut->showFatalError(wfMsg("cannotundelete"));
     }
     return false;
 }
Ejemplo n.º 5
0
 function undelete()
 {
     global $wgOut, $wgUser;
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     if (!is_null($this->mTargetObj)) {
         $archive = new PageArchive($this->mTargetObj);
         $ok = $archive->undelete($this->mTargetTimestamp, $this->mComment, $this->mFileVersions, $this->mUnsuppress);
         if (is_array($ok)) {
             if ($ok[1]) {
                 // Undeleted file count
                 wfRunHooks('FileUndeleteComplete', array($this->mTargetObj, $this->mFileVersions, $wgUser, $this->mComment));
             }
             $skin = $wgUser->getSkin();
             $link = $skin->linkKnown($this->mTargetObj);
             $wgOut->addHTML(wfMsgWikiHtml('undeletedpage', $link));
         } else {
             $wgOut->showFatalError(wfMsg("cannotundelete"));
             $wgOut->addHTML('<p>' . wfMsgHtml("undeleterevdel") . '</p>');
         }
         // Show file deletion warnings and errors
         $status = $archive->getFileStatus();
         if ($status && !$status->isGood()) {
             $wgOut->addWikiText($status->getWikiText('undelete-error-short', 'undelete-error-long'));
         }
     } else {
         $wgOut->showFatalError(wfMsg("cannotundelete"));
     }
     return false;
 }