90 parent::__construct(
'DeletedContributions',
'deletedhistory' );
91 $this->permissionManager = $permissionManager;
92 $this->dbProvider = $dbProvider;
93 $this->revisionFactory = $revisionFactory;
94 $this->namespaceInfo = $namespaceInfo;
95 $this->userFactory = $userFactory;
96 $this->userNameUtils = $userNameUtils;
97 $this->userNamePrefixSearch = $userNamePrefixSearch;
98 $this->commentFormatter = $commentFormatter;
99 $this->linkBatchFactory = $linkBatchFactory;
100 $this->blockStore = $blockStore;
114 $out->addModuleStyles( [
115 'mediawiki.interface.helpers.styles',
116 'mediawiki.special.changeslist',
122 $opts->add(
'target',
'' );
123 $opts->add(
'namespace',
'' );
124 $opts->add(
'limit', 20 );
126 $opts->fetchValuesFromRequest( $this->
getRequest() );
127 $opts->validateIntBounds(
'limit', 0,
130 if ( $par !==
null ) {
132 $par = $this->userNameUtils->getCanonical( $par, UserRigorOptions::RIGOR_NONE );
133 $opts->setValue(
'target', (
string)$par );
136 $ns = $opts->getValue(
'namespace' );
137 if ( $ns !==
null && $ns !==
'' ) {
138 $opts->setValue(
'namespace', intval( $ns ) );
141 $this->mOpts = $opts;
143 $target = trim( $opts->getValue(
'target' ) );
144 if ( !strlen( $target ) ) {
150 $userObj = $this->userFactory->newFromName( $target, UserRigorOptions::RIGOR_NONE );
158 if ( !IPUtils::isValidRange( $target ) &&
159 ( $this->userNameUtils->isIP( $target ) || $userObj->isRegistered() )
161 $this->
getSkin()->setRelevantUser( $userObj );
164 $target = $userObj->getName();
166 $out->addSubtitle( $this->getSubTitle( $userObj ) );
167 $out->setPageTitleMsg( $this->
msg(
'deletedcontributions-title' )->plaintextParams( $target ) );
176 $this->revisionFactory,
177 $this->commentFormatter,
178 $this->linkBatchFactory,
180 $opts->getValue(
'namespace' )
182 if ( !$pager->getNumRows() ) {
183 $out->addWikiMsg(
'nocontribs' );
188 # Show a message about replica DB lag, if applicable
189 $lag = $pager->getDatabase()->getSessionLagStatus()[
'lag'];
191 $out->showLagWarning( $lag );
195 '<p>' . $pager->getNavigationBar() .
'</p>' .
197 '<p>' . $pager->getNavigationBar() .
'</p>' );
199 # If there were contributions, and it was a valid user or IP, show
200 # the appropriate "footer" message - WHOIS tools, etc.
201 $message = IPUtils::isIPAddress( $target ) ?
202 'sp-contributions-footer-anon' :
203 'sp-contributions-footer';
205 if ( !$this->
msg( $message )->isDisabled() ) {
207 "<div class='mw-contributions-footer'>\n$1\n</div>",
208 [ $message, $target ]
218 private function getSubTitle( $userObj ) {
220 if ( $userObj->isAnon() ) {
221 $user = htmlspecialchars( $userObj->getName() );
223 $user = $linkRenderer->makeLink( $userObj->getUserPage(), $userObj->getName() );
226 $nt = $userObj->getUserPage();
227 $talk = $nt->getTalkPage();
232 $this->permissionManager,
236 $contributionsLink = $linkRenderer->makeKnownLink(
238 $this->msg(
'sp-deletedcontributions-contribs' )->text()
240 if ( isset( $tools[
'deletedcontribs'] ) ) {
243 $tools, [
'contribs' => $contributionsLink ],
'deletedcontribs' );
244 unset( $tools[
'deletedcontribs'] );
246 $tools[
'contribs'] = $contributionsLink;
252 $block = $this->blockStore->newFromTarget( $userObj, $userObj );
253 if ( $block !==
null && $block->getType() != DatabaseBlock::TYPE_AUTO ) {
254 if ( $block->getType() == DatabaseBlock::TYPE_RANGE ) {
255 $nt = $this->namespaceInfo->getCanonicalName(
NS_USER )
256 .
':' . $block->getTargetName();
268 'showIfEmpty' =>
false,
270 'sp-contributions-blocked-notice',
271 $userObj->getName() # Support GENDER in
'sp-contributions-blocked-notice'
273 'offset' =>
'' # don
't use $this->getRequest() parameter offset
279 return $this->msg( 'contribsub2
' )->rawParams( $user, $links )->params( $userObj->getName() );
285 private function getForm() {
286 $opts = $this->mOpts;
292 'label-message
' => 'sp-contributions-username
',
293 'default' => $opts->getValue( 'target
' ),
298 'type
' => 'namespaceselect
',
299 'name
' => 'namespace',
300 'label-message
' => 'namespace',
305 HTMLForm::factory( 'ooui
', $formDescriptor, $this->getContext() )
306 ->setWrapperLegendMsg( 'sp-contributions-search
' )
307 ->setSubmitTextMsg( 'sp-contributions-submit
' )
308 // prevent setting subpage and 'target
' parameter at the same time
309 ->setTitle( $this->getPageTitle() )
312 ->displayForm( false );
323 public function prefixSearchSubpages( $search, $limit, $offset ) {
324 $search = $this->userNameUtils->getCanonical( $search );
326 // No prefix suggestion for invalid user
329 // Autocomplete subpage as user list - public to allow caching
330 return $this->userNamePrefixSearch
331 ->search( UserNamePrefixSearch::AUDIENCE_PUBLIC, $search, $limit, $offset );
334 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.