37 parent::__construct(
'DeletedContributions',
'deletedhistory' );
53 $out->setPageTitle( $this->
msg(
'deletedcontributions-title' ) );
57 $opts->add(
'target',
'' );
58 $opts->add(
'namespace',
'' );
59 $opts->add(
'limit', 20 );
61 $opts->fetchValuesFromRequest( $this->
getRequest() );
62 $opts->validateIntBounds(
'limit', 0, $this->
getConfig()->
get(
'QueryPageDefaultLimit' ) );
64 if ( $par !==
null ) {
66 $par = User::getCanonicalName( $par,
false );
67 $opts->setValue(
'target', (
string)$par );
70 $ns = $opts->getValue(
'namespace' );
71 if ( $ns !==
null && $ns !==
'' ) {
72 $opts->setValue(
'namespace', intval( $ns ) );
77 $target = trim( $opts->getValue(
'target' ) );
78 if ( !strlen( $target ) ) {
84 $userObj = User::newFromName( $target,
false );
90 $this->
getSkin()->setRelevantUser( $userObj );
92 $target = $userObj->getName();
93 $out->addSubtitle( $this->
getSubTitle( $userObj ) );
98 $this->getLinkRenderer() );
99 if ( !$pager->getNumRows() ) {
100 $out->addWikiMsg(
'nocontribs' );
105 # Show a message about replica DB lag, if applicable
106 $lag = $pager->getDatabase()->getSessionLagStatus()[
'lag'];
108 $out->showLagWarning( $lag );
112 '<p>' . $pager->getNavigationBar() .
'</p>' .
114 '<p>' . $pager->getNavigationBar() .
'</p>' );
116 # If there were contributions, and it was a valid user or IP, show
117 # the appropriate "footer" message - WHOIS tools, etc.
118 $message = IPUtils::isIPAddress( $target ) ?
119 'sp-contributions-footer-anon' :
120 'sp-contributions-footer';
122 if ( !$this->
msg( $message )->isDisabled() ) {
124 "<div class='mw-contributions-footer'>\n$1\n</div>",
125 [ $message, $target ]
137 if ( $userObj->isAnon() ) {
138 $user = htmlspecialchars( $userObj->getName() );
140 $user =
$linkRenderer->makeLink( $userObj->getUserPage(), $userObj->getName() );
143 $nt = $userObj->getUserPage();
144 $talk = $nt->getTalkPage();
146 $tools = SpecialContributions::getUserLinks( $this, $userObj );
150 $this->msg(
'sp-deletedcontributions-contribs' )->text()
152 if ( isset( $tools[
'deletedcontribs'] ) ) {
155 $tools, [
'contribs' => $contributionsLink ],
'deletedcontribs' );
156 unset( $tools[
'deletedcontribs'] );
158 $tools[
'contribs'] = $contributionsLink;
164 $block = DatabaseBlock::newFromTarget( $userObj, $userObj );
165 if ( $block !==
null && $block->getType() != DatabaseBlock::TYPE_AUTO ) {
166 if ( $block->getType() == DatabaseBlock::TYPE_RANGE ) {
167 $nt = MediaWikiServices::getInstance()->getNamespaceInfo()->
168 getCanonicalName(
NS_USER ) .
':' . $block->getTarget();
173 LogEventsList::showLogExtract(
180 'showIfEmpty' =>
false,
182 'sp-contributions-blocked-notice',
183 $userObj->getName() # Support GENDER in
'sp-contributions-blocked-notice'
185 'offset' =>
'' # don
't use $this->getRequest() parameter offset
191 return $this->msg( 'contribsub2
' )->rawParams( $user, $links )->params( $userObj->getName() );
197 private function getForm() {
198 $opts = $this->mOpts;
204 'label-message
' => 'sp-contributions-username
',
205 'default' => $opts->getValue( 'target
' ),
210 'type
' => 'namespaceselect
',
211 'name
' => 'namespace',
212 'label-message
' => 'namespace',
217 HTMLForm::factory( 'ooui
', $formDescriptor, $this->getContext() )
218 ->setWrapperLegendMsg( 'sp-contributions-search
' )
219 ->setSubmitTextMsg( 'sp-contributions-submit
' )
220 // prevent setting subpage and 'target
' parameter at the same time
221 ->setAction( $this->getPageTitle()->getLocalURL() )
224 ->displayForm( false );
235 public function prefixSearchSubpages( $search, $limit, $offset ) {
236 $user = User::newFromName( $search );
238 // No prefix suggestion for invalid user
241 // Autocomplete subpage as user list - public to allow caching
242 return UserNamePrefixSearch::search( '
public', $search, $limit, $offset );
245 protected function getGroupName() {
wfArrayInsertAfter(array $array, array $insert, $after)
Insert array into another array after the specified KEY
Implements Special:DeletedContributions to display archived revisions.
getSubTitle( $userObj)
Generates the subheading with links.
execute( $par)
Special page "deleted user contributions".
getForm()
Generates the namespace selector form with hidden attributes.
Parent class for all special pages.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!...
getOutput()
Get the OutputPage being used for this instance.
getSkin()
Shortcut to get the skin being used for this instance.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getRequest()
Get the WebRequest being used for this instance.
getLanguage()
Shortcut to get user's language.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
MediaWiki Linker LinkRenderer null $linkRenderer