Arlolra has uploaded a new change for review.

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

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, 41 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SiteMatrix 
refs/changes/86/231086/1

diff --git a/SiteMatrixApi.php b/SiteMatrixApi.php
index 50114e7..a507742 100644
--- a/SiteMatrixApi.php
+++ b/SiteMatrixApi.php
@@ -43,6 +43,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' ) 
{
@@ -144,6 +145,13 @@
                                                $skip = false;
                                        }
                                }
+                               if ( $matrix->isNonGlobal( $lang . $site ) ) {
+                                       $wiki['nonglobal'] = '';
+
+                                       if ( $nonglobal ) {
+                                               $skip = false;
+                                       }
+                               }
                                if ( $matrix->isClosed( $lang, $site ) ) {
                                        $wiki['closed'] = '';
 
@@ -187,7 +195,8 @@
                                        'all',
                                        'closed',
                                        'private',
-                                       'fishbowl'
+                                       'fishbowl',
+                                       'nonglobal',
                                ),
                                ApiBase::PARAM_DFLT => 'all',
                        ),
@@ -240,6 +249,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 7d4bdc4..c88f272 100644
--- a/SiteMatrix_body.php
+++ b/SiteMatrix_body.php
@@ -23,6 +23,11 @@
         */
        protected $closed = null;
 
+       /**
+        * @var array|null
+        */
+       protected $nonglobal = null;
+
        protected $specials, $matrix, $count, $countPerSite;
 
        public function __construct() {
@@ -304,6 +309,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 );
        }
@@ -365,6 +384,10 @@
                        $results['fishbowl'] = '';
                }
 
+               if ( $matrix->isNonGlobal( $wgDBname ) ) {
+                       $results['nonglobal'] = '';
+               }
+
                return true;
        }
 }
diff --git a/SpecialSiteMatrix.php b/SpecialSiteMatrix.php
index 9a3dc88..982c5f7 100644
--- a/SpecialSiteMatrix.php
+++ b/SpecialSiteMatrix.php
@@ -129,6 +129,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..3f8b132 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -13,9 +13,10 @@
        "sitematrix-sitetotal": "Total",
        "sitematrix-private": "private",
        "sitematrix-fishbowl": "editing restricted",
+       "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:\n;closed:No write access, full read access.\n;private:Read and write 
restricted.\n;fishbowl:Restricted write access, full read 
access.\n;nonglobal:Public but registration required.",
        "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..668c9f3 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -24,9 +24,10 @@
        "sitematrix-sitetotal": "{{Identical|Total}}",
        "sitematrix-private": "{{Identical|Private}}",
        "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\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: newchange
Gerrit-Change-Id: Ia71f4d7366763cea8b3514cad168fe4e9da8e295
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SiteMatrix
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>

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

Reply via email to