From: jenkins-bot Date: Sat, 6 Oct 2018 03:21:47 +0000 (+0000) Subject: Merge "messagecache: use MergeableUpdate for the deferred replace() update" X-Git-Tag: 1.34.0-rc.0~3872 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=866831f2ef57f8a72282e03d30a5c3f63ca5ec2a;hp=59242afaa773b0ac62143c2949ad4f8290aa2462;p=lhc%2Fweb%2Fwiklou.git Merge "messagecache: use MergeableUpdate for the deferred replace() update" --- diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 4636ba349e..e10a530062 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -369,6 +369,11 @@ class MediaWiki { } throw new HttpError( 500, $message ); } + // Protect against redirects to NS_MEDIA namespace + // when the user probably wants NS_FILE + if ( $title->inNamespace( NS_MEDIA ) ) { + $title->mNamespace = NS_FILE; + } $output->setCdnMaxage( 1200 ); $output->redirect( $targetUrl, '301' ); return true; diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index 11b8badabf..1cc4288cd5 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -132,13 +132,18 @@ class InfoAction extends FormlessAction { "mw-pageinfo-${header}" ) . "\n"; $table = "\n"; + $below = ""; foreach ( $infoTable as $infoRow ) { + if ( $infoRow[0] == "below" ) { + $below = $infoRow[1] . "\n"; + continue; + } $name = ( $infoRow[0] instanceof Message ) ? $infoRow[0]->escaped() : $infoRow[0]; $value = ( $infoRow[1] instanceof Message ) ? $infoRow[1]->escaped() : $infoRow[1]; $id = ( $infoRow[0] instanceof Message ) ? $infoRow[0]->getKey() : null; $table = $this->addRow( $table, $name, $value, $id ) . "\n"; } - $content = $this->addTable( $content, $table ) . "\n"; + $content = $this->addTable( $content, $table ) . "\n" . $below; } // Page footer @@ -504,6 +509,16 @@ class InfoAction extends FormlessAction { $this->msg( "restriction-$restrictionType" ), $message ]; } + $protectLog = SpecialPage::getTitleFor( 'Log' ); + $pageInfo['header-restrictions'][] = [ + 'below', + $linkRenderer->makeKnownLink( + $protectLog, + $this->msg( 'pageinfo-view-protect-log' )->text(), + [], + [ 'type' => 'protect', 'page' => $title->getPrefixedText() ] + ), + ]; if ( !$this->page->exists() ) { return $pageInfo; diff --git a/includes/specials/SpecialDeletedContributions.php b/includes/specials/SpecialDeletedContributions.php index 3f8771265d..e4672f8a01 100644 --- a/includes/specials/SpecialDeletedContributions.php +++ b/includes/specials/SpecialDeletedContributions.php @@ -73,7 +73,7 @@ class DeletedContributionsPage extends SpecialPage { $this->mOpts = $opts; - $target = $opts->getValue( 'target' ); + $target = trim( $opts->getValue( 'target' ) ); if ( !strlen( $target ) ) { $this->getForm(); diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 30a9699a19..1d7f3f53c6 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -3107,6 +3107,7 @@ "pageinfo-category-files": "Number of files", "pageinfo-user-id": "User ID", "pageinfo-file-hash": "Hash value", + "pageinfo-view-protect-log": "View the protection log for this page.", "markaspatrolleddiff": "Mark as patrolled", "markaspatrolledlink": "[$1]", "markaspatrolledtext": "Mark this page as patrolled", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index eeb0a1cf59..c4585f39b2 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -3309,6 +3309,7 @@ "pageinfo-category-files": "See also:\n* {{msg-mw|Pageinfo-category-pages}}\n* {{msg-mw|Pageinfo-category-subcats}}", "pageinfo-user-id": "The numeric ID for a user\n{{Identical|User ID}}", "pageinfo-file-hash": "Base-16 SHA-1 value of the file", + "pageinfo-view-protect-log": "Contain link to protection link for the current page.", "markaspatrolleddiff": "{{doc-actionlink}}\nSee also:\n* {{msg-mw|Markaspatrolledtext}}\n{{Identical|Mark as patrolled}}", "markaspatrolledlink": "{{notranslate}}\nParameters:\n* $1 - link which has text {{msg-mw|Markaspatrolledtext}}", "markaspatrolledtext": "{{doc-actionlink}}\nSee also:\n* {{msg-mw|Markaspatrolleddiff}}", diff --git a/tests/phpunit/includes/MediaWikiTest.php b/tests/phpunit/includes/MediaWikiTest.php index d79d2cf157..916a6ebafc 100644 --- a/tests/phpunit/includes/MediaWikiTest.php +++ b/tests/phpunit/includes/MediaWikiTest.php @@ -134,6 +134,13 @@ class MediaWikiTest extends MediaWikiTestCase { 'title' => 'Double_slash', 'redirect' => false, ], + [ + // View: Media namespace redirect (T203942) + 'url' => 'http://example.org/w/index.php?title=Media:Foo_Bar', + 'query' => [ 'title' => 'Foo_Bar' ], + 'title' => 'File:Foo_Bar', + 'redirect' => 'http://example.org/wiki/File:Foo_Bar', + ], ]; }