| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Specials; |
| 4 |
|
| 5 |
use MediaWiki\Html\Html; |
| 6 |
use MediaWiki\SpecialPage\SpecialPage; |
| 7 |
use MediaWiki\User\Options\UserOptionsLookup; |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
class SpecialEditRecovery extends SpecialPage { |
| 13 |
|
| 14 |
|
| 15 |
private $userOptionsLookup; |
| 16 |
|
| 17 |
public function __construct( UserOptionsLookup $userOptionsLookup ) { |
| 18 |
parent::__construct( 'EditRecovery' ); |
| 19 |
$this->userOptionsLookup = $userOptionsLookup; |
| 20 |
} |
| 21 |
|
| 22 |
protected function getGroupName() { |
| 23 |
return 'changes'; |
| 24 |
} |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
public function execute( $subPage ) { |
| 30 |
parent::execute( $subPage ); |
| 31 |
|
| 32 |
$this->addHelpLink( 'Help:Edit_Recovery' ); |
| 33 |
|
| 34 |
|
| 35 |
if ( !$this->userOptionsLookup->getOption( $this->getUser(), 'editrecovery' ) ) { |
| 36 |
if ( !$this->getUser()->isNamed() ) { |
| 37 |
|
| 38 |
$this->getOutput()->showErrorPage( 'editrecovery', 'edit-recovery-special-user-unnamed' ); |
| 39 |
} else { |
| 40 |
|
| 41 |
$this->getOutput()->showErrorPage( 'editrecovery', 'edit-recovery-special-user-not-enabled' ); |
| 42 |
} |
| 43 |
return; |
| 44 |
} |
| 45 |
|
| 46 |
$this->getOutput()->addModuleStyles( 'mediawiki.special.editrecovery.styles' ); |
| 47 |
$this->getOutput()->addModules( 'mediawiki.special.editrecovery' ); |
| 48 |
$noJs = Html::element( |
| 49 |
'span', |
| 50 |
[ 'class' => 'error mw-EditRecovery-special-nojs-notice' ], |
| 51 |
$this->msg( 'edit-recovery-nojs-placeholder' ) |
| 52 |
); |
| 53 |
$placeholder = Html::rawElement( 'div', [ 'class' => 'mw-EditRecovery-special' ], $noJs ); |
| 54 |
$this->getOutput()->addHTML( $placeholder ); |
| 55 |
} |
| 56 |
} |