156 if ( strpos( $groupDefinition[
'name'], self::RESERVED_NAME_CHAR ) !==
false ) {
157 throw new MWException(
'Group names may not contain \'' .
158 self::RESERVED_NAME_CHAR .
159 '\'. Use the naming convention: \
'camelCase\''
163 $this->
name = $groupDefinition[
'name'];
165 if ( isset( $groupDefinition[
'title'] ) ) {
166 $this->
title = $groupDefinition[
'title'];
169 if ( isset( $groupDefinition[
'whatsThisHeader'] ) ) {
170 $this->whatsThisHeader = $groupDefinition[
'whatsThisHeader'];
171 $this->whatsThisBody = $groupDefinition[
'whatsThisBody'];
172 $this->whatsThisUrl = $groupDefinition[
'whatsThisUrl'];
173 $this->whatsThisLinkText = $groupDefinition[
'whatsThisLinkText'];
176 $this->
type = $groupDefinition[
'type'];
179 $this->isFullCoverage = $groupDefinition[
'isFullCoverage'];
182 $lowestSpecifiedPriority = -1;
183 foreach ( $groupDefinition[
'filters']
as $filterDefinition ) {
184 if ( isset( $filterDefinition[
'priority'] ) ) {
185 $lowestSpecifiedPriority = min( $lowestSpecifiedPriority, $filterDefinition[
'priority'] );
193 $autoFillPriority = $lowestSpecifiedPriority - 1;
194 foreach ( $groupDefinition[
'filters']
as $filterDefinition ) {
195 if ( !isset( $filterDefinition[
'priority'] ) ) {
196 $filterDefinition[
'priority'] = $autoFillPriority;
199 $filterDefinition[
'group'] = $this;
202 $this->registerFilter(
$filter );
228 public function conflictsWith( $other, $globalKey, $forwardKey, $backwardKey ) {
229 if ( $globalKey ===
null || $forwardKey ===
null || $backwardKey ===
null ) {
230 throw new MWException(
'All messages must be specified' );
239 $other->setUnidirectionalConflict(
259 $this->conflictingGroups[] = [
260 'group' => $other->getName(),
261 'groupObject' => $other,
262 'globalDescription' => $globalDescription,
263 'contextDescription' => $contextDescription,
266 $this->conflictingFilters[] = [
267 'group' => $other->getGroup()->getName(),
268 'filter' => $other->getName(),
269 'filterObject' => $other,
270 'globalDescription' => $globalDescription,
271 'contextDescription' => $contextDescription,
274 throw new MWException(
'You can only pass in a ChangesListFilterGroup or a ChangesListFilter' );
321 return $this->filters[
$name] ??
null;
342 if ( isset( $this->whatsThisHeader ) ) {
356 usort( $this->filters,
function ( $a, $b ) {
357 return $b->getPriority() <=> $a->getPriority();
360 foreach ( $this->filters
as $filterName =>
$filter ) {
361 if (
$filter->displaysOnStructuredUi() ) {
362 $filterData =
$filter->getJsData();
363 $output[
'messageKeys'] = array_merge(
365 $filterData[
'messageKeys']
367 unset( $filterData[
'messageKeys'] );
368 $output[
'filters'][] = $filterData;
372 if ( count(
$output[
'filters'] ) === 0 ) {
378 $conflicts = array_merge(
379 $this->conflictingGroups,
380 $this->conflictingFilters
383 foreach ( $conflicts
as $conflictInfo ) {
384 unset( $conflictInfo[
'filterObject'] );
385 unset( $conflictInfo[
'groupObject'] );
386 $output[
'conflicts'][] = $conflictInfo;
389 $conflictInfo[
'globalDescription'],
390 $conflictInfo[
'contextDescription']
404 function ( $conflictDesc ) {
405 return $conflictDesc[
'groupObject' ];
418 function ( $conflictDesc ) {
419 return $conflictDesc[
'filterObject' ];
432 return (
bool)count( array_filter(
435 return $filter->isSelected( $opts );
457 &
$tables, &$fields, &$conds, &$query_options, &$join_conds,
468 $isStructuredFiltersEnabled );
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
Represents a filter group (used on ChangesListSpecialPage and descendants)
$filters
Associative array of filters, as ChangesListFilter objects, with filter name as key.
$name
Name (internal identifier)
$whatsThisBody
i18n key for body of What's This?
anySelected(FormOptions $opts)
Check if any filter in this group is selected.
$whatsThisUrl
URL of What's This? link.
$isFullCoverage
Whether this group is full coverage.
modifyQuery(IDatabase $dbr, ChangesListSpecialPage $specialPage, &$tables, &$fields, &$conds, &$query_options, &$join_conds, FormOptions $opts, $isStructuredFiltersEnabled)
Modifies the query to include the filter group.
getFilter( $name)
Get filter by name.
$priority
Priority integer.
getConflictingGroups()
Get groups conflicting with this filter group.
$conflictingFilters
Array of associative arrays with conflict information.
getJsData()
Gets the JS data in the format required by the front-end of the structured UI.
__construct(array $groupDefinition)
Create a new filter group with the specified configuration.
$whatsThisHeader
i18n key for header of What's This?
addOptions(FormOptions $opts, $allowDefaults, $isStructuredFiltersEnabled)
All the options represented by this filter group to $opts.
getConflictingFilters()
Get filters conflicting with this filter group.
$conflictingGroups
Array of associative arrays with conflict information.
setUnidirectionalConflict( $other, $globalDescription, $contextDescription)
Marks that the given ChangesListFilterGroup or ChangesListFilter conflicts with this object.
createFilter(array $filterDefinition)
Creates a filter of the appropriate type for this group, from the definition.
$type
Type, from a TYPE constant of a subclass.
conflictsWith( $other, $globalKey, $forwardKey, $backwardKey)
Marks that the given ChangesListFilterGroup or ChangesListFilter conflicts with this object.
$whatsThisLinkText
i18n key for What's This? link
Represents a filter (used on ChangesListSpecialPage and descendants)
Special page which uses a ChangesList to show query results.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
this hook is for auditing only RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist & $tables
and how to run hooks for an and one after Each event has a name
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place $output
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type