88 parent::__construct(
'DeletedContributions',
'deletedhistory' );
89 $this->permissionManager = $permissionManager;
90 $this->dbProvider = $dbProvider;
91 $this->revisionFactory = $revisionFactory;
92 $this->namespaceInfo = $namespaceInfo;
93 $this->userFactory = $userFactory;
94 $this->userNameUtils = $userNameUtils;
95 $this->userNamePrefixSearch = $userNamePrefixSearch;
96 $this->commentFormatter = $commentFormatter;
97 $this->linkBatchFactory = $linkBatchFactory;
98 $this->blockStore = $blockStore;
112 $out->addModuleStyles( [
113 'mediawiki.interface.helpers.styles',
114 'mediawiki.special.changeslist',
120 $opts->add(
'target',
'' );
121 $opts->add(
'namespace',
'' );
122 $opts->add(
'limit', 20 );
124 $opts->fetchValuesFromRequest( $this->
getRequest() );
125 $opts->validateIntBounds(
'limit', 0,
128 if ( $par !==
null ) {
130 $par = $this->userNameUtils->getCanonical( $par, UserRigorOptions::RIGOR_NONE );
131 $opts->setValue(
'target', (
string)$par );
134 $ns = $opts->getValue(
'namespace' );
135 if ( $ns !==
null && $ns !==
'' ) {
136 $opts->setValue(
'namespace', intval( $ns ) );
139 $this->mOpts = $opts;
141 $target = trim( $opts->getValue(
'target' ) );
142 if ( !strlen( $target ) ) {
148 $userObj = $this->userFactory->newFromName( $target, UserRigorOptions::RIGOR_NONE );
156 if ( !IPUtils::isValidRange( $target ) &&
157 ( $this->userNameUtils->isIP( $target ) || $userObj->isRegistered() )
159 $this->
getSkin()->setRelevantUser( $userObj );
162 $target = $userObj->getName();
164 $out->addSubtitle( $this->getSubTitle( $userObj ) );
165 $out->setPageTitleMsg( $this->
msg(
'deletedcontributions-title' )->plaintextParams( $target ) );
174 $this->revisionFactory,
175 $this->commentFormatter,
176 $this->linkBatchFactory,
178 $opts->getValue(
'namespace' )
180 if ( !$pager->getNumRows() ) {
181 $out->addWikiMsg(
'nocontribs' );
186 # Show a message about replica DB lag, if applicable
187 $lag = $pager->getDatabase()->getSessionLagStatus()[
'lag'];
189 $out->showLagWarning( $lag );
193 '<p>' . $pager->getNavigationBar() .
'</p>' .
195 '<p>' . $pager->getNavigationBar() .
'</p>' );
197 # If there were contributions, and it was a valid user or IP, show
198 # the appropriate "footer" message - WHOIS tools, etc.
199 $message = IPUtils::isIPAddress( $target ) ?
200 'sp-contributions-footer-anon' :
201 'sp-contributions-footer';
203 if ( !$this->
msg( $message )->isDisabled() ) {
205 "<div class='mw-contributions-footer'>\n$1\n</div>",
206 [ $message, $target ]
216 private function getSubTitle( $userObj ) {
218 if ( $userObj->isAnon() ) {
219 $user = htmlspecialchars( $userObj->getName() );
221 $user = $linkRenderer->makeLink( $userObj->getUserPage(), $userObj->getName() );
224 $nt = $userObj->getUserPage();
225 $talk = $nt->getTalkPage();
230 $this->permissionManager,
234 $contributionsLink = $linkRenderer->makeKnownLink(
236 $this->msg(
'sp-deletedcontributions-contribs' )->text()
238 if ( isset( $tools[
'deletedcontribs'] ) ) {
241 $tools, [
'contribs' => $contributionsLink ],
'deletedcontribs' );
242 unset( $tools[
'deletedcontribs'] );
244 $tools[
'contribs'] = $contributionsLink;
250 $block = $this->blockStore->newFromTarget( $userObj, $userObj );
251 if ( $block !==
null && $block->getType() != Block::TYPE_AUTO ) {
252 if ( $block->getType() == Block::TYPE_RANGE ) {
253 $nt = $this->namespaceInfo->getCanonicalName(
NS_USER )
254 .
':' . $block->getTargetName();
266 'showIfEmpty' =>
false,
268 'sp-contributions-blocked-notice',
269 $userObj->getName() # Support GENDER in
'sp-contributions-blocked-notice'
271 'offset' =>
'' # don
't use $this->getRequest() parameter offset
277 return $this->msg( 'contribsub2
' )->rawParams( $user, $links )->params( $userObj->getName() );
283 private function getForm() {
284 $opts = $this->mOpts;
290 'label-message
' => 'sp-contributions-username
',
291 'default' => $opts->getValue( 'target
' ),
296 'type
' => 'namespaceselect
',
297 'name
' => 'namespace',
298 'label-message
' => 'namespace',
303 HTMLForm::factory( 'ooui
', $formDescriptor, $this->getContext() )
304 ->setWrapperLegendMsg( 'sp-contributions-search
' )
305 ->setSubmitTextMsg( 'sp-contributions-submit
' )
306 // prevent setting subpage and 'target
' parameter at the same time
307 ->setTitle( $this->getPageTitle() )
310 ->displayForm( false );
321 public function prefixSearchSubpages( $search, $limit, $offset ) {
322 $search = $this->userNameUtils->getCanonical( $search );
324 // No prefix suggestion for invalid user
327 // Autocomplete subpage as user list - public to allow caching
328 return $this->userNamePrefixSearch
329 ->search( UserNamePrefixSearch::AUDIENCE_PUBLIC, $search, $limit, $offset );
332 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()
static getUserLinks(SpecialPage $sp, User $target, PermissionManager $permissionManager=null, HookRunner $hookRunner=null)
Links to different places.
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 By default the message key is the canonical name of...
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.