* 'uppercase-se' (NorthernSamiUppercaseCollation) - use 'uca-se' instead
* 'xx-uca-et' (CollationEt) - use 'uca-et' instead
* 'xx-uca-fa' (CollationFa) - use 'uca-fa' instead
+* The hooks 'SpecialRecentChangesFilters' & 'SpecialWatchlistFilters' deprecated
+ in 1.23 were removed. Instead, use 'ChangesListSpecialPageStructuredFilters'.
+ The ChangesListSpecialPage code for these legacy hooks, and their use in
+ SpecialRecentchanges.php and SpecialWatchlist, was also removed:
+ * ChangesListSpecialPage->getCustomFilters()
+ * ChangesListSpecialPage->getFilterGroupDefinitionFromLegacyCustomFilters()
+ * ChangesListSpecialPage::customFilters
=== Deprecations in 1.32 ===
* HTMLForm::setSubmitProgressive() is deprecated. No need to call it. Submit
&$title: If the hook returns false, a Title object to use instead of the
result from the normal query
-'SpecialRecentChangesFilters': DEPRECATED since 1.23! Use
-ChangesListSpecialPageStructuredFilters instead.
-Called after building form options at RecentChanges.
-$special: the special page object
-&$filters: associative array of filter definitions. The keys are the HTML
- name/URL parameters. Each key maps to an associative array with a 'msg'
- (message key) and a 'default' value.
-
'SpecialRecentChangesPanel': Called when building form options in
SpecialRecentChanges.
&$extraOpts: array of added items, to which can be added
$wgVersion: Current $wgVersion for you to use
&$versionUrl: Raw url to link to (eg: release notes)
-'SpecialWatchlistFilters': DEPRECATED since 1.23! Use
-ChangesListSpecialPageStructuredFilters instead.
-Called after building form options at Watchlist.
-$special: the special page object
-&$filters: associative array of filter definitions. The keys are the HTML
- name/URL parameters. Each key maps to an associative array with a 'msg'
- (message key) and a 'default' value.
-
'SpecialWatchlistGetNonRevisionTypes': Called when building sql query for
SpecialWatchlist. Allows extensions to register custom values they have
inserted to rc_type so they can be returned as part of the watchlist.
* @since 1.29
*/
class ChangesListBooleanFilter extends ChangesListFilter {
- // This can sometimes be different on Special:RecentChanges
- // and Special:Watchlist, due to the double-legacy hooks
- // (SpecialRecentChangesFilters and SpecialWatchlistFilters)
-
- // but there will be separate sets of ChangesListFilterGroup and ChangesListFilter instances
- // for those pages (it should work even if they're both loaded
- // at once, but that can't happen).
/**
* Main unstructured UI i18n key
*
/** @var FormOptions */
protected $rcOptions;
- /** @var array */
- protected $customFilters;
-
// Order of both groups and filters is significant; first is top-most priority,
// descending from there.
// 'showHideSuffix' is a shortcut to and avoid spelling out
*
* Groups are displayed to the user in the structured UI. However, if necessary,
* all of the filters in a group can be configured to only display on the
- * unstuctured UI, in which case you don't need a group title. This is done in
- * getFilterGroupDefinitionFromLegacyCustomFilters, for example.
+ * unstuctured UI, in which case you don't need a group title.
*
* @var array $filterGroupDefinitions
*/
Hooks::run( 'ChangesListSpecialPageStructuredFilters', [ $this ] );
- $unstructuredGroupDefinition =
- $this->getFilterGroupDefinitionFromLegacyCustomFilters(
- $this->getCustomFilters()
- );
- $this->registerFiltersFromDefinitions( [ $unstructuredGroupDefinition ] );
+ $this->registerFiltersFromDefinitions( [] );
$userExperienceLevel = $this->getFilterGroup( 'userExpLevel' );
$registered = $userExperienceLevel->getFilter( 'registered' );
}
}
- /**
- * Get filter group definition from legacy custom filters
- *
- * @param array $customFilters Custom filters from legacy hooks
- * @return array Group definition
- */
- protected function getFilterGroupDefinitionFromLegacyCustomFilters( array $customFilters ) {
- // Special internal unstructured group
- $unstructuredGroupDefinition = [
- 'name' => 'unstructured',
- 'class' => ChangesListBooleanFilterGroup::class,
- 'priority' => -1, // Won't display in structured
- 'filters' => [],
- ];
-
- foreach ( $customFilters as $name => $params ) {
- $unstructuredGroupDefinition['filters'][] = [
- 'name' => $name,
- 'showHide' => $params['msg'],
- 'default' => $params['default'],
- ];
- }
-
- return $unstructuredGroupDefinition;
- }
-
/**
* @return array The legacy show/hide toggle filters
*/
return $output;
}
- /**
- * Get custom show/hide filters using deprecated ChangesListSpecialPageFilters
- * hook.
- *
- * @return array Map of filter URL param names to properties (msg/default)
- */
- protected function getCustomFilters() {
- if ( $this->customFilters === null ) {
- $this->customFilters = [];
- Hooks::run( 'ChangesListSpecialPageFilters', [ $this, &$this->customFilters ], '1.29' );
- }
-
- return $this->customFilters;
- }
-
/**
* Fetch values for a FormOptions object from the WebRequest associated with this instance.
*
}
}
- /**
- * Get all custom filters
- *
- * @return array Map of filter URL param names to properties (msg/default)
- */
- protected function getCustomFilters() {
- if ( $this->customFilters === null ) {
- $this->customFilters = parent::getCustomFilters();
- Hooks::run( 'SpecialRecentChangesFilters', [ $this, &$this->customFilters ], '1.23' );
- }
-
- return $this->customFilters;
- }
-
/**
* Process $par and put options found in $opts. Used when including the page.
*
}
}
- /**
- * Get all custom filters
- *
- * @return array Map of filter URL param names to properties (msg/default)
- */
- protected function getCustomFilters() {
- if ( $this->customFilters === null ) {
- $this->customFilters = parent::getCustomFilters();
- Hooks::run( 'SpecialWatchlistFilters', [ $this, &$this->customFilters ], '1.23' );
- }
-
- return $this->customFilters;
- }
-
/**
* Fetch values for a FormOptions object from the WebRequest associated with this instance.
*
return $now - $days * $secondsPerDay;
}
- public function testGetFilterGroupDefinitionFromLegacyCustomFilters() {
- $customFilters = [
- 'hidefoo' => [
- 'msg' => 'showhidefoo',
- 'default' => true,
- ],
-
- 'hidebar' => [
- 'msg' => 'showhidebar',
- 'default' => false,
- ],
- ];
-
- $this->assertEquals(
- [
- 'name' => 'unstructured',
- 'class' => ChangesListBooleanFilterGroup::class,
- 'priority' => -1,
- 'filters' => [
- [
- 'name' => 'hidefoo',
- 'showHide' => 'showhidefoo',
- 'default' => true,
- ],
- [
- 'name' => 'hidebar',
- 'showHide' => 'showhidebar',
- 'default' => false,
- ]
- ],
- ],
- $this->changesListSpecialPage->getFilterGroupDefinitionFromLegacyCustomFilters(
- $customFilters
- )
- );
- }
-
public function testGetStructuredFilterJsData() {
$this->changesListSpecialPage->filterGroups = [];