Anomie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/90357


Change subject: Pass rights needed to protectedpagewarning
......................................................................

Pass rights needed to protectedpagewarning

The message currently assumes that the right needed is 'editprotected'
and that the only group with this right is "administrator", both of
which may not actually be the case.

We also do titleprotectedwarning, since it's the same sort of sitation
even though the default message is better, and semiprotectedpagewarning
just because it's the same code path as protectedpagewarning.

Change-Id: Idf22b47a792e2eb58dadfa83c53a2409a26e0455
---
M includes/EditPage.php
M languages/messages/MessagesEn.php
M languages/messages/MessagesQqq.php
3 files changed, 38 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/57/90357/1

diff --git a/includes/EditPage.php b/includes/EditPage.php
index 12cd4b3..2e20cf7 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -2443,8 +2443,21 @@
                                # Then it must be protected based on static 
groups (regular)
                                $noticeMsg = 'protectedpagewarning';
                        }
+
+                       # Get rights needed, and replace BC entries
+                       $rights = $this->mTitle->getRestrictions( 'edit' );
+                       foreach ( array_keys( $rights, 'sysop' ) as $key ) {
+                               $rights[$key] = 'editprotected';
+                       }
+                       foreach ( array_keys( $rights, 'autoconfirmed' ) as 
$key ) {
+                               $rights[$key] = 'editsemiprotected';
+                       }
+                       $count = count( $rights );
+                       $rights = $wgLang->commaList( $rights );
+
                        LogEventsList::showLogExtract( $wgOut, 'protect', 
$this->mTitle, '',
-                               array( 'lim' => 1, 'msgKey' => array( 
$noticeMsg ) ) );
+                               array( 'lim' => 1, 'msgKey' => array( 
$noticeMsg, $rights, $count ) )
+                       );
                }
                if ( $this->mTitle->isCascadeProtected() ) {
                        # Is this page under cascading protection from some 
source pages?
@@ -2461,10 +2474,21 @@
                        $wgOut->wrapWikiMsg( $notice, array( 
'cascadeprotectedwarning', $cascadeSourcesCount ) );
                }
                if ( !$this->mTitle->exists() && 
$this->mTitle->getRestrictions( 'create' ) ) {
+                       # Get rights needed, and replace BC entries
+                       $rights = $this->mTitle->getRestrictions( 'create' );
+                       foreach ( array_keys( $rights, 'sysop' ) as $key ) {
+                               $rights[$key] = 'editprotected';
+                       }
+                       foreach ( array_keys( $rights, 'autoconfirmed' ) as 
$key ) {
+                               $rights[$key] = 'editsemiprotected';
+                       }
+                       $count = count( $rights );
+                       $rights = $wgLang->commaList( $rights );
+
                        LogEventsList::showLogExtract( $wgOut, 'protect', 
$this->mTitle, '',
                                array( 'lim' => 1,
                                        'showIfEmpty' => false,
-                                       'msgKey' => array( 
'titleprotectedwarning' ),
+                                       'msgKey' => array( 
'titleprotectedwarning', $rights, $count ),
                                        'wrap' => "<div 
class=\"mw-titleprotectedwarning\">\n$1</div>" ) );
                }
 
diff --git a/languages/messages/MessagesEn.php 
b/languages/messages/MessagesEn.php
index e247442..39fc490 100644
--- a/languages/messages/MessagesEn.php
+++ b/languages/messages/MessagesEn.php
@@ -1529,7 +1529,7 @@
 You may wish to copy and paste your text into a text file and save it for 
later.
 
 The administrator who locked it offered this explanation: $1",
-'protectedpagewarning'             => "'''Warning: This page has been 
protected so that only users with administrator privileges can edit it.'''
+'protectedpagewarning'             => "'''Warning: This page has been 
protected so that [[Special:ListGroupRights|specific rights]] are needed to 
edit it.'''
 The latest log entry is provided below for reference:",
 'semiprotectedpagewarning'         => "'''Note:''' This page has been 
protected so that only registered users can edit it.
 The latest log entry is provided below for reference:",
diff --git a/languages/messages/MessagesQqq.php 
b/languages/messages/MessagesQqq.php
index 74d13ac..a69f44d 100644
--- a/languages/messages/MessagesQqq.php
+++ b/languages/messages/MessagesQqq.php
@@ -1993,11 +1993,19 @@
 * $2 - maximum size (in kilobytes)',
 'readonlywarning' => 'Parameters:
 * $1 - reason',
-'protectedpagewarning' => '{{Related|Semiprotectedpagewarning}}',
-'semiprotectedpagewarning' => '{{Related|Semiprotectedpagewarning}}',
+'protectedpagewarning' => 'Warning message above the edit form when editing a 
page that has been protected from editing. Parameters:
+* $1 - User right(s) needed to edit the page
+* $2 - Number of user rights in $1
+{{Related|Semiprotectedpagewarning}}',
+'semiprotectedpagewarning' => 'Warning message above the edit form when 
editing a page that has been protected from editing at the "semiprotected" 
level. Parameters:
+* $1 - User right(s) needed to edit the page
+* $2 - Number of user rights in $1
+{{Related|Protectedpagewarning}}',
 'cascadeprotectedwarning' => 'Parameters:
 * $1 - number of pages, for PLURAL support',
-'titleprotectedwarning' => 'Warning message above the edit form when editing a 
page that has been protected aginst creation.',
+'titleprotectedwarning' => 'Warning message above the edit form when editing a 
page that has been protected aginst creation. Parameters:
+* $1 - User right(s) needed to edit the page
+* $2 - Number of user rights in $1',
 'templatesused' => 'Displayed below the page when editing it. It indicates a 
list of templates which are used on that page.
 
 Parameters:

-- 
To view, visit https://gerrit.wikimedia.org/r/90357
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf22b47a792e2eb58dadfa83c53a2409a26e0455
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to