From 63a6805fbf0f261da6a39d76a13926c081b6aa78 Mon Sep 17 00:00:00 2001 From: Martin Urbanec Date: Sat, 29 Sep 2018 19:03:12 +0200 Subject: [PATCH] Add link to protect log to action=info Bug: T52190 Change-Id: Id983d4585a253ebe34e07f07472548f6d1d20bce --- includes/actions/InfoAction.php | 17 ++++++++++++++++- languages/i18n/en.json | 1 + languages/i18n/qqq.json | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) 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/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}}", -- 2.20.1