X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialDeletedContributions.php;h=e4672f8a01225c2fdae0c555712875b708a565bd;hb=2e1ac38485b9c78890944413cba074474c06bd34;hp=5c8b3a620604272a0b08fddb4e7df154b0c1d49e;hpb=8bb5a6c461c31ee5ce6874548246fc2c520686f6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialDeletedContributions.php b/includes/specials/SpecialDeletedContributions.php index 5c8b3a6206..73b438c28d 100644 --- a/includes/specials/SpecialDeletedContributions.php +++ b/includes/specials/SpecialDeletedContributions.php @@ -21,6 +21,8 @@ * @ingroup SpecialPage */ +use MediaWiki\MediaWikiServices; + /** * Implements Special:DeletedContributions to display archived revisions * @ingroup SpecialPage @@ -44,8 +46,6 @@ class DeletedContributionsPage extends SpecialPage { $this->outputHeader(); $this->checkPermissions(); - $user = $this->getUser(); - $out = $this->getOutput(); $out->setPageTitle( $this->msg( 'deletedcontributions-title' ) ); @@ -59,7 +59,9 @@ class DeletedContributionsPage extends SpecialPage { $opts->validateIntBounds( 'limit', 0, $this->getConfig()->get( 'QueryPageDefaultLimit' ) ); if ( $par !== null ) { - $opts->setValue( 'target', $par ); + // Beautify the username + $par = User::getCanonicalName( $par, false ); + $opts->setValue( 'target', (string)$par ); } $ns = $opts->getValue( 'namespace' ); @@ -69,7 +71,7 @@ class DeletedContributionsPage extends SpecialPage { $this->mOpts = $opts; - $target = $opts->getValue( 'target' ); + $target = trim( $opts->getValue( 'target' ) ); if ( !strlen( $target ) ) { $this->getForm(); @@ -97,7 +99,7 @@ class DeletedContributionsPage extends SpecialPage { } # Show a message about replica DB lag, if applicable - $lag = wfGetLB()->safeGetLag( $pager->getDatabase() ); + $lag = $pager->getDatabase()->getSessionLagStatus()['lag']; if ( $lag > 0 ) { $out->showLagWarning( $lag ); } @@ -141,15 +143,18 @@ class DeletedContributionsPage extends SpecialPage { if ( $talk ) { $tools = SpecialContributions::getUserLinks( $this, $userObj ); - # Link to contributions - $insert['contribs'] = $linkRenderer->makeKnownLink( + $contributionsLink = $linkRenderer->makeKnownLink( SpecialPage::getTitleFor( 'Contributions', $nt->getDBkey() ), $this->msg( 'sp-deletedcontributions-contribs' )->text() ); - - // Swap out the deletedcontribs link for our contribs one - $tools = wfArrayInsertAfter( $tools, $insert, 'deletedcontribs' ); - unset( $tools['deletedcontribs'] ); + if ( isset( $tools['deletedcontribs'] ) ) { + // Swap out the deletedcontribs link for our contribs one + $tools = wfArrayInsertAfter( + $tools, [ 'contribs' => $contributionsLink ], 'deletedcontribs' ); + unset( $tools['deletedcontribs'] ); + } else { + $tools['contribs'] = $contributionsLink; + } $links = $this->getLanguage()->pipeList( $tools ); @@ -157,7 +162,8 @@ class DeletedContributionsPage extends SpecialPage { $block = Block::newFromTarget( $userObj, $userObj ); if ( !is_null( $block ) && $block->getType() != Block::TYPE_AUTO ) { if ( $block->getType() == Block::TYPE_RANGE ) { - $nt = MWNamespace::getCanonicalName( NS_USER ) . ':' . $block->getTarget(); + $nt = MediaWikiServices::getInstance()->getNamespaceInfo()-> + getCanonicalName( NS_USER ) . ':' . $block->getTarget(); } // LogEventsList::showLogExtract() wants the first parameter by ref