47 private $permissionManager;
50 private $loadBalancer;
53 private $revisionFactory;
56 private $namespaceInfo;
62 private $userNameUtils;
65 private $userNamePrefixSearch;
68 private $commentFormatter;
71 private $linkBatchFactory;
95 parent::__construct(
'DeletedContributions',
'deletedhistory' );
96 $this->permissionManager = $permissionManager;
97 $this->loadBalancer = $loadBalancer;
98 $this->revisionFactory = $revisionFactory;
99 $this->namespaceInfo = $namespaceInfo;
100 $this->userFactory = $userFactory;
101 $this->userNameUtils = $userNameUtils;
102 $this->userNamePrefixSearch = $userNamePrefixSearch;
103 $this->commentFormatter = $commentFormatter;
104 $this->linkBatchFactory = $linkBatchFactory;
118 $out->addModuleStyles( [
119 'mediawiki.interface.helpers.styles',
120 'mediawiki.special.changeslist',
126 $opts->add(
'target',
'' );
127 $opts->add(
'namespace',
'' );
128 $opts->add(
'limit', 20 );
130 $opts->fetchValuesFromRequest( $this->
getRequest() );
131 $opts->validateIntBounds(
'limit', 0,
132 $this->
getConfig()->
get( MainConfigNames::QueryPageDefaultLimit ) );
134 if ( $par !==
null ) {
136 $par = $this->userNameUtils->getCanonical( $par, UserRigorOptions::RIGOR_NONE );
137 $opts->setValue(
'target', (
string)$par );
140 $ns = $opts->getValue(
'namespace' );
141 if ( $ns !==
null && $ns !==
'' ) {
142 $opts->setValue(
'namespace', intval( $ns ) );
145 $this->mOpts = $opts;
147 $target = trim( $opts->getValue(
'target' ) );
148 if ( !strlen( $target ) ) {
154 $userObj = $this->userFactory->newFromName( $target, UserRigorOptions::RIGOR_NONE );
160 $this->
getSkin()->setRelevantUser( $userObj );
162 $target = $userObj->getName();
164 $out->addSubtitle( $this->getSubTitle( $userObj ) );
165 $out->setPageTitle( $this->
msg(
'deletedcontributions-title', $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 = DatabaseBlock::newFromTarget( $userObj, $userObj );
251 if ( $block !==
null && $block->getType() != DatabaseBlock::TYPE_AUTO ) {
252 if ( $block->getType() == DatabaseBlock::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.
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
static getUserLinks(SpecialPage $sp, User $target, PermissionManager $permissionManager=null, HookRunner $hookRunner=null)
Links to different places.
Implements Special:DeletedContributions to display archived revisions.
__construct(PermissionManager $permissionManager, ILoadBalancer $loadBalancer, RevisionFactory $revisionFactory, NamespaceInfo $namespaceInfo, UserFactory $userFactory, UserNameUtils $userNameUtils, UserNamePrefixSearch $userNamePrefixSearch, CommentFormatter $commentFormatter, LinkBatchFactory $linkBatchFactory)
execute( $par)
Special page "deleted user contributions".
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.