Fold RevertFileAction class into RevertAction

RevertAction was simply a dummy class for outputting an error message
if the action was not done in the file namespace. I've instead
moved RevertFileAction to RevertAction and threw an exception
from within checkCanExecute().

Change-Id: I7b87de60680009bf4e74d33342cbe81cc0d211b5
This commit is contained in:
withoutaname 2014-07-09 18:26:16 -07:00 committed by Legoktm
parent 1c1e321af7
commit 0367d94952
4 changed files with 6 additions and 28 deletions

View file

@ -286,6 +286,7 @@ changes to languages because of Bugzilla reports.
* IPBlockForm - Use SpecialBlock directly
* WatchlistEditor - Use SpecialEditWatchlist directly
* FormatExif - Use FormatMetadata directly
* RevertFileAction - Use RevertAction directly
== Compatibility ==

View file

@ -226,7 +226,6 @@ $wgAutoloadLocalClasses = array(
'RawPage' => 'includes/actions/RawAction.php',
'RenderAction' => 'includes/actions/RenderAction.php',
'RevertAction' => 'includes/actions/RevertAction.php',
'RevertFileAction' => 'includes/actions/RevertAction.php',
'RevisiondeleteAction' => 'includes/actions/RevisiondeleteAction.php',
'RollbackAction' => 'includes/actions/RollbackAction.php',
'SubmitAction' => 'includes/actions/EditAction.php',

View file

@ -24,30 +24,11 @@
*/
/**
* Dummy class for pages not in NS_FILE
* File reversion user interface
*
* @ingroup Actions
*/
class RevertAction extends Action {
public function getName() {
return 'revert';
}
public function show() {
$this->getOutput()->showErrorPage( 'nosuchaction', 'nosuchactiontext' );
}
public function execute() {
}
}
/**
* Class for pages in NS_FILE
*
* @ingroup Actions
*/
class RevertFileAction extends FormAction {
class RevertAction extends FormAction {
/**
* @var OldLocalFile
*/
@ -62,6 +43,9 @@ class RevertFileAction extends FormAction {
}
protected function checkCanExecute( User $user ) {
if ( $this->getTitle()->getNamespace() !== NS_FILE ) {
throw new ErrorPageError( $this->msg( 'nosuchaction' ), $this->msg( 'nosuchactiontext' ) );
}
parent::checkCanExecute( $user );
$oldimage = $this->getRequest()->getText( 'oldimage' );

View file

@ -40,12 +40,6 @@ class WikiFilePage extends WikiPage {
$this->mRepo = null;
}
public function getActionOverrides() {
$overrides = parent::getActionOverrides();
$overrides['revert'] = 'RevertFileAction';
return $overrides;
}
/**
* @param File $file
*/