We have three methods for page counting currently supported for wikitext
non-redirect pages; 'any' counts any page that exists, 'link' counts any
page that has any outbound links, and 'comma' which searches for any ','
in the text having loaded it. This last option is much slower than these
other two, and is only used on a very small number of installations. Now
by dropping support for this method we can simplify this code and so run
it more often. Note that non-wikitext pages already did not support this
count method.
Installations with this setting set to 'comma', or any other string will
now work as if it was configured with 'any'.
Bug: T188472
Change-Id: I965927edcd2485ec4b49b2d80fdf216dbf19520b
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.
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
=== New features in 1.31 ===
* Wikimedia\Rdbms\IDatabase->select() and similar methods now support
*
* This variable can have the following values:
* - 'any': all pages as considered as valid articles
*
* 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
* - 'link': the page must contain a [[wiki link]] to be considered valid
*
* See also See https://www.mediawiki.org/wiki/Manual:Article_count
if ( $config->get( 'ArticleCountMethod' ) == 'link' ) {
$tables[] = 'pagelinks';
$conds[] = 'pl_from=page_id';
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(
}
$this->articles = $this->dbr->selectField(
- 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();
+ $po = $this->getParserOutput( $title, null, null, false );
+ $links = $po->getLinks();
+ $hasLinks = !empty( $links );
+ }
+
+ return $hasLinks;
- [ 'Foo',
- null,
- 'comma',
- false
- ],
- [ 'Foo, bar',
- null,
- 'comma',
- false
- ],
- [ '#REDIRECT [[bar]]',
- true,
- 'comma',
- false
- ],
[ '#REDIRECT [[bar]]',
true,
'link',
[ '#REDIRECT [[bar]]',
true,
'link',
- [ 'Foo',
- null,
- 'comma',
- false
- ],
- [ 'Foo, bar',
- null,
- 'comma',
- false
- ],
- [ 'Foo',
- null,
- 'comma',
- false
- ],
- [ 'Foo, bar',
- null,
- 'comma',
- true
- ],
- [ '#REDIRECT [[bar]]',
- true,
- 'comma',
- false
- ],
[ '#REDIRECT [[bar]]',
true,
'link',
[ '#REDIRECT [[bar]]',
true,
'link',
- // comma
- [ 'WikiPageTest_testIsCountable',
- CONTENT_MODEL_WIKITEXT,
- 'Foo',
- 'comma',
- false
- ],
- [ 'WikiPageTest_testIsCountable',
- CONTENT_MODEL_WIKITEXT,
- 'Foo, bar',
- 'comma',
- true
- ],
-
// link
[ 'WikiPageTest_testIsCountable',
CONTENT_MODEL_WIKITEXT,
// link
[ 'WikiPageTest_testIsCountable',
CONTENT_MODEL_WIKITEXT,
- [ 'WikiPageTest_testIsCountable',
- CONTENT_MODEL_WIKITEXT,
- '#REDIRECT [[bar]]',
- 'comma',
- false
- ],
[ 'WikiPageTest_testIsCountable',
CONTENT_MODEL_WIKITEXT,
'#REDIRECT [[bar]]',
[ 'WikiPageTest_testIsCountable',
CONTENT_MODEL_WIKITEXT,
'#REDIRECT [[bar]]',
- [ 'Talk:WikiPageTest_testIsCountable',
- CONTENT_MODEL_WIKITEXT,
- 'Foo, bar',
- 'comma',
- false
- ],
[ 'Talk:WikiPageTest_testIsCountable',
CONTENT_MODEL_WIKITEXT,
'Foo [[bar]]',
[ 'Talk:WikiPageTest_testIsCountable',
CONTENT_MODEL_WIKITEXT,
'Foo [[bar]]',
- [ 'MediaWiki:WikiPageTest_testIsCountable.js',
- null,
- 'Foo, bar',
- 'comma',
- false
- ],
[ 'MediaWiki:WikiPageTest_testIsCountable.js',
null,
'Foo [[bar]]',
[ 'MediaWiki:WikiPageTest_testIsCountable.js',
null,
'Foo [[bar]]',
[ '$ 1.50' ],
[ '$ 3.00' ],
[ '$3.50' ],
[ '$ 1.50' ],
[ '$ 3.00' ],
[ '$3.50' ],
- // Comma's sort after dots
+ // Commas sort after dots
// Not intentional but test to detect changes
[ '€ 2,99' ]
],
// Not intentional but test to detect changes
[ '€ 2,99' ]
],