143 if ( isset( $filterDefinition[
'group'] ) ) {
144 $this->group = $filterDefinition[
'group'];
146 throw new MWException(
'You must use \'group\' to specify the ' .
147 'ChangesListFilterGroup this filter belongs to' );
150 if ( strpos( $filterDefinition[
'name'], self::RESERVED_NAME_CHAR ) !==
false ) {
151 throw new MWException(
'Filter names may not contain \'' .
152 self::RESERVED_NAME_CHAR .
153 '\'. Use the naming convention: \
'lowercase\''
157 if ( $this->group->getFilter( $filterDefinition[
'name'] ) ) {
158 throw new MWException(
'Two filters in a group cannot have the ' .
159 "same name: '{$filterDefinition['name']}'" );
162 $this->
name = $filterDefinition[
'name'];
164 if ( isset( $filterDefinition[
'cssClassSuffix'] ) ) {
165 $this->cssClassSuffix = $filterDefinition[
'cssClassSuffix'];
166 $this->isRowApplicableCallable = $filterDefinition[
'isRowApplicableCallable'];
169 if ( isset( $filterDefinition[
'label'] ) ) {
170 $this->label = $filterDefinition[
'label'];
171 $this->description = $filterDefinition[
'description'];
174 $this->priority = $filterDefinition[
'priority'];
176 $this->group->registerFilter( $this );
193 public function conflictsWith( $other, $globalKey, $forwardKey, $backwardKey ) {
194 if ( $globalKey ===
null || $forwardKey ===
null || $backwardKey ===
null ) {
195 throw new MWException(
'All messages must be specified' );
204 $other->setUnidirectionalConflict(
224 $this->conflictingGroups[] = [
225 'group' => $other->getName(),
226 'groupObject' => $other,
227 'globalDescription' => $globalDescription,
228 'contextDescription' => $contextDescription,
231 $this->conflictingFilters[] = [
232 'group' => $other->getGroup()->getName(),
233 'filter' => $other->getName(),
234 'filterObject' => $other,
235 'globalDescription' => $globalDescription,
236 'contextDescription' => $contextDescription,
239 throw new MWException(
'You can only pass in a ChangesListFilterGroup or a ChangesListFilter' );
253 if ( $other->
getGroup() !== $this->getGroup() ) {
254 throw new MWException(
'Supersets can only be defined for filters in the same group' );
257 $this->subsetFilters[] = [
260 'group' => $other->
getGroup()->getName(),
307 return $this->label !==
null;
334 if ( $this->cssClassSuffix !==
null ) {
349 if ( $this->isRowApplicableCallable ===
null ) {
353 if ( call_user_func( $this->isRowApplicableCallable, $ctx, $rc ) ) {
382 $conflicts = array_merge(
383 $this->conflictingGroups,
384 $this->conflictingFilters
387 foreach ( $conflicts
as $conflictInfo ) {
388 unset( $conflictInfo[
'filterObject'] );
389 unset( $conflictInfo[
'groupObject'] );
390 $output[
'conflicts'][] = $conflictInfo;
393 $conflictInfo[
'globalDescription'],
394 $conflictInfo[
'contextDescription']
416 function ( $conflictDesc ) {
417 return $conflictDesc[
'groupObject' ];
430 function ( $conflictDesc ) {
431 return $conflictDesc[
'filterObject' ];
445 if (
$group->anySelected( $opts ) && $this->isSelected( $opts ) ) {
448 if ( $siblingFilter->isSelected( $opts ) && !$siblingFilter->hasConflictWithGroup(
$group ) ) {
473 $siblingFilter->isSelected( $opts ) &&
474 !$siblingFilter->hasConflictWithFilter( $filter )
496 function ( $filter ) {
497 return $filter !== $this;
Represents a filter group (used on ChangesListSpecialPage and descendants)
Represents a filter (used on ChangesListSpecialPage and descendants)
displaysOnUnstructuredUi()
Checks whether the filter should display on the unstructured UI.
$cssClassSuffix
CSS class suffix used for attribution, e.g.
getConflictingFilters()
Get filters conflicting with this filter.
getJsData()
Gets the JS data required by the front-end of the structured UI.
activelyInConflictWithGroup(ChangesListFilterGroup $group, FormOptions $opts)
Check if the conflict with a group is currently "active".
$conflictingGroups
Array of associative arrays with conflict information.
$conflictingFilters
Array of associative arrays with conflict information.
displaysOnStructuredUi()
Checks whether the filter should display on the structured UI This refers to the exact filter.
$label
i18n key of label for structured UI
setUnidirectionalConflict( $other, $globalDescription, $contextDescription)
Marks that the given ChangesListFilterGroup or ChangesListFilter conflicts with this object.
isFeatureAvailableOnStructuredUi()
Checks whether an equivalent feature for this filter is available on the structured UI.
applyCssClassIfNeeded(IContextSource $ctx, RecentChange $rc, array &$classes)
Add CSS class if needed.
setAsSupersetOf(ChangesListFilter $other)
Marks that the current instance is (also) a superset of the filter passed in.
$priority
Priority integer.
__construct(array $filterDefinition)
Creates a new filter with the specified configuration, and registers it to the specified group.
hasConflictWithGroup(ChangesListFilterGroup $group)
$subsetFilters
Array of associative arrays with subset information.
isSelected(FormOptions $opts)
Checks whether this filter is selected in the provided options.
setDefaultHighlightColor( $defaultHighlightColor)
$description
i18n key of description for structured UI
getConflictingGroups()
Get groups conflicting with this filter.
hasConflictWithFilter(ChangesListFilter $filter)
getCssClass()
Gets the CSS class.
getSiblings()
Get filters in the same group.
activelyInConflictWithFilter(ChangesListFilter $filter, FormOptions $opts)
Check if the conflict with a filter is currently "active".
$isRowApplicableCallable
Callable that returns true if and only if a row is attributed to this filter.
conflictsWith( $other, $globalKey, $forwardKey, $backwardKey)
Marks that the given ChangesListFilterGroup or ChangesListFilter conflicts with this object.
Utility class for creating new RC entries.
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
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
Interface for objects which can provide a MediaWiki context on request.
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))