From 9acd5508cfaba196d69e05538d2d86ac523782b8 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Fri, 17 Mar 2017 18:17:17 -0700 Subject: [PATCH] Drop the 'CategorizedRecentChanges' feature It is off by default, it's very rarely used (GitHub finds four config users setting it true), it has over time had fatals going unnoticed or fixed for years. Let's just kill it. Change-Id: Idac2341ed7ecf053ee84069df657e424e50b896c --- RELEASE-NOTES-1.31 | 2 + includes/CategoryFinder.php | 2 + includes/DefaultSettings.php | 5 --- includes/api/ApiFeedRecentChanges.php | 10 ----- includes/api/i18n/en.json | 2 - includes/api/i18n/qqq.json | 2 - includes/specials/SpecialRecentchanges.php | 45 +++----------------- languages/i18n/en.json | 2 - languages/i18n/qqq.json | 2 - tests/phpunit/structure/ApiStructureTest.php | 2 - 10 files changed, 9 insertions(+), 65 deletions(-) diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31 index 449751666e..32c1959d4f 100644 --- a/RELEASE-NOTES-1.31 +++ b/RELEASE-NOTES-1.31 @@ -26,6 +26,8 @@ production. default mode. * CACHE_ACCEL now only supports APC(u) or WinCache. XCache support was 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. === New features in 1.31 === * Wikimedia\Rdbms\IDatabase->select() and similar methods now support diff --git a/includes/CategoryFinder.php b/includes/CategoryFinder.php index 3561f7f586..7446b59025 100644 --- a/includes/CategoryFinder.php +++ b/includes/CategoryFinder.php @@ -42,6 +42,8 @@ use Wikimedia\Rdbms\IDatabase; * $a = $cf->run(); * print implode( ',' , $a ); * @endcode + * + * @deprecated since 1.31 */ class CategoryFinder { /** @var int[] The original article IDs passed to the seed function */ diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 5c3ac06bf1..74550c6f16 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -6953,11 +6953,6 @@ $wgShowUpdatedMarker = true; */ $wgDisableAnonTalk = false; -/** - * Enable filtering of categories in Recentchanges - */ -$wgAllowCategorizedRecentChanges = false; - /** * Allow filtering by change tag in recentchanges, history, etc * Has no effect if no tags are defined in valid_tag. diff --git a/includes/api/ApiFeedRecentChanges.php b/includes/api/ApiFeedRecentChanges.php index 2a80dd5354..e5dba8fe4a 100644 --- a/includes/api/ApiFeedRecentChanges.php +++ b/includes/api/ApiFeedRecentChanges.php @@ -169,16 +169,6 @@ class ApiFeedRecentChanges extends ApiBase { 'showlinkedto' => false, ]; - if ( $config->get( 'AllowCategorizedRecentChanges' ) ) { - $ret += [ - 'categories' => [ - ApiBase::PARAM_TYPE => 'string', - ApiBase::PARAM_ISMULTI => true, - ], - 'categories_any' => false, - ]; - } - return $ret; } diff --git a/includes/api/i18n/en.json b/includes/api/i18n/en.json index 168901971b..8d7a61c9ec 100644 --- a/includes/api/i18n/en.json +++ b/includes/api/i18n/en.json @@ -211,8 +211,6 @@ "apihelp-feedrecentchanges-param-tagfilter": "Filter by tag.", "apihelp-feedrecentchanges-param-target": "Show only changes on pages linked from this page.", "apihelp-feedrecentchanges-param-showlinkedto": "Show changes on pages linked to the selected page instead.", - "apihelp-feedrecentchanges-param-categories": "Show only changes on pages in all of these categories.", - "apihelp-feedrecentchanges-param-categories_any": "Show only changes on pages in any of the categories instead.", "apihelp-feedrecentchanges-example-simple": "Show recent changes.", "apihelp-feedrecentchanges-example-30days": "Show recent changes for 30 days.", diff --git a/includes/api/i18n/qqq.json b/includes/api/i18n/qqq.json index e76988058b..fc0de4e333 100644 --- a/includes/api/i18n/qqq.json +++ b/includes/api/i18n/qqq.json @@ -206,8 +206,6 @@ "apihelp-feedrecentchanges-param-tagfilter": "{{doc-apihelp-param|feedrecentchanges|tagfilter}}", "apihelp-feedrecentchanges-param-target": "{{doc-apihelp-param|feedrecentchanges|target}}", "apihelp-feedrecentchanges-param-showlinkedto": "{{doc-apihelp-param|feedrecentchanges|showlinkedto}}", - "apihelp-feedrecentchanges-param-categories": "{{doc-apihelp-param|feedrecentchanges|categories}}", - "apihelp-feedrecentchanges-param-categories_any": "{{doc-apihelp-param|feedrecentchanges|categories_any}}", "apihelp-feedrecentchanges-example-simple": "{{doc-apihelp-example|feedrecentchanges}}", "apihelp-feedrecentchanges-example-30days": "{{doc-apihelp-example|feedrecentchanges}}", "apihelp-feedwatchlist-summary": "{{doc-apihelp-summary|feedwatchlist}}", diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 7cc0dc6d10..4abdebf8b5 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -220,20 +220,6 @@ class SpecialRecentChanges extends ChangesListSpecialPage { } } - /** - * Get a FormOptions object containing the default options - * - * @return FormOptions - */ - public function getDefaultOptions() { - $opts = parent::getDefaultOptions(); - - $opts->add( 'categories', '' ); - $opts->add( 'categories_any', false ); - - return $opts; - } - /** * Get all custom filters * @@ -359,11 +345,6 @@ class SpecialRecentChanges extends ChangesListSpecialPage { $join_conds ); - // Build the final data - if ( $this->getConfig()->get( 'AllowCategorizedRecentChanges' ) ) { - $this->filterByCategories( $rows, $opts ); - } - return $rows; } @@ -667,16 +648,12 @@ class SpecialRecentChanges extends ChangesListSpecialPage { */ function getExtraOptions( $opts ) { $opts->consumeValues( [ - 'namespace', 'invert', 'associated', 'tagfilter', 'categories', 'categories_any' + 'namespace', 'invert', 'associated', 'tagfilter' ] ); $extraOpts = []; $extraOpts['namespace'] = $this->namespaceFilterForm( $opts ); - if ( $this->getConfig()->get( 'AllowCategorizedRecentChanges' ) ) { - $extraOpts['category'] = $this->categoryFilterForm( $opts ); - } - $tagFilter = ChangeTags::buildTagFilterSelector( $opts['tagfilter'], false, $this->getContext() ); if ( count( $tagFilter ) ) { @@ -740,29 +717,17 @@ class SpecialRecentChanges extends ChangesListSpecialPage { return [ $nsLabel, "$nsSelect $invert $associated" ]; } - /** - * Create an input to filter changes by categories - * - * @param FormOptions $opts - * @return array - */ - protected function categoryFilterForm( FormOptions $opts ) { - list( $label, $input ) = Xml::inputLabelSep( $this->msg( 'rc_categories' )->text(), - 'categories', 'mw-categories', false, $opts['categories'] ); - - $input .= ' ' . Xml::checkLabel( $this->msg( 'rc_categories_any' )->text(), - 'categories_any', 'mw-categories_any', $opts['categories_any'] ); - - return [ $label, $input ]; - } - /** * Filter $rows by categories set in $opts * + * @deprecated since 1.31 + * * @param ResultWrapper &$rows Database rows * @param FormOptions $opts */ function filterByCategories( &$rows, FormOptions $opts ) { + wfDeprecated( __METHOD__, '1.31' ); + $categories = array_map( 'trim', explode( '|', $opts['categories'] ) ); if ( !count( $categories ) ) { diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 9d06c96e67..b710762d3b 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -1523,8 +1523,6 @@ "unpatrolledletter": "!", "number_of_watching_users_RCview": "[$1]", "number_of_watching_users_pageview": "[$1 watching {{PLURAL:$1|user|users}}]", - "rc_categories": "Limit to categories (separate with \"|\"):", - "rc_categories_any": "Any of the chosen", "rc-change-size": "$1", "rc-change-size-new": "$1 {{PLURAL:$1|byte|bytes}} after change", "newsectionsummary": "/* $1 */ new section", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 1e3c25fe1d..6a071ed8f6 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -1719,8 +1719,6 @@ "unpatrolledletter": "{{optional}}\n\nUsed in {{msg-mw|Recentchanges-label-legend}}, meaning \"unpatrolled\".", "number_of_watching_users_RCview": "{{notranslate}}\nParameters:\n* $1 - number of users who are watching", "number_of_watching_users_pageview": "Used if $wgPageShowWatchingUsers is true.\n* $1 - number of watching user(s)", - "rc_categories": "A label of an input box. Appears on Special:RecentChanges if filtering recent changes by category is enabled (that is, $wgAllowCategorizedRecentChanges is set to true).", - "rc_categories_any": "Appears ''after'' the input box the label of which is {{msg-mw|rc_categories}}, which appears on [[Special:RecentChanges]], if $wgAllowCategorizedRecentChanges is true. \"Chosen\" refers to categories.", "rc-change-size": "{{optional}}\nDoes not work under $wgMiserMode ([[mwr:48986|r48986]]).\n\nParameters:\n* $1 - size of diff", "rc-change-size-new": "Tooltip when hovering a change list diff size. Parameters:\n* $1 - the resulting new size (in bytes)", "newsectionsummary": "Default summary when adding a new section to a page. Parameters:\n* $1 - section title", diff --git a/tests/phpunit/structure/ApiStructureTest.php b/tests/phpunit/structure/ApiStructureTest.php index 6d8655137f..d0126f2cf9 100644 --- a/tests/phpunit/structure/ApiStructureTest.php +++ b/tests/phpunit/structure/ApiStructureTest.php @@ -20,11 +20,9 @@ class ApiStructureTest extends MediaWikiTestCase { private static $testGlobals = [ [ 'MiserMode' => false, - 'AllowCategorizedRecentChanges' => false, ], [ 'MiserMode' => true, - 'AllowCategorizedRecentChanges' => true, ], ]; -- 2.20.1