Merge "Drop 'comma' value for wgArticleCountMethod"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 3 Mar 2018 23:06:23 +0000 (23:06 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 3 Mar 2018 23:06:23 +0000 (23:06 +0000)
RELEASE-NOTES-1.31
includes/DefaultSettings.php
includes/SiteStatsInit.php
includes/content/WikitextContent.php
tests/phpunit/includes/content/JavaScriptContentTest.php
tests/phpunit/includes/content/TextContentTest.php
tests/phpunit/includes/content/WikitextContentTest.php
tests/phpunit/includes/page/WikiPageDbTestBase.php
tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js

index 0c4bc68..5e9ce8b 100644 (file)
@@ -28,6 +28,9 @@ production.
   as upstream is inactive and has no plans to move to PHP 7.
 * The old CategorizedRecentChanges feature, including its related configuration
   option $wgAllowCategorizedRecentChanges, has been removed.
+* (T188472) The 'comma' value for $wgArticleCountMethod is no longer supported for
+  performance reasons, and installations with this setting will now work as if it
+  was configured with 'any'.
 
 === New features in 1.31 ===
 * Wikimedia\Rdbms\IDatabase->select() and similar methods now support
index 33418d8..e4da637 100644 (file)
@@ -4438,7 +4438,6 @@ $wgEnableMagicLinks = [
  *
  * This variable can have the following values:
  * - 'any': all pages as considered as valid articles
- * - 'comma': the page must contain a comma to be considered valid
  * - 'link': the page must contain a [[wiki link]] to be considered valid
  *
  * See also See https://www.mediawiki.org/wiki/Manual:Article_count
index f527cb2..8adb218 100644 (file)
@@ -79,13 +79,6 @@ class SiteStatsInit {
                if ( $config->get( 'ArticleCountMethod' ) == 'link' ) {
                        $tables[] = 'pagelinks';
                        $conds[] = 'pl_from=page_id';
-               } elseif ( $config->get( 'ArticleCountMethod' ) == 'comma' ) {
-                       // To make a correct check for this, we would need, for each page,
-                       // to load the text, maybe uncompress it, maybe decode it and then
-                       // check if there's one comma.
-                       // But one thing we are sure is that if the page is empty, it can't
-                       // contain a comma :)
-                       $conds[] = 'page_len > 0';
                }
 
                $this->articles = $this->dbr->selectField(
index bc20aa0..5beef31 100644 (file)
@@ -270,28 +270,22 @@ class WikitextContent extends TextContent {
                        return false;
                }
 
-               switch ( $wgArticleCountMethod ) {
-                       case 'any':
-                               return true;
-                       case 'comma':
-                               $text = $this->getNativeData();
-                               return strpos( $text, ',' ) !== false;
-                       case 'link':
-                               if ( $hasLinks === null ) { # not known, find out
-                                       if ( !$title ) {
-                                               $context = RequestContext::getMain();
-                                               $title = $context->getTitle();
-                                       }
-
-                                       $po = $this->getParserOutput( $title, null, null, false );
-                                       $links = $po->getLinks();
-                                       $hasLinks = !empty( $links );
+               if ( $wgArticleCountMethod === 'link' ) {
+                       if ( $hasLinks === null ) { # not known, find out
+                               if ( !$title ) {
+                                       $context = RequestContext::getMain();
+                                       $title = $context->getTitle();
                                }
 
-                               return $hasLinks;
+                               $po = $this->getParserOutput( $title, null, null, false );
+                               $links = $po->getLinks();
+                               $hasLinks = !empty( $links );
+                       }
+
+                       return $hasLinks;
                }
 
-               return false;
+               return true;
        }
 
        /**
index 6656fa4..823be6f 100644 (file)
@@ -153,16 +153,6 @@ class JavaScriptContentTest extends TextContentTest {
                                'any',
                                true
                        ],
-                       [ 'Foo',
-                               null,
-                               'comma',
-                               false
-                       ],
-                       [ 'Foo, bar',
-                               null,
-                               'comma',
-                               false
-                       ],
                        [ 'Foo',
                                null,
                                'link',
@@ -188,11 +178,6 @@ class JavaScriptContentTest extends TextContentTest {
                                'any',
                                true
                        ],
-                       [ '#REDIRECT [[bar]]',
-                               true,
-                               'comma',
-                               false
-                       ],
                        [ '#REDIRECT [[bar]]',
                                true,
                                'link',
index b548091..406bc96 100644 (file)
@@ -197,16 +197,6 @@ class TextContentTest extends MediaWikiLangTestCase {
                                'any',
                                true
                        ],
-                       [ 'Foo',
-                               null,
-                               'comma',
-                               false
-                       ],
-                       [ 'Foo, bar',
-                               null,
-                               'comma',
-                               false
-                       ],
                ];
        }
 
index e04f562..1db6aab 100644 (file)
@@ -266,16 +266,6 @@ just a test"
                                'any',
                                true
                        ],
-                       [ 'Foo',
-                               null,
-                               'comma',
-                               false
-                       ],
-                       [ 'Foo, bar',
-                               null,
-                               'comma',
-                               true
-                       ],
                        [ 'Foo',
                                null,
                                'link',
@@ -301,11 +291,6 @@ just a test"
                                'any',
                                false
                        ],
-                       [ '#REDIRECT [[bar]]',
-                               true,
-                               'comma',
-                               false
-                       ],
                        [ '#REDIRECT [[bar]]',
                                true,
                                'link',
index 7adc43b..6367a0f 100644 (file)
@@ -374,20 +374,6 @@ abstract class WikiPageDbTestBase extends MediaWikiLangTestCase {
                                true
                        ],
 
-                       // comma
-                       [ 'WikiPageTest_testIsCountable',
-                               CONTENT_MODEL_WIKITEXT,
-                               'Foo',
-                               'comma',
-                               false
-                       ],
-                       [ 'WikiPageTest_testIsCountable',
-                               CONTENT_MODEL_WIKITEXT,
-                               'Foo, bar',
-                               'comma',
-                               true
-                       ],
-
                        // link
                        [ 'WikiPageTest_testIsCountable',
                                CONTENT_MODEL_WIKITEXT,
@@ -409,12 +395,6 @@ abstract class WikiPageDbTestBase extends MediaWikiLangTestCase {
                                'any',
                                false
                        ],
-                       [ 'WikiPageTest_testIsCountable',
-                               CONTENT_MODEL_WIKITEXT,
-                               '#REDIRECT [[bar]]',
-                               'comma',
-                               false
-                       ],
                        [ 'WikiPageTest_testIsCountable',
                                CONTENT_MODEL_WIKITEXT,
                                '#REDIRECT [[bar]]',
@@ -429,12 +409,6 @@ abstract class WikiPageDbTestBase extends MediaWikiLangTestCase {
                                'any',
                                false
                        ],
-                       [ 'Talk:WikiPageTest_testIsCountable',
-                               CONTENT_MODEL_WIKITEXT,
-                               'Foo, bar',
-                               'comma',
-                               false
-                       ],
                        [ 'Talk:WikiPageTest_testIsCountable',
                                CONTENT_MODEL_WIKITEXT,
                                'Foo [[bar]]',
@@ -449,12 +423,6 @@ abstract class WikiPageDbTestBase extends MediaWikiLangTestCase {
                                'any',
                                false
                        ],
-                       [ 'MediaWiki:WikiPageTest_testIsCountable.js',
-                               null,
-                               'Foo, bar',
-                               'comma',
-                               false
-                       ],
                        [ 'MediaWiki:WikiPageTest_testIsCountable.js',
                                null,
                                'Foo [[bar]]',
index 1db8c61..23ef26f 100644 (file)
                        [ '$ 1.50' ],
                        [ '$ 3.00' ],
                        [ '$3.50' ],
-                       // Comma's sort after dots
+                       // Commas sort after dots
                        // Not intentional but test to detect changes
                        [ '€ 2,99' ]
                ],