jenkins-bot has submitted this change and it was merged.

Change subject: Mark wikis as nonglobal
......................................................................


Mark wikis as nonglobal

 * Helpful for T108776

Change-Id: Ia71f4d7366763cea8b3514cad168fe4e9da8e295
---
M SiteMatrixApi.php
M SiteMatrix_body.php
M SpecialSiteMatrix.php
M i18n/en.json
M i18n/qqq.json
5 files changed, 46 insertions(+), 6 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  Siebrand: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/SiteMatrixApi.php b/SiteMatrixApi.php
index b2b46b0..d1c5718 100644
--- a/SiteMatrixApi.php
+++ b/SiteMatrixApi.php
@@ -38,6 +38,7 @@
                $closed = isset( $state['closed'] );
                $private = isset( $state['private'] );
                $fishbowl = isset( $state['fishbowl'] );
+               $nonglobal = isset( $state['nonglobal'] );
 
                $count = 0;
                if ( isset( $type['language'] ) && $continue[0] == 'language' ) 
{
@@ -140,6 +141,13 @@
                                                $skip = false;
                                        }
                                }
+                               if ( $matrix->isNonGlobal( $lang . $site ) ) {
+                                       $wiki['nonglobal'] = '';
+
+                                       if ( $nonglobal ) {
+                                               $skip = false;
+                                       }
+                               }
                                if ( $matrix->isClosed( $lang, $site ) ) {
                                        $wiki['closed'] = '';
 
@@ -183,7 +191,8 @@
                                        'all',
                                        'closed',
                                        'private',
-                                       'fishbowl'
+                                       'fishbowl',
+                                       'nonglobal',
                                ),
                                ApiBase::PARAM_DFLT => 'all',
                        ),
@@ -236,6 +245,7 @@
                                ' closed   - No write access, full read access',
                                ' private  - Read and write restricted',
                                ' fishbowl - Restricted write access, full read 
access',
+                               ' nonglobal - Public but requires registration',
                        ),
                        'langprop' => 'Which information about a language to 
return',
                        'siteprop' => 'Which information about a site to 
return',
diff --git a/SiteMatrix_body.php b/SiteMatrix_body.php
index ced2dbf..6cfc73b 100644
--- a/SiteMatrix_body.php
+++ b/SiteMatrix_body.php
@@ -18,6 +18,11 @@
         */
        protected $closed = null;
 
+       /**
+        * @var array|null
+        */
+       protected $nonglobal = null;
+
        protected $specials, $matrix, $count, $countPerSite;
 
        public function __construct() {
@@ -299,6 +304,20 @@
         * @param string $dbname DatabaseName
         * @return bool
         */
+       public function isNonGlobal( $dbname ) {
+               global $wgSiteMatrixNonGlobalSites;
+
+               if ( $this->nonglobal == null ) {
+                       $this->nonglobal = $this->extractDbList( 
$wgSiteMatrixNonGlobalSites );
+               }
+
+               return in_array( $dbname, $this->nonglobal );
+       }
+
+       /**
+        * @param string $dbname DatabaseName
+        * @return bool
+        */
        public function isSpecial( $dbname ) {
                return in_array( $dbname, $this->specials );
        }
@@ -360,6 +379,10 @@
                        $results['fishbowl'] = '';
                }
 
+               if ( $matrix->isNonGlobal( $wgDBname ) ) {
+                       $results['nonglobal'] = '';
+               }
+
                return true;
        }
 }
diff --git a/SpecialSiteMatrix.php b/SpecialSiteMatrix.php
index 921bd6c..c1c3c9f 100644
--- a/SpecialSiteMatrix.php
+++ b/SpecialSiteMatrix.php
@@ -118,6 +118,9 @@
                        if ( $matrix->isFishbowl( $lang . $site ) ) {
                                $flags[] = $this->msg( 'sitematrix-fishbowl' 
)->escaped();
                        }
+                       if ( $matrix->isNonGlobal( $lang . $site ) ) {
+                               $flags[] = $this->msg( 'sitematrix-nonglobal' 
)->escaped();
+                       }
                        $flagsStr = implode( ', ', $flags );
                        if ( $site != 'wiki' ) {
                                $langhost .= $site;
diff --git a/i18n/en.json b/i18n/en.json
index 52e8f7b..4aaec0a 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -11,11 +11,13 @@
        "sitematrix-other-projects": "Other projects",
        "sitematrix-total": "'''Total count: $1'''",
        "sitematrix-sitetotal": "Total",
-       "sitematrix-private": "private",
-       "sitematrix-fishbowl": "editing restricted",
+       "sitematrix-closed": "no write access, full read access",
+       "sitematrix-private": "read and write access restricted",
+       "sitematrix-fishbowl": "restricted write access, full read access",
+       "sitematrix-nonglobal": "public but registration required",
        "apihelp-sitematrix-description": "Get Wikimedia sites list.\n\nThe 
code (technically dbname/wikiid) is either the language code + project code for 
content projects or the subdomain + main domain for all the others.",
        "apihelp-sitematrix-param-type": "Filter the Site Matrix by 
type:\n;special:One off and multilingual Wikimedia 
projects.\n;language:Wikimedia projects under this language code.",
-       "apihelp-sitematrix-param-state": "Filter the Site Matrix by wiki 
state:\n;closed:No write access, full read access.\n;private:Read and write 
restricted.\n;fishbowl:Restricted write access, full read access.",
+       "apihelp-sitematrix-param-state": "Filter the Site Matrix by wiki 
state:",
        "apihelp-sitematrix-param-langprop": "Which information about a 
language to return.",
        "apihelp-sitematrix-param-siteprop": "Which information about a site to 
return.",
        "apihelp-sitematrix-param-limit": "Maximum number of results.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index b5dfb7e..604228f 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -22,11 +22,13 @@
        "sitematrix-other-projects": "{{Identical|Other project}}",
        "sitematrix-total": "Parameters:\n* $1 - number of databases (count of 
the array <code>$wgLocalDatabases</code>)",
        "sitematrix-sitetotal": "{{Identical|Total}}",
-       "sitematrix-private": "{{Identical|Private}}",
+       "sitematrix-closed": "Comment for wikis with no write access, but full 
read access",
+       "sitematrix-private": "Comment for wikis where read and write access 
are restricted",
        "sitematrix-fishbowl": "Comment for wikis where only some approved 
users are allowed to edit the wiki",
+       "sitematrix-nonglobal": "Comment for public wikis where registration is 
required",
        "apihelp-sitematrix-description": 
"{{doc-apihelp-description|sitematrix}}",
        "apihelp-sitematrix-param-type": "\"One off\" means a wiki with a very 
specialised or short-term 
purpose.\n----\n{{doc-apihelp-param|sitematrix|type}}",
-       "apihelp-sitematrix-param-state": 
"{{doc-apihelp-param|sitematrix|state}}\n\nDo not translate:\n closed\n 
private\n fishbowl",
+       "apihelp-sitematrix-param-state": 
"{{doc-apihelp-param|sitematrix|state}}\n;closed:{{doc-sitematrix-closed}}.\n;private:{{doc-sitematrix-private}}.\n;fishbowl:{{doc-sitematrix-fishbowl}}.\n;nonglobal:{{doc-sitematrix-nonglobal}}.\n\nDo
 not translate:\n closed\n private\n fishbowl\n nonglobal",
        "apihelp-sitematrix-param-langprop": 
"{{doc-apihelp-param|sitematrix|langprop}}",
        "apihelp-sitematrix-param-siteprop": 
"{{doc-apihelp-param|sitematrix|siteprop}}",
        "apihelp-sitematrix-param-limit": 
"{{doc-apihelp-param|sitematrix|limit}}",

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia71f4d7366763cea8b3514cad168fe4e9da8e295
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/SiteMatrix
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Arlolra <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to