Page MenuHomePhabricator

diff.patch

Authored By
bzimport
Nov 21 2014, 11:14 PM
Size
2 KB
Referenced Files
None
Subscribers
None

diff.patch

Index: includes/Article.php
===================================================================
--- includes/Article.php (revision 82816)
+++ includes/Article.php (working copy)
@@ -647,11 +647,19 @@
* @return bool
*/
public function isCountable( $text ) {
- global $wgUseCommaCount;
+ global $wgArticleCountMethod;
- $token = $wgUseCommaCount ? ',' : '[[';
+ $isContent = $this->mTitle->isContentPage() && !$this->isRedirect( $text );
- return $this->mTitle->isContentPage() && !$this->isRedirect( $text ) && in_string( $token, $text );
+ switch ( $wgArticleCountMethod ) {
+ case 'any':
+ return $isContent;
+ case 'comma':
+ return $isContent && in_string( ',', $text );
+ case 'link':
+ default:
+ return $isContent && in_string( '[[', $text );
+ }
}
/**
Index: includes/Setup.php
===================================================================
--- includes/Setup.php (revision 82816)
+++ includes/Setup.php (working copy)
@@ -258,6 +258,11 @@
$wgAjaxExportList[] = 'SpecialUpload::ajaxGetExistsWarning';
}
+# Back-compatability for pre 1.18
+if ( $wgUseCommaCount ) {
+ $wgArticleCountMethod = 'comma';
+}
+
if ( $wgNewUserLog ) {
# Add a new log type
$wgLogTypes[] = 'newusers';
Index: includes/DefaultSettings.php
===================================================================
--- includes/DefaultSettings.php (revision 82816)
+++ includes/DefaultSettings.php (working copy)
@@ -2886,14 +2886,18 @@
/**
* Under which condition should a page in the main namespace be counted
- * as a valid article? If $wgUseCommaCount is set to true, it will be
- * counted if it contains at least one comma. If it is set to false
+ * as a valid article? If $wgArticleCountMethod is set to 'comma', it will be
+ * counted if it contains at least one comma. If it is set to 'link'
* (default), it will only be counted if it contains at least one [[wiki
- * link]]. See http://www.mediawiki.org/wiki/Manual:Article_count
+ * link]]. If set to 'any', will count any non-redirect in content namespace.
+ * See http://www.mediawiki.org/wiki/Manual:Article_count
*
* Retroactively changing this variable will not affect
* the existing count (cf. maintenance/recount.sql).
*/
+$wgArticleCountMethod = 'link';
+
+/** Back-compatability. Overides $wgArticleCountMethod if set to true. */
$wgUseCommaCount = false;
/**

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6627
Default Alt Text
diff.patch (2 KB)

Event Timeline