http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89874
Revision: 89874
Author: ialex
Date: 2011-06-11 08:30:19 +0000 (Sat, 11 Jun 2011)
Log Message:
-----------
* 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
Modified Paths:
--------------
trunk/phase3/includes/AutoLoader.php
trunk/phase3/includes/DefaultSettings.php
trunk/phase3/includes/Wiki.php
trunk/phase3/includes/revisiondelete/RevisionDelete.php
trunk/phase3/includes/revisiondelete/RevisionDeleteAbstracts.php
trunk/phase3/includes/specials/SpecialRevisiondelete.php
Added Paths:
-----------
trunk/phase3/includes/actions/RevisiondeleteAction.php
Modified: trunk/phase3/includes/AutoLoader.php
===================================================================
--- trunk/phase3/includes/AutoLoader.php 2011-06-11 08:03:59 UTC (rev
89873)
+++ trunk/phase3/includes/AutoLoader.php 2011-06-11 08:30:19 UTC (rev
89874)
@@ -250,6 +250,7 @@
# 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',
Modified: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php 2011-06-11 08:03:59 UTC (rev
89873)
+++ trunk/phase3/includes/DefaultSettings.php 2011-06-11 08:30:19 UTC (rev
89874)
@@ -5030,6 +5030,7 @@
*/
$wgActions = array(
'credits' => true,
+ 'revisiondelete' => true,
'purge' => true,
'unwatch' => true,
'watch' => true,
Modified: trunk/phase3/includes/Wiki.php
===================================================================
--- trunk/phase3/includes/Wiki.php 2011-06-11 08:03:59 UTC (rev 89873)
+++ trunk/phase3/includes/Wiki.php 2011-06-11 08:30:19 UTC (rev 89874)
@@ -465,11 +465,6 @@
$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' );
Added: trunk/phase3/includes/actions/RevisiondeleteAction.php
===================================================================
--- trunk/phase3/includes/actions/RevisiondeleteAction.php
(rev 0)
+++ trunk/phase3/includes/actions/RevisiondeleteAction.php 2011-06-11
08:30:19 UTC (rev 89874)
@@ -0,0 +1,53 @@
+<?php
+/**
+ * An action that just pass the request to Special:RevisionDelete
+ *
+ * Copyright © 2011 Alexandre Emsenhuber
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA
+ *
+ * @file
+ * @ingroup Actions
+ * @author Alexandre Emsenhuber
+ */
+
+class RevisiondeleteAction extends FormlessAction {
+
+ public function getName() {
+ return 'revisiondelete';
+ }
+
+ public function getRestriction() {
+ return null;
+ }
+
+ public function requiresUnblock() {
+ return false;
+ }
+
+ public function getDescription() {
+ return '';
+ }
+
+ public function onView() {
+ return '';
+ }
+
+ public function show() {
+ $special = SpecialPageFactory::getPage( 'Revisiondelete' );
+ $special->setContext( $this->getContext() );
+ $special->execute( '' );
+ }
+}
Property changes on: trunk/phase3/includes/actions/RevisiondeleteAction.php
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/phase3/includes/revisiondelete/RevisionDelete.php
===================================================================
--- trunk/phase3/includes/revisiondelete/RevisionDelete.php 2011-06-11
08:03:59 UTC (rev 89873)
+++ trunk/phase3/includes/revisiondelete/RevisionDelete.php 2011-06-11
08:30:19 UTC (rev 89874)
@@ -170,12 +170,11 @@
* 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 @@
return wfMsgHtml('diff');
} else {
return
- $this->special->skin->link(
+ Linker::link(
$this->list->title,
wfMsgHtml('diff'),
array(),
@@ -215,8 +214,8 @@
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 = "<span
class=\"history-deleted\">$revlink</span>";
}
@@ -298,13 +297,12 @@
}
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 @@
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 @@
* 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 @@
*/
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 @@
*/
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 @@
}
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 '<li>' . $this->getLink() . ' ' . $this->getUserTools()
. ' ' .
@@ -641,19 +637,18 @@
}
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 @@
}
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 @@
$action = '<span class="history-deleted">' .
wfMsgHtml('rev-deleted-event') . '</span>';
} 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 = '<span class="history-deleted">' .
$action . '</span>';
}
// 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 = '<span class="history-deleted">' .
$userLink . '</span>';
}
// 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 = '<span class="history-deleted">' . $comment
. '</span>';
}
Modified: trunk/phase3/includes/revisiondelete/RevisionDeleteAbstracts.php
===================================================================
--- trunk/phase3/includes/revisiondelete/RevisionDeleteAbstracts.php
2011-06-11 08:03:59 UTC (rev 89873)
+++ trunk/phase3/includes/revisiondelete/RevisionDeleteAbstracts.php
2011-06-11 08:30:19 UTC (rev 89874)
@@ -331,6 +331,24 @@
}
/**
+ * 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
*/
@@ -429,6 +447,24 @@
}
/**
+ * 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
*/
abstract public function canView();
Modified: trunk/phase3/includes/specials/SpecialRevisiondelete.php
===================================================================
--- trunk/phase3/includes/specials/SpecialRevisiondelete.php 2011-06-11
08:03:59 UTC (rev 89873)
+++ trunk/phase3/includes/specials/SpecialRevisiondelete.php 2011-06-11
08:30:19 UTC (rev 89874)
@@ -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 @@
}
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 @@
# 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 @@
$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 @@
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( "<h2>" . htmlspecialchars( LogPage::logName(
'delete' ) ) . "</h2>\n" );
- LogEventsList::showLogExtract( $wgOut, 'delete',
+ $output->addHTML( "<h2>" . htmlspecialchars( LogPage::logName(
'delete' ) ) . "</h2>\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( "<h2>" . htmlspecialchars(
LogPage::logName( 'suppress' ) ) . "</h2>\n" );
- LogEventsList::showLogExtract( $wgOut, 'suppress',
+ if( $user->isAllowed( 'suppressionlog' ) ) {
+ $output->addHTML( "<h2>" . htmlspecialchars(
LogPage::logName( 'suppress' ) ) . "</h2>\n" );
+ LogEventsList::showLogExtract( $output, 'suppress',
$this->targetObj->getPrefixedText(), '', array(
'lim' => 25, 'conds' => $qc ) );
}
}
@@ -219,11 +219,10 @@
* 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 @@
);
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 @@
}
}
# Logs themselves don't have histories or archived
revisions
- $wgOut->setSubtitle( '<p>' . $wgLang->pipeList( $links
) . '</p>' );
+ $this->getOutput()->setSubtitle( '<p>' .
$this->getLang()->pipeList( $links ) . '</p>' );
}
}
@@ -271,36 +270,34 @@
* 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 @@
);
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 @@
* 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( "<ul>" );
+ $this->getOutput()->addHTML( "<ul>" );
$numRevisions = 0;
// Live revisions...
@@ -360,21 +356,21 @@
$item = $list->current();
if ( !$item->canView() ) {
if( !$this->submitClicked ) {
- $wgOut->permissionRequired(
'suppressrevision' );
+ $this->getOutput()->permissionRequired(
'suppressrevision' );
return;
}
$UserAllowed = false;
}
$numRevisions++;
- $wgOut->addHTML( $item->getHTML() );
+ $this->getOutput()->addHTML( $item->getHTML() );
}
if( !$numRevisions ) {
- $wgOut->showErrorPage( 'revdelete-nooldid-title',
'revdelete-nooldid-text' );
+ $this->getOutput()->showErrorPage(
'revdelete-nooldid-title', 'revdelete-nooldid-text' );
return;
}
- $wgOut->addHTML( "</ul>" );
+ $this->getOutput()->addHTML( "</ul>" );
// Explanation text
$this->addUsageText();
@@ -414,7 +410,7 @@
'</td>' .
"</tr>\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 @@
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 @@
$out .= Xml::tags( 'p', array( 'class' =>
'mw-revdel-editreasons' ), $link ) . "\n";
}
}
- $wgOut->addHTML( $out );
+ $this->getOutput()->addHTML( $out );
}
/**
@@ -444,13 +440,12 @@
* @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 @@
* @return String: HTML
*/
protected function buildCheckBoxes() {
- global $wgRequest;
-
$html = '<table>';
// If there is just one item, use checkboxes
$list = $this->getList();
@@ -467,7 +460,7 @@
$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 @@
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 @@
/**
* 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 @@
$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 @@
* Report that the submit operation succeeded
*/
protected function success() {
- global $wgOut;
- $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
- $wgOut->wrapWikiMsg( "<span class=\"success\">\n$1\n</span>",
$this->typeInfo['success'] );
+ $this->getOutput()->setPagetitle( wfMsg( 'actioncomplete' ) );
+ $this->getOutput()->wrapWikiMsg( "<span
class=\"success\">\n$1\n</span>", $this->typeInfo['success'] );
$this->list->reloadFromMaster();
$this->showForm();
}
@@ -560,22 +550,21 @@
* 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
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs