* Add relevant `@ingroup` to special pages that belong to a specific component and for which a doc group is already defined (defgroup), e.g. "Upload" for SpecialUpload, "JobQueue" for SpecialRunJobs. * Remove duplicate descriptions from file blocks in favour of class doc blocks. This reduces needless duplication and was often incorrect or outdated, and helps make file headers more consistently (visually) ignorable. Add missing `ingroup` to class blocks (and remove any from file blocks) as otherwise the file is indexed twice (e.g. in Doxygen) which makes navigation on doc.wikimedia.org rather messy. Ref https://gerrit.wikimedia.org/r/q/message:ingroup+is:merged Bug: T364652 Change-Id: I795c43b6d72782d457c963e352d7e1b022c2b641
56 lines
1.7 KiB
PHP
56 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Specials;
|
|
|
|
use MediaWiki\Html\Html;
|
|
use MediaWiki\SpecialPage\SpecialPage;
|
|
use MediaWiki\User\Options\UserOptionsLookup;
|
|
|
|
/**
|
|
* @ingroup SpecialPage
|
|
*/
|
|
class SpecialEditRecovery extends SpecialPage {
|
|
|
|
/** @var UserOptionsLookup */
|
|
private $userOptionsLookup;
|
|
|
|
public function __construct( UserOptionsLookup $userOptionsLookup ) {
|
|
parent::__construct( 'EditRecovery' );
|
|
$this->userOptionsLookup = $userOptionsLookup;
|
|
}
|
|
|
|
protected function getGroupName() {
|
|
return 'changes';
|
|
}
|
|
|
|
/**
|
|
* @param string|null $subPage
|
|
*/
|
|
public function execute( $subPage ) {
|
|
parent::execute( $subPage );
|
|
// Always add the help link, even for the error pages.
|
|
$this->addHelpLink( 'Help:Edit_Recovery' );
|
|
|
|
// Check that the user preference is enabled (the user is not necessarily logged in).
|
|
if ( !$this->userOptionsLookup->getOption( $this->getUser(), 'editrecovery' ) ) {
|
|
if ( !$this->getUser()->isNamed() ) {
|
|
// Pref is not enabled, and they aren't logged in.
|
|
$this->getOutput()->showErrorPage( 'editrecovery', 'edit-recovery-special-user-unnamed' );
|
|
} else {
|
|
// Pref is not enabled, but they are logged in so can enable it themselves.
|
|
$this->getOutput()->showErrorPage( 'editrecovery', 'edit-recovery-special-user-not-enabled' );
|
|
}
|
|
return;
|
|
}
|
|
|
|
$this->getOutput()->addModuleStyles( 'mediawiki.special.editrecovery.styles' );
|
|
$this->getOutput()->addModules( 'mediawiki.special.editrecovery' );
|
|
$noJs = Html::element(
|
|
'span',
|
|
[ 'class' => 'error mw-EditRecovery-special-nojs-notice' ],
|
|
$this->msg( 'edit-recovery-nojs-placeholder' )
|
|
);
|
|
$placeholder = Html::rawElement( 'div', [ 'class' => 'mw-EditRecovery-special' ], $noJs );
|
|
$this->getOutput()->addHTML( $placeholder );
|
|
}
|
|
}
|