86 parent::__construct(
'DeletedContributions',
'deletedhistory' );
87 $this->permissionManager = $permissionManager;
88 $this->dbProvider = $dbProvider;
89 $this->revisionFactory = $revisionFactory;
90 $this->namespaceInfo = $namespaceInfo;
91 $this->userFactory = $userFactory;
92 $this->userNameUtils = $userNameUtils;
93 $this->userNamePrefixSearch = $userNamePrefixSearch;
94 $this->commentFormatter = $commentFormatter;
95 $this->linkBatchFactory = $linkBatchFactory;
109 $out->addModuleStyles( [
110 'mediawiki.interface.helpers.styles',
111 'mediawiki.special.changeslist',
117 $opts->add(
'target',
'' );
118 $opts->add(
'namespace',
'' );
119 $opts->add(
'limit', 20 );
121 $opts->fetchValuesFromRequest( $this->
getRequest() );
122 $opts->validateIntBounds(
'limit', 0,
125 if ( $par !==
null ) {
127 $par = $this->userNameUtils->getCanonical( $par, UserRigorOptions::RIGOR_NONE );
128 $opts->setValue(
'target', (
string)$par );
131 $ns = $opts->getValue(
'namespace' );
132 if ( $ns !==
null && $ns !==
'' ) {
133 $opts->setValue(
'namespace', intval( $ns ) );
136 $this->mOpts = $opts;
138 $target = trim( $opts->getValue(
'target' ) );
139 if ( !strlen( $target ) ) {
145 $userObj = $this->userFactory->newFromName( $target, UserRigorOptions::RIGOR_NONE );
153 if ( !IPUtils::isValidRange( $target ) &&
154 ( $this->userNameUtils->isIP( $target ) || $userObj->isRegistered() )
156 $this->
getSkin()->setRelevantUser( $userObj );
159 $target = $userObj->getName();
161 $out->addSubtitle( $this->getSubTitle( $userObj ) );
162 $out->setPageTitleMsg( $this->
msg(
'deletedcontributions-title' )->plaintextParams( $target ) );
171 $this->revisionFactory,
172 $this->commentFormatter,
173 $this->linkBatchFactory,
175 $opts->getValue(
'namespace' )
177 if ( !$pager->getNumRows() ) {
178 $out->addWikiMsg(
'nocontribs' );
183 # Show a message about replica DB lag, if applicable
184 $lag = $pager->getDatabase()->getSessionLagStatus()[
'lag'];
186 $out->showLagWarning( $lag );
190 '<p>' . $pager->getNavigationBar() .
'</p>' .
192 '<p>' . $pager->getNavigationBar() .
'</p>' );
194 # If there were contributions, and it was a valid user or IP, show
195 # the appropriate "footer" message - WHOIS tools, etc.
196 $message = IPUtils::isIPAddress( $target ) ?
197 'sp-contributions-footer-anon' :
198 'sp-contributions-footer';
200 if ( !$this->
msg( $message )->isDisabled() ) {
202 "<div class='mw-contributions-footer'>\n$1\n</div>",
203 [ $message, $target ]
213 private function getSubTitle( $userObj ) {
215 if ( $userObj->isAnon() ) {
216 $user = htmlspecialchars( $userObj->getName() );
218 $user = $linkRenderer->makeLink( $userObj->getUserPage(), $userObj->getName() );
221 $nt = $userObj->getUserPage();
222 $talk = $nt->getTalkPage();
227 $this->permissionManager,
231 $contributionsLink = $linkRenderer->makeKnownLink(
233 $this->msg(
'sp-deletedcontributions-contribs' )->text()
235 if ( isset( $tools[
'deletedcontribs'] ) ) {
238 $tools, [
'contribs' => $contributionsLink ],
'deletedcontribs' );
239 unset( $tools[
'deletedcontribs'] );
241 $tools[
'contribs'] = $contributionsLink;
247 $block = DatabaseBlock::newFromTarget( $userObj, $userObj );
248 if ( $block !==
null && $block->getType() != DatabaseBlock::TYPE_AUTO ) {
249 if ( $block->getType() == DatabaseBlock::TYPE_RANGE ) {
250 $nt = $this->namespaceInfo->getCanonicalName(
NS_USER )
251 .
':' . $block->getTargetName();
263 'showIfEmpty' =>
false,
265 'sp-contributions-blocked-notice',
266 $userObj->getName() # Support GENDER in
'sp-contributions-blocked-notice'
268 'offset' =>
'' # don
't use $this->getRequest() parameter offset
274 return $this->msg( 'contribsub2
' )->rawParams( $user, $links )->params( $userObj->getName() );
280 private function getForm() {
281 $opts = $this->mOpts;
287 'label-message
' => 'sp-contributions-username
',
288 'default' => $opts->getValue( 'target
' ),
293 'type
' => 'namespaceselect
',
294 'name
' => 'namespace',
295 'label-message
' => 'namespace',
300 HTMLForm::factory( 'ooui
', $formDescriptor, $this->getContext() )
301 ->setWrapperLegendMsg( 'sp-contributions-search
' )
302 ->setSubmitTextMsg( 'sp-contributions-submit
' )
303 // prevent setting subpage and 'target
' parameter at the same time
304 ->setTitle( $this->getPageTitle() )
307 ->displayForm( false );
318 public function prefixSearchSubpages( $search, $limit, $offset ) {
319 $search = $this->userNameUtils->getCanonical( $search );
321 // No prefix suggestion for invalid user
324 // Autocomplete subpage as user list - public to allow caching
325 return $this->userNamePrefixSearch
326 ->search( UserNamePrefixSearch::AUDIENCE_PUBLIC, $search, $limit, $offset );
329 protected function getGroupName() {
wfArrayInsertAfter(array $array, array $insert, $after)
Insert an array into another array after the specified key.
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
A class containing constants representing the names of configuration variables.
const QueryPageDefaultLimit
Name constant for the QueryPageDefaultLimit setting, for use with Config::get()
Parent class for all special pages.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getSkin()
Shortcut to get the skin being used for this instance.
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,...
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
getConfig()
Shortcut to get main config object.
getContext()
Gets the context this SpecialPage is executed in.
getRequest()
Get the WebRequest being used for this instance.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
getLanguage()
Shortcut to get user's language.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.