From: Alexandre Emsenhuber Date: Sat, 11 Jun 2011 08:30:19 +0000 (+0000) Subject: * Made Special:RevisionDelete use the local variables stored in the RequestContext... X-Git-Tag: 1.31.0-rc.0~29575 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=7245d8dca6c18e6d09b0dd3f3a0ae26a71dd9e31;p=lhc%2Fweb%2Fwiklou.git * Made Special:RevisionDelete use the local variables stored in the RequestContext object instead of global ones and removed the $skin member * Also updated classes in includes/revisiondelete that were using the $skin member of Special:RevisionDelete * Handle action=revisiondelete (or rather action=historysubmit&revisiondelete=1) with an Action object that sets the RequestContext object of the SpecialPage object, and in this case get the target Title object through the context instead of $wgTitle --- diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index b51f108c84..34c34e071e 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -250,6 +250,7 @@ $wgAutoloadLocalClasses = array( # includes/actions 'CreditsAction' => 'includes/actions/CreditsAction.php', 'PurgeAction' => 'includes/actions/PurgeAction.php', + 'RevisiondeleteAction' => 'includes/actions/RevisiondeleteAction.php', 'UnwatchAction' => 'includes/actions/WatchAction.php', 'WatchAction' => 'includes/actions/WatchAction.php', diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index f3b5a1f96a..c23d713c6b 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -5030,6 +5030,7 @@ $wgMaxRedirectLinksRetrieved = 500; */ $wgActions = array( 'credits' => true, + 'revisiondelete' => true, 'purge' => true, 'unwatch' => true, 'watch' => true, diff --git a/includes/Wiki.php b/includes/Wiki.php index 1f9c9393a7..38a27ae660 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -465,11 +465,6 @@ class MediaWiki { $history = new HistoryPage( $article ); $history->history(); break; - case 'revisiondelete': - // For show/hide submission from history page - $special = SpecialPageFactory::getPage( 'Revisiondelete' ); - $special->execute( '' ); - break; default: if ( wfRunHooks( 'UnknownAction', array( $act, $article ) ) ) { $this->context->output->showErrorPage( 'nosuchaction', 'nosuchactiontext' ); diff --git a/includes/actions/RevisiondeleteAction.php b/includes/actions/RevisiondeleteAction.php new file mode 100644 index 0000000000..2ac03d1824 --- /dev/null +++ b/includes/actions/RevisiondeleteAction.php @@ -0,0 +1,53 @@ +setContext( $this->getContext() ); + $special->execute( '' ); + } +} diff --git a/includes/revisiondelete/RevisionDelete.php b/includes/revisiondelete/RevisionDelete.php index 9f79837ec6..c187b216fe 100644 --- a/includes/revisiondelete/RevisionDelete.php +++ b/includes/revisiondelete/RevisionDelete.php @@ -170,12 +170,11 @@ class RevDel_RevisionItem extends RevDel_Item { * Overridden by RevDel_ArchiveItem. */ protected function getRevisionLink() { - global $wgLang; - $date = $wgLang->timeanddate( $this->revision->getTimestamp(), true ); + $date = $this->getLang()->timeanddate( $this->revision->getTimestamp(), true ); if ( $this->isDeleted() && !$this->canViewContent() ) { return $date; } - return $this->special->skin->link( + return Linker::link( $this->list->title, $date, array(), @@ -195,7 +194,7 @@ class RevDel_RevisionItem extends RevDel_Item { return wfMsgHtml('diff'); } else { return - $this->special->skin->link( + Linker::link( $this->list->title, wfMsgHtml('diff'), array(), @@ -215,8 +214,8 @@ class RevDel_RevisionItem extends RevDel_Item { public function getHTML() { $difflink = $this->getDiffLink(); $revlink = $this->getRevisionLink(); - $userlink = $this->special->skin->revUserLink( $this->revision ); - $comment = $this->special->skin->revComment( $this->revision ); + $userlink = Linker::revUserLink( $this->revision ); + $comment = Linker::revComment( $this->revision ); if ( $this->isDeleted() ) { $revlink = "$revlink"; } @@ -298,13 +297,12 @@ class RevDel_ArchiveItem extends RevDel_RevisionItem { } protected function getRevisionLink() { - global $wgLang; $undelete = SpecialPage::getTitleFor( 'Undelete' ); - $date = $wgLang->timeanddate( $this->revision->getTimestamp(), true ); + $date = $this->getLang()->timeanddate( $this->revision->getTimestamp(), true ); if ( $this->isDeleted() && !$this->canViewContent() ) { return $date; } - return $this->special->skin->link( $undelete, $date, array(), + return Linker::link( $undelete, $date, array(), array( 'target' => $this->list->title->getPrefixedText(), 'timestamp' => $this->revision->getTimestamp() @@ -316,7 +314,7 @@ class RevDel_ArchiveItem extends RevDel_RevisionItem { return wfMsgHtml( 'diff' ); } $undelete = SpecialPage::getTitleFor( 'Undelete' ); - return $this->special->skin->link( $undelete, wfMsgHtml('diff'), array(), + return Linker::link( $undelete, wfMsgHtml('diff'), array(), array( 'target' => $this->list->title->getPrefixedText(), 'diff' => 'prev', @@ -508,20 +506,19 @@ class RevDel_FileItem extends RevDel_Item { * Overridden by RevDel_ArchivedFileItem. */ protected function getLink() { - global $wgLang, $wgUser; - $date = $wgLang->timeanddate( $this->file->getTimestamp(), true ); + $date = $this->getLang()->timeanddate( $this->file->getTimestamp(), true ); if ( $this->isDeleted() ) { # Hidden files... if ( !$this->canViewContent() ) { $link = $date; } else { - $link = $this->special->skin->link( + $link = Linker::link( $this->special->getTitle(), $date, array(), array( 'target' => $this->list->title->getPrefixedText(), 'file' => $this->file->getArchiveName(), - 'token' => $wgUser->editToken( $this->file->getArchiveName() ) + 'token' => $this->getUser()->editToken( $this->file->getArchiveName() ) ) ); } @@ -537,8 +534,8 @@ class RevDel_FileItem extends RevDel_Item { */ protected function getUserTools() { if( $this->file->userCan( Revision::DELETED_USER ) ) { - $link = $this->special->skin->userLink( $this->file->user, $this->file->user_text ) . - $this->special->skin->userToolLinks( $this->file->user, $this->file->user_text ); + $link = Linker::userLink( $this->file->user, $this->file->user_text ) . + Linker::userToolLinks( $this->file->user, $this->file->user_text ); } else { $link = wfMsgHtml( 'rev-deleted-user' ); } @@ -556,7 +553,7 @@ class RevDel_FileItem extends RevDel_Item { */ protected function getComment() { if( $this->file->userCan( File::DELETED_COMMENT ) ) { - $block = $this->special->skin->commentBlock( $this->file->description ); + $block = Linker::commentBlock( $this->file->description ); } else { $block = ' ' . wfMsgHtml( 'rev-deleted-comment' ); } @@ -567,15 +564,14 @@ class RevDel_FileItem extends RevDel_Item { } public function getHTML() { - global $wgLang; $data = wfMsg( 'widthheight', - $wgLang->formatNum( $this->file->getWidth() ), - $wgLang->formatNum( $this->file->getHeight() ) + $this->getLang()->formatNum( $this->file->getWidth() ), + $this->getLang()->formatNum( $this->file->getHeight() ) ) . ' (' . - wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $this->file->getSize() ) ) . + wfMsgExt( 'nbytes', 'parsemag', $this->getLang()->formatNum( $this->file->getSize() ) ) . ')'; return '
  • ' . $this->getLink() . ' ' . $this->getUserTools() . ' ' . @@ -641,19 +637,18 @@ class RevDel_ArchivedFileItem extends RevDel_FileItem { } protected function getLink() { - global $wgLang, $wgUser; - $date = $wgLang->timeanddate( $this->file->getTimestamp(), true ); + $date = $this->getLang()->timeanddate( $this->file->getTimestamp(), true ); $undelete = SpecialPage::getTitleFor( 'Undelete' ); $key = $this->file->getKey(); # Hidden files... if( !$this->canViewContent() ) { $link = $date; } else { - $link = $this->special->skin->link( $undelete, $date, array(), + $link = Linker::link( $undelete, $date, array(), array( 'target' => $this->list->title->getPrefixedText(), 'file' => $key, - 'token' => $wgUser->editToken( $key ) + 'token' => $this->getUser()->editToken( $key ) ) ); } @@ -749,14 +744,12 @@ class RevDel_LogItem extends RevDel_Item { } public function getHTML() { - global $wgLang; - - $date = htmlspecialchars( $wgLang->timeanddate( $this->row->log_timestamp ) ); + $date = htmlspecialchars( $this->getLang()->timeanddate( $this->row->log_timestamp ) ); $paramArray = LogPage::extractParams( $this->row->log_params ); $title = Title::makeTitle( $this->row->log_namespace, $this->row->log_title ); // Log link for this page - $loglink = $this->special->skin->link( + $loglink = Linker::link( SpecialPage::getTitleFor( 'Log' ), wfMsgHtml( 'log' ), array(), @@ -767,18 +760,18 @@ class RevDel_LogItem extends RevDel_Item { $action = '' . wfMsgHtml('rev-deleted-event') . ''; } else { $action = LogPage::actionText( $this->row->log_type, $this->row->log_action, $title, - $this->special->skin, $paramArray, true, true ); + $this->special->getSkin(), $paramArray, true, true ); if( $this->row->log_deleted & LogPage::DELETED_ACTION ) $action = '' . $action . ''; } // User links - $userLink = $this->special->skin->userLink( $this->row->log_user, + $userLink = Linker::userLink( $this->row->log_user, User::WhoIs( $this->row->log_user ) ); if( LogEventsList::isDeleted($this->row,LogPage::DELETED_USER) ) { $userLink = '' . $userLink . ''; } // Comment - $comment = $wgLang->getDirMark() . $this->special->skin->commentBlock( $this->row->log_comment ); + $comment = $this->getLang()->getDirMark() . Linker::commentBlock( $this->row->log_comment ); if( LogEventsList::isDeleted($this->row,LogPage::DELETED_COMMENT) ) { $comment = '' . $comment . ''; } diff --git a/includes/revisiondelete/RevisionDeleteAbstracts.php b/includes/revisiondelete/RevisionDeleteAbstracts.php index 4436a87d91..adf63a95e3 100644 --- a/includes/revisiondelete/RevisionDeleteAbstracts.php +++ b/includes/revisiondelete/RevisionDeleteAbstracts.php @@ -330,6 +330,24 @@ abstract class RevDel_List { return Status::newGood(); } + /** + * Get the user doing the action + * + * @return User object + */ + public function getUser() { + return $this->special->getUser(); + } + + /** + * Get the language of the user doing the action + * + * @return Language object + */ + public function getLang() { + return $this->special->getLang(); + } + /** * Create an item object from a DB result row * @param $row stdclass @@ -428,6 +446,24 @@ abstract class RevDel_Item { return false; } + /** + * Get the user doing the action + * + * @return User object + */ + public function getUser() { + return $this->special->getUser(); + } + + /** + * Get the language of the user doing the action + * + * @return Language object + */ + public function getLang() { + return $this->special->getLang(); + } + /** * Returns true if the current user can view the item */ diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php index 5b8b9c865e..1798b64a04 100644 --- a/includes/specials/SpecialRevisiondelete.php +++ b/includes/specials/SpecialRevisiondelete.php @@ -28,9 +28,6 @@ * @ingroup SpecialPage */ class SpecialRevisionDelete extends UnlistedSpecialPage { - /** Skin object */ - var $skin; - /** True if the submit button was clicked, and the form was posted */ var $submitClicked; @@ -114,43 +111,46 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { } public function execute( $par ) { - global $wgOut, $wgUser, $wgRequest; - if( !$wgUser->isAllowed( 'deletedhistory' ) ) { - $wgOut->permissionRequired( 'deletedhistory' ); + $output = $this->getOutput(); + $user = $this->getUser(); + if( !$user->isAllowed( 'deletedhistory' ) ) { + $output->permissionRequired( 'deletedhistory' ); return; } else if( wfReadOnly() ) { - $wgOut->readOnlyPage(); + $output->readOnlyPage(); return; } - $this->mIsAllowed = $wgUser->isAllowed('deleterevision'); // for changes - $this->skin = $wgUser->getSkin(); + $this->mIsAllowed = $user->isAllowed('deleterevision'); // for changes $this->setHeaders(); $this->outputHeader(); - $this->submitClicked = $wgRequest->wasPosted() && $wgRequest->getBool( 'wpSubmit' ); + $request = $this->getRequest(); + $this->submitClicked = $request->wasPosted() && $request->getBool( 'wpSubmit' ); # Handle our many different possible input types. - $ids = $wgRequest->getVal( 'ids' ); + $ids = $request->getVal( 'ids' ); if ( !is_null( $ids ) ) { # Allow CSV, for backwards compatibility, or a single ID for show/hide links $this->ids = explode( ',', $ids ); } else { # Array input - $this->ids = array_keys( $wgRequest->getArray('ids',array()) ); + $this->ids = array_keys( $request->getArray('ids',array()) ); } // $this->ids = array_map( 'intval', $this->ids ); $this->ids = array_unique( array_filter( $this->ids ) ); - if ( $wgRequest->getVal( 'action' ) == 'historysubmit' ) { - # For show/hide form submission from history page - $this->targetObj = $GLOBALS['wgTitle']; + if ( $request->getVal( 'action' ) == 'historysubmit' ) { + // For show/hide form submission from history page + // Since we are access through index.php?title=XXX&action=historysubmit + // getFullTitle() will contain the target title and not our title + $this->targetObj = $this->getFullTitle(); $this->typeName = 'revision'; } else { - $this->typeName = $wgRequest->getVal( 'type' ); - $this->targetObj = Title::newFromText( $wgRequest->getText( 'target' ) ); + $this->typeName = $request->getVal( 'type' ); + $this->targetObj = Title::newFromText( $request->getText( 'target' ) ); } # For reviewing deleted files... - $this->archiveName = $wgRequest->getVal( 'file' ); - $this->token = $wgRequest->getVal( 'token' ); + $this->archiveName = $request->getVal( 'file' ); + $this->token = $request->getVal( 'token' ); if ( $this->archiveName && $this->targetObj ) { $this->tryShowFile( $this->archiveName ); return; @@ -162,7 +162,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { # No targets? if( !isset( self::$allowedTypes[$this->typeName] ) || count( $this->ids ) == 0 ) { - $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' ); + $output->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' ); return; } $this->typeInfo = self::$allowedTypes[$this->typeName]; @@ -175,10 +175,10 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { $this->targetObj = $rev ? $rev->getTitle() : $this->targetObj; } - $this->otherReason = $wgRequest->getVal( 'wpReason' ); + $this->otherReason = $request->getVal( 'wpReason' ); # We need a target page! if( is_null($this->targetObj) ) { - $wgOut->addWikiMsg( 'undelete-header' ); + $output->addWikiMsg( 'undelete-header' ); return; } # Give a link to the logs/hist for this page @@ -190,27 +190,27 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { array( 'revdelete-hide-comment', 'wpHideComment', Revision::DELETED_COMMENT ), array( 'revdelete-hide-user', 'wpHideUser', Revision::DELETED_USER ) ); - if( $wgUser->isAllowed('suppressrevision') ) { + if( $user->isAllowed('suppressrevision') ) { $this->checks[] = array( 'revdelete-hide-restricted', 'wpHideRestricted', Revision::DELETED_RESTRICTED ); } # Either submit or create our form if( $this->mIsAllowed && $this->submitClicked ) { - $this->submit( $wgRequest ); + $this->submit( $request ); } else { $this->showForm(); } $qc = $this->getLogQueryCond(); # Show relevant lines from the deletion log - $wgOut->addHTML( "

    " . htmlspecialchars( LogPage::logName( 'delete' ) ) . "

    \n" ); - LogEventsList::showLogExtract( $wgOut, 'delete', + $output->addHTML( "

    " . htmlspecialchars( LogPage::logName( 'delete' ) ) . "

    \n" ); + LogEventsList::showLogExtract( $output, 'delete', $this->targetObj->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) ); # Show relevant lines from the suppression log - if( $wgUser->isAllowed( 'suppressionlog' ) ) { - $wgOut->addHTML( "

    " . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "

    \n" ); - LogEventsList::showLogExtract( $wgOut, 'suppress', + if( $user->isAllowed( 'suppressionlog' ) ) { + $output->addHTML( "

    " . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "

    \n" ); + LogEventsList::showLogExtract( $output, 'suppress', $this->targetObj->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) ); } } @@ -219,11 +219,10 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { * Show some useful links in the subtitle */ protected function showConvenienceLinks() { - global $wgOut, $wgUser, $wgLang; # Give a link to the logs/hist for this page if( $this->targetObj ) { $links = array(); - $links[] = $this->skin->linkKnown( + $links[] = Linker::linkKnown( SpecialPage::getTitleFor( 'Log' ), wfMsgHtml( 'viewpagelogs' ), array(), @@ -231,16 +230,16 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { ); if ( $this->targetObj->getNamespace() != NS_SPECIAL ) { # Give a link to the page history - $links[] = $this->skin->linkKnown( + $links[] = Linker::linkKnown( $this->targetObj, wfMsgHtml( 'pagehist' ), array(), array( 'action' => 'history' ) ); # Link to deleted edits - if( $wgUser->isAllowed('undelete') ) { + if( $this->getUser()->isAllowed('undelete') ) { $undelete = SpecialPage::getTitleFor( 'Undelete' ); - $links[] = $this->skin->linkKnown( + $links[] = Linker::linkKnown( $undelete, wfMsgHtml( 'deletedhist' ), array(), @@ -249,7 +248,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { } } # Logs themselves don't have histories or archived revisions - $wgOut->setSubtitle( '

    ' . $wgLang->pipeList( $links ) . '

    ' ); + $this->getOutput()->setSubtitle( '

    ' . $this->getLang()->pipeList( $links ) . '

    ' ); } } @@ -271,36 +270,34 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { * TODO Mostly copied from Special:Undelete. Refactor. */ protected function tryShowFile( $archiveName ) { - global $wgOut, $wgRequest, $wgUser, $wgLang; - $repo = RepoGroup::singleton()->getLocalRepo(); $oimage = $repo->newFromArchiveName( $this->targetObj, $archiveName ); $oimage->load(); // Check if user is allowed to see this file if ( !$oimage->exists() ) { - $wgOut->addWikiMsg( 'revdelete-no-file' ); + $this->getOutput()->addWikiMsg( 'revdelete-no-file' ); return; } if( !$oimage->userCan(File::DELETED_FILE) ) { if( $oimage->isDeleted( File::DELETED_RESTRICTED ) ) { - $wgOut->permissionRequired( 'suppressrevision' ); + $this->getOutput()->permissionRequired( 'suppressrevision' ); } else { - $wgOut->permissionRequired( 'deletedtext' ); + $this->getOutput()->permissionRequired( 'deletedtext' ); } return; } - if ( !$wgUser->matchEditToken( $this->token, $archiveName ) ) { - $wgOut->addWikiMsg( 'revdelete-show-file-confirm', + if ( !$this->getUser()->matchEditToken( $this->token, $archiveName ) ) { + $this->getOutput()->addWikiMsg( 'revdelete-show-file-confirm', $this->targetObj->getText(), - $wgLang->date( $oimage->getTimestamp() ), - $wgLang->time( $oimage->getTimestamp() ) ); - $wgOut->addHTML( + $this->getLang()->date( $oimage->getTimestamp() ), + $this->getLang()->time( $oimage->getTimestamp() ) ); + $this->getOutput()->addHTML( Xml::openElement( 'form', array( 'method' => 'POST', 'action' => $this->getTitle()->getLocalUrl( 'target=' . urlencode( $oimage->getName() ) . '&file=' . urlencode( $archiveName ) . - '&token=' . urlencode( $wgUser->editToken( $archiveName ) ) ) + '&token=' . urlencode( $this->getUser()->editToken( $archiveName ) ) ) ) ) . Xml::submitButton( wfMsg( 'revdelete-show-file-submit' ) ) . @@ -308,14 +305,14 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { ); return; } - $wgOut->disable(); + $this->getOutput()->disable(); # We mustn't allow the output to be Squid cached, otherwise # if an admin previews a deleted image, and it's cached, then # a user without appropriate permissions can toddle off and # nab the image, and Squid will serve it - $wgRequest->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' ); - $wgRequest->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' ); - $wgRequest->response()->header( 'Pragma: no-cache' ); + $this->getRequest()->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' ); + $this->getRequest()->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' ); + $this->getRequest()->response()->header( 'Pragma: no-cache' ); # Stream the file to the client global $IP; @@ -341,17 +338,16 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { * which will allow the user to choose new visibility settings. */ protected function showForm() { - global $wgOut, $wgUser, $wgLang; $UserAllowed = true; if ( $this->typeName == 'logging' ) { - $wgOut->addWikiMsg( 'logdelete-selected', $wgLang->formatNum( count($this->ids) ) ); + $this->getOutput()->addWikiMsg( 'logdelete-selected', $this->getLang()->formatNum( count($this->ids) ) ); } else { - $wgOut->addWikiMsg( 'revdelete-selected', + $this->getOutput()->addWikiMsg( 'revdelete-selected', $this->targetObj->getPrefixedText(), count( $this->ids ) ); } - $wgOut->addHTML( "" ); // Explanation text $this->addUsageText(); @@ -414,7 +410,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { '' . "\n" . Xml::closeElement( 'table' ) . - Html::hidden( 'wpEditToken', $wgUser->editToken() ) . + Html::hidden( 'wpEditToken', $this->getUser()->editToken() ) . Html::hidden( 'target', $this->targetObj->getPrefixedText() ) . Html::hidden( 'type', $this->typeName ) . Html::hidden( 'ids', implode( ',', $this->ids ) ) . @@ -425,9 +421,9 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { if( $this->mIsAllowed ) { $out .= Xml::closeElement( 'form' ) . "\n"; // Show link to edit the dropdown reasons - if( $wgUser->isAllowed( 'editinterface' ) ) { + if( $this->getUser()->isAllowed( 'editinterface' ) ) { $title = Title::makeTitle( NS_MEDIAWIKI, 'revdelete-reason-dropdown' ); - $link = $wgUser->getSkin()->link( + $link = Linker::link( $title, wfMsgHtml( 'revdelete-edit-reasonlist' ), array(), @@ -436,7 +432,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { $out .= Xml::tags( 'p', array( 'class' => 'mw-revdel-editreasons' ), $link ) . "\n"; } } - $wgOut->addHTML( $out ); + $this->getOutput()->addHTML( $out ); } /** @@ -444,13 +440,12 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { * @todo FIXME: Wikimedia-specific policy text */ protected function addUsageText() { - global $wgOut, $wgUser; - $wgOut->addWikiMsg( 'revdelete-text' ); - if( $wgUser->isAllowed( 'suppressrevision' ) ) { - $wgOut->addWikiMsg( 'revdelete-suppress-text' ); + $this->getOutput()->addWikiMsg( 'revdelete-text' ); + if( $this->getUser()->isAllowed( 'suppressrevision' ) ) { + $this->getOutput()->addWikiMsg( 'revdelete-suppress-text' ); } if( $this->mIsAllowed ) { - $wgOut->addWikiMsg( 'revdelete-confirm' ); + $this->getOutput()->addWikiMsg( 'revdelete-confirm' ); } } @@ -458,8 +453,6 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { * @return String: HTML */ protected function buildCheckBoxes() { - global $wgRequest; - $html = ''; // If there is just one item, use checkboxes $list = $this->getList(); @@ -467,7 +460,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { $list->reset(); $bitfield = $list->current()->getBits(); // existing field if( $this->submitClicked ) { - $bitfield = $this->extractBitfield( $this->extractBitParams($wgRequest), $bitfield ); + $bitfield = $this->extractBitfield( $this->extractBitParams(), $bitfield ); } foreach( $this->checks as $item ) { list( $message, $name, $field ) = $item; @@ -488,7 +481,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { list( $message, $name, $field ) = $item; // If there are several items, use third state by default... if( $this->submitClicked ) { - $selected = $wgRequest->getInt( $name, 0 /* unchecked */ ); + $selected = $this->getRequest()->getInt( $name, 0 /* unchecked */ ); } else { $selected = -1; // use existing field } @@ -510,17 +503,15 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { /** * UI entry point for form submission. - * @param $request WebRequest */ - protected function submit( $request ) { - global $wgUser, $wgOut; + protected function submit() { # Check edit token on submission - if( $this->submitClicked && !$wgUser->matchEditToken( $request->getVal('wpEditToken') ) ) { - $wgOut->addWikiMsg( 'sessionfailure' ); + if( $this->submitClicked && !$this->getUser()->matchEditToken( $this->getRequest()->getVal('wpEditToken') ) ) { + $this->getOutput()->addWikiMsg( 'sessionfailure' ); return false; } - $bitParams = $this->extractBitParams( $request ); - $listReason = $request->getText( 'wpRevDeleteReasonList', 'other' ); // from dropdown + $bitParams = $this->extractBitParams(); + $listReason = $this->getRequest()->getText( 'wpRevDeleteReasonList', 'other' ); // from dropdown $comment = $listReason; if( $comment != 'other' && $this->otherReason != '' ) { // Entry from drop down menu + additional comment @@ -529,8 +520,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { $comment = $this->otherReason; } # Can the user set this field? - if( $bitParams[Revision::DELETED_RESTRICTED]==1 && !$wgUser->isAllowed('suppressrevision') ) { - $wgOut->permissionRequired( 'suppressrevision' ); + if( $bitParams[Revision::DELETED_RESTRICTED]==1 && !$this->getUser()->isAllowed('suppressrevision') ) { + $this->getOutput()->permissionRequired( 'suppressrevision' ); return false; } # If the save went through, go to success message... @@ -549,9 +540,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { * Report that the submit operation succeeded */ protected function success() { - global $wgOut; - $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) ); - $wgOut->wrapWikiMsg( "\n$1\n", $this->typeInfo['success'] ); + $this->getOutput()->setPagetitle( wfMsg( 'actioncomplete' ) ); + $this->getOutput()->wrapWikiMsg( "\n$1\n", $this->typeInfo['success'] ); $this->list->reloadFromMaster(); $this->showForm(); } @@ -560,22 +550,21 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { * Report that the submit operation failed */ protected function failure( $status ) { - global $wgOut; - $wgOut->setPagetitle( wfMsg( 'actionfailed' ) ); - $wgOut->addWikiText( $status->getWikiText( $this->typeInfo['failure'] ) ); + $this->getOutput()->setPagetitle( wfMsg( 'actionfailed' ) ); + $this->getOutput()->addWikiText( $status->getWikiText( $this->typeInfo['failure'] ) ); $this->showForm(); } /** * Put together an array that contains -1, 0, or the *_deleted const for each bit - * @param $request WebRequest + * * @return array */ - protected function extractBitParams( $request ) { + protected function extractBitParams() { $bitfield = array(); foreach( $this->checks as $item ) { list( /* message */ , $name, $field ) = $item; - $val = $request->getInt( $name, 0 /* unchecked */ ); + $val = $this->getRequest()->getInt( $name, 0 /* unchecked */ ); if( $val < -1 || $val > 1) { $val = -1; // -1 for existing value }