Пример #1
0
 /**
  * Show a form confirming whether a tokenless user really wants to see a file
  * @param string $key
  */
 private function showFileConfirmationForm($key)
 {
     $out = $this->getOutput();
     $lang = $this->getLanguage();
     $user = $this->getUser();
     $file = new ArchivedFile($this->mTargetObj, '', $this->mFilename);
     $out->addWikiMsg('undelete-show-file-confirm', $this->mTargetObj->getText(), $lang->userDate($file->getTimestamp(), $user), $lang->userTime($file->getTimestamp(), $user));
     $out->addHTML(Xml::openElement('form', array('method' => 'POST', 'action' => $this->getPageTitle()->getLocalURL(array('target' => $this->mTarget, 'file' => $key, 'token' => $user->getEditToken($key))))) . Xml::submitButton($this->msg('undelete-show-file-submit')->text()) . '</form>');
 }
Пример #2
0
 /**
  * @param ArchivedFile $file
  * @returns string
  */
 private function archivedfileLine($file)
 {
     global $wgLang;
     $target = $this->page->getPrefixedText();
     $date = $wgLang->timeanddate($file->getTimestamp(), true);
     $undelete = SpecialPage::getTitleFor('Undelete');
     $pageLink = $this->skin->makeKnownLinkObj($undelete, $date, "target={$target}&file={$file->getKey()}");
     $del = '';
     if ($file->isDeleted(File::DELETED_FILE)) {
         $del = ' <tt>' . wfMsgHtml('deletedrev') . '</tt>';
     }
     $data = wfMsg('widthheight', $wgLang->formatNum($file->getWidth()), $wgLang->formatNum($file->getHeight())) . ' (' . wfMsgExt('nbytes', 'parsemag', $wgLang->formatNum($file->getSize())) . ')';
     $data = htmlspecialchars($data);
     return "<li> {$pageLink} " . $this->fileUserTools($file) . " {$data} " . $this->fileComment($file) . "{$del}</li>";
 }
Пример #3
0
 protected function scrubVersion(ArchivedFile $archivedFile)
 {
     $key = $archivedFile->getStorageKey();
     $name = $archivedFile->getName();
     $ts = $archivedFile->getTimestamp();
     $repo = RepoGroup::singleton()->getLocalRepo();
     $path = $repo->getZonePath('deleted') . '/' . $repo->getDeletedHashPath($key) . $key;
     if ($this->hasOption('delete')) {
         $status = $repo->getBackend()->delete(['src' => $path]);
         if ($status->isOK()) {
             $this->output("Deleted version '{$key}' ({$ts}) of file '{$name}'\n");
         } else {
             $this->output("Failed to delete version '{$key}' ({$ts}) of file '{$name}'\n");
             $this->output(print_r($status->getErrorsArray(), true));
         }
     } else {
         $this->output("Would delete version '{$key}' ({$ts}) of file '{$name}'\n");
     }
 }
Пример #4
0
 /**
  * Show a form confirming whether a tokenless user really wants to see a file
  */
 private function showFileConfirmationForm($key)
 {
     $file = new ArchivedFile($this->mTargetObj, '', $this->mFilename);
     $this->getOutput()->addWikiMsg('undelete-show-file-confirm', $this->mTargetObj->getText(), $this->getLang()->date($file->getTimestamp()), $this->getLang()->time($file->getTimestamp()));
     $this->getOutput()->addHTML(Xml::openElement('form', array('method' => 'POST', 'action' => $this->getTitle()->getLocalURL('target=' . urlencode($this->mTarget) . '&file=' . urlencode($key) . '&token=' . urlencode($this->getUser()->editToken($key))))) . Xml::submitButton(wfMsg('undelete-show-file-submit')) . '</form>');
 }
Пример #5
0
 /**
  * Show a form confirming whether a tokenless user really wants to see a file
  */
 private function showFileConfirmationForm($key)
 {
     global $wgOut, $wgUser, $wgLang;
     $file = new ArchivedFile($this->mTargetObj, '', $this->mFile);
     $wgOut->addWikiMsg('undelete-show-file-confirm', $this->mTargetObj->getText(), $wgLang->date($file->getTimestamp()), $wgLang->time($file->getTimestamp()));
     $wgOut->addHTML(Xml::openElement('form', array('method' => 'POST', 'action' => SpecialPage::getTitleFor('Undelete')->getLocalUrl('target=' . urlencode($this->mTarget) . '&file=' . urlencode($key) . '&token=' . urlencode($wgUser->editToken($key))))) . Xml::submitButton(wfMsg('undelete-show-file-submit')) . '</form>');
 }