36 'mw-contentmodelchange',
38 'mw-removed-redirect',
39 'mw-changed-redirect-target',
58 wfWarn(
'wgSoftwareTags should be associative array of enabled tags.
59 Please refer to documentation for the list of tags you can enable' );
63 $availableSoftwareTags = !$all ?
67 $softwareTags = array_intersect(
68 $availableSoftwareTags,
69 self::$definedSoftwareTags
98 $tags = explode(
',', $tags );
100 foreach ( $tags as $tag ) {
105 if ( $description ===
false ) {
108 $displayTags[] = Xml::tags(
110 [
'class' =>
'mw-tag-marker ' .
111 Sanitizer::escapeClass(
"mw-tag-marker-$tag" ) ],
114 $classes[] = Sanitizer::escapeClass(
"mw-tag-$tag" );
117 if ( !$displayTags ) {
121 $markers =
$context->msg(
'tag-list-wrapper' )
122 ->numParams( count( $displayTags ) )
123 ->rawParams(
$context->getLanguage()->commaList( $displayTags ) )
125 $markers = Xml::tags(
'span', [
'class' =>
'mw-tag-markers' ], $markers );
127 return [ $markers, $classes ];
145 if ( !$msg->exists() ) {
147 return htmlspecialchars( $tag );
149 if ( $msg->isDisabled() ) {
155 return $msg->parse();
171 $msg =
$context->msg(
"tag-$tag-description" );
172 if ( !$msg->exists() ) {
175 if ( $msg->isDisabled() ) {
196 if ( !$originalDesc ) {
200 $taglessDesc = Sanitizer::stripAllTags( $originalDesc->parse() );
201 $escapedDesc = Sanitizer::escapeHtmlAllowEntities( $taglessDesc );
203 return $context->getLanguage()->truncateForVisual( $escapedDesc, $length );
220 public static function addTags( $tags, $rc_id =
null, $rev_id =
null,
224 return (
bool)$result[0];
257 public static function updateTags( $tagsToAdd, $tagsToRemove, &$rc_id =
null,
261 $tagsToAdd = array_filter( (array)$tagsToAdd );
262 $tagsToRemove = array_filter( (array)$tagsToRemove );
264 if ( !$rc_id && !$rev_id && !$log_id ) {
265 throw new MWException(
'At least one of: RCID, revision ID, and log ID MUST be ' .
266 'specified when adding or removing a tag from a change!' );
277 $rc_id = $dbw->selectField(
278 [
'logging',
'recentchanges' ],
282 'rc_timestamp = log_timestamp',
287 } elseif ( $rev_id ) {
288 $rc_id = $dbw->selectField(
289 [
'revision',
'recentchanges' ],
293 'rc_timestamp = rev_timestamp',
294 'rc_this_oldid = rev_id'
299 } elseif ( !$log_id && !$rev_id ) {
301 $log_id = $dbw->selectField(
304 [
'rc_id' => $rc_id ],
307 $rev_id = $dbw->selectField(
310 [
'rc_id' => $rc_id ],
315 if ( $log_id && !$rev_id ) {
316 $rev_id = $dbw->selectField(
319 [
'ls_field' =>
'associated_rev_id',
'ls_log_id' => $log_id ],
322 } elseif ( !$log_id && $rev_id ) {
323 $log_id = $dbw->selectField(
326 [
'ls_field' =>
'associated_rev_id',
'ls_value' => $rev_id ],
333 if ( !self::updateTagSummaryRow( $tagsToAdd, $tagsToRemove, $rc_id, $rev_id,
337 return [ [], [], $prevTags ];
341 if ( count( $tagsToAdd ) ) {
343 foreach ( $tagsToAdd as $tag ) {
348 $tagsRows[] = array_filter(
351 'ct_rc_id' => $rc_id,
352 'ct_log_id' => $log_id,
353 'ct_rev_id' => $rev_id,
359 $dbw->insert(
'change_tag', $tagsRows, __METHOD__, [
'IGNORE' ] );
363 if ( count( $tagsToRemove ) ) {
364 foreach ( $tagsToRemove as $tag ) {
365 $conds = array_filter(
368 'ct_rc_id' => $rc_id,
369 'ct_log_id' => $log_id,
370 'ct_rev_id' => $rev_id
373 $dbw->delete(
'change_tag', $conds, __METHOD__ );
379 Hooks::run(
'ChangeTagsAfterUpdateTags', [ $tagsToAdd, $tagsToRemove, $prevTags,
380 $rc_id, $rev_id, $log_id,
$params, $rc, $user ] );
382 return [ $tagsToAdd, $tagsToRemove, $prevTags ];
402 $rc_id, $rev_id, $log_id, &$prevTags = []
406 $tsConds = array_filter( [
407 'ts_rc_id' => $rc_id,
408 'ts_rev_id' => $rev_id,
409 'ts_log_id' => $log_id
413 $tagsToAdd = array_diff( $tagsToAdd, $tagsToRemove );
418 $prevTags = $dbw->selectField(
'tag_summary',
'ts_tags', $tsConds, __METHOD__ );
419 $prevTags = $prevTags ? $prevTags :
'';
420 $prevTags = array_filter( explode(
',', $prevTags ) );
423 $tagsToAdd = array_values( array_diff( $tagsToAdd, $prevTags ) );
424 $newTags = array_unique( array_merge( $prevTags, $tagsToAdd ) );
427 $tagsToRemove = array_values( array_intersect( $tagsToRemove, $newTags ) );
428 $newTags = array_values( array_diff( $newTags, $tagsToRemove ) );
432 if ( $prevTags == $newTags ) {
438 $dbw->delete(
'tag_summary', $tsConds, __METHOD__ );
441 $row = array_filter( [
'ts_tags' => implode(
',', $newTags ) ] + $tsConds );
444 foreach ( [
'ts_rev_id',
'ts_rc_id',
'ts_log_id' ] as $uniqueColumn ) {
445 if ( isset( $row[$uniqueColumn] ) ) {
446 $uniqueKeys[] = [ $uniqueColumn ];
450 $dbw->replace(
'tag_summary', $uniqueKeys, $row, __METHOD__ );
468 $count = count( $tags );
469 return Status::newFatal( ( $count > 1 ) ? $msgMulti : $msgOne,
470 $lang->commaList( $tags ), $count );
484 if ( !is_null( $user ) ) {
485 if ( !$user->isAllowed(
'applychangetags' ) ) {
486 return Status::newFatal(
'tags-apply-no-permission' );
487 } elseif ( $user->isBlocked() ) {
488 return Status::newFatal(
'tags-apply-blocked', $user->getName() );
494 Hooks::run(
'ChangeTagsAllowedAdd', [ &$allowedTags, $tags, $user ] );
495 $disallowedTags = array_diff( $tags, $allowedTags );
496 if ( $disallowedTags ) {
498 'tags-apply-not-allowed-multi', $disallowedTags );
501 return Status::newGood();
525 array $tags, $rc_id, $rev_id, $log_id,
$params,
User $user
529 if ( !$result->isOK() ) {
530 $result->value =
null;
537 return Status::newGood(
true );
551 public static function canUpdateTags( array $tagsToAdd, array $tagsToRemove,
554 if ( !is_null( $user ) ) {
555 if ( !$user->isAllowed(
'changetags' ) ) {
556 return Status::newFatal(
'tags-update-no-permission' );
557 } elseif ( $user->isBlocked() ) {
558 return Status::newFatal(
'tags-update-blocked', $user->getName() );
566 $diff = array_diff( $tagsToAdd, $explicitlyDefinedTags );
569 'tags-update-add-not-allowed-multi', $diff );
573 if ( $tagsToRemove ) {
578 $intersect = array_intersect( $tagsToRemove, $softwareDefinedTags );
581 'tags-update-remove-not-allowed-multi', $intersect );
585 return Status::newGood();
615 $rc_id, $rev_id, $log_id,
$params, $reason,
User $user
617 if ( is_null( $tagsToAdd ) ) {
620 if ( is_null( $tagsToRemove ) ) {
623 if ( !$tagsToAdd && !$tagsToRemove ) {
625 return Status::newGood( (
object)[
634 if ( !$result->isOK() ) {
635 $result->value =
null;
640 if ( $user->pingLimiter(
'changetag' ) ) {
641 return Status::newFatal(
'actionthrottledtext' );
646 $tagsToRemove, $rc_id, $rev_id, $log_id,
$params,
null, $user );
647 if ( !$tagsAdded && !$tagsRemoved ) {
649 return Status::newGood( (
object)[
658 $logEntry->setPerformer( $user );
659 $logEntry->setComment( $reason );
663 $rev = Revision::newFromId( $rev_id );
665 $logEntry->setTarget(
$rev->getTitle() );
667 } elseif ( $log_id ) {
674 if ( !$logEntry->getTarget() ) {
676 $logEntry->setTarget( SpecialPage::getTitleFor(
'Tags' ) );
680 '4::revid' => $rev_id,
681 '5::logid' => $log_id,
682 '6:list:tagsAdded' => $tagsAdded,
683 '7:number:tagsAddedCount' => count( $tagsAdded ),
684 '8:list:tagsRemoved' => $tagsRemoved,
685 '9:number:tagsRemovedCount' => count( $tagsRemoved ),
686 'initialTags' => $initialTags,
688 $logEntry->setParameters( $logParams );
689 $logEntry->setRelations( [
'Tag' => array_merge( $tagsAdded, $tagsRemoved ) ] );
692 $logId = $logEntry->insert( $dbw );
694 $logEntry->publish( $logId,
'udp' );
696 return Status::newGood( (
object)[
698 'addedTags' => $tagsAdded,
699 'removedTags' => $tagsRemoved,
724 &$join_conds, &
$options, $filter_tag =
'' ) {
729 $fields = (
array)$fields;
730 $conds = (
array)$conds;
734 if ( in_array(
'recentchanges',
$tables ) ) {
735 $join_cond =
'ct_rc_id=rc_id';
736 } elseif ( in_array(
'logging',
$tables ) ) {
737 $join_cond =
'ct_log_id=log_id';
738 } elseif ( in_array(
'revision',
$tables ) ) {
739 $join_cond =
'ct_rev_id=rev_id';
740 } elseif ( in_array(
'archive',
$tables ) ) {
741 $join_cond =
'ct_rev_id=ar_rev_id';
743 throw new MWException(
'Unable to determine appropriate JOIN condition for tagging.' );
747 ',',
'change_tag',
'ct_tag', $join_cond
755 $join_conds[
'change_tag'] = [
'INNER JOIN', $join_cond ];
756 $conds[
'ct_tag'] = $filter_tag;
758 is_array( $filter_tag ) && count( $filter_tag ) > 1 &&
785 if ( !$config->get(
'UseTagFilter' ) || !count( self::listDefinedTags() ) ) {
792 [
'for' =>
'tagfilter' ],
793 $context->msg(
'tag-filter' )->parse()
798 $data[] =
new OOUI\TextInputWidget( [
800 'name' =>
'tagfilter',
801 'value' => $selected,
802 'classes' =>
'mw-tagfilter-input',
805 $data[] = Xml::input(
809 [
'class' =>
'mw-tagfilter-input mw-ui-input mw-ui-input-inline',
'id' =>
'tagfilter' ]
827 $dbw->replace(
'valid_tag',
829 [
'vt_tag' => $tag ],
846 $dbw->delete(
'valid_tag', [
'vt_tag' => $tag ], __METHOD__ );
867 User $user, $tagCount =
null, array $logEntryTags = []
872 $logEntry->setPerformer( $user );
875 $logEntry->setTarget( Title::newFromText(
'Special:Tags' ) );
876 $logEntry->setComment( $reason );
878 $params = [
'4::tag' => $tag ];
879 if ( !is_null( $tagCount ) ) {
880 $params[
'5:number:count'] = $tagCount;
882 $logEntry->setParameters(
$params );
883 $logEntry->setRelations( [
'Tag' => $tag ] );
884 $logEntry->setTags( $logEntryTags );
886 $logId = $logEntry->insert( $dbw );
887 $logEntry->publish( $logId );
901 if ( !is_null( $user ) ) {
902 if ( !$user->isAllowed(
'managechangetags' ) ) {
903 return Status::newFatal(
'tags-manage-no-permission' );
904 } elseif ( $user->isBlocked() ) {
905 return Status::newFatal(
'tags-manage-blocked', $user->getName() );
913 if ( in_array( $tag, $definedTags ) ) {
914 return Status::newFatal(
'tags-activate-not-allowed', $tag );
919 if ( !isset( $tagUsage[$tag] ) ) {
920 return Status::newFatal(
'tags-activate-not-found', $tag );
923 return Status::newGood();
944 $ignoreWarnings =
false, array $logEntryTags = []
948 if ( $ignoreWarnings ? !$result->isOK() : !$result->isGood() ) {
949 $result->value =
null;
958 null, $logEntryTags );
960 return Status::newGood( $logId );
973 if ( !is_null( $user ) ) {
974 if ( !$user->isAllowed(
'managechangetags' ) ) {
975 return Status::newFatal(
'tags-manage-no-permission' );
976 } elseif ( $user->isBlocked() ) {
977 return Status::newFatal(
'tags-manage-blocked', $user->getName() );
983 if ( !in_array( $tag, $explicitlyDefinedTags ) ) {
984 return Status::newFatal(
'tags-deactivate-not-allowed', $tag );
986 return Status::newGood();
1007 $ignoreWarnings =
false, array $logEntryTags = []
1011 if ( $ignoreWarnings ? !$result->isOK() : !$result->isGood() ) {
1012 $result->value =
null;
1021 null, $logEntryTags );
1023 return Status::newGood( $logId );
1035 if ( $tag ===
'' ) {
1036 return Status::newFatal(
'tags-create-no-name' );
1043 if ( strpos( $tag,
',' ) !==
false || strpos( $tag,
'|' ) !==
false
1044 || strpos( $tag,
'/' ) !==
false ) {
1045 return Status::newFatal(
'tags-create-invalid-chars' );
1049 $title = Title::makeTitleSafe( NS_MEDIAWIKI,
"Tag-$tag-description" );
1050 if ( is_null( $title ) ) {
1051 return Status::newFatal(
'tags-create-invalid-title-chars' );
1054 return Status::newGood();
1067 if ( !is_null( $user ) ) {
1068 if ( !$user->isAllowed(
'managechangetags' ) ) {
1069 return Status::newFatal(
'tags-manage-no-permission' );
1070 } elseif ( $user->isBlocked() ) {
1071 return Status::newFatal(
'tags-manage-blocked', $user->getName() );
1082 if ( isset( $tagUsage[$tag] ) || in_array( $tag, self::listDefinedTags() ) ) {
1083 return Status::newFatal(
'tags-create-already-exists', $tag );
1087 $canCreateResult = Status::newGood();
1088 Hooks::run(
'ChangeTagCanCreate', [ $tag, $user, &$canCreateResult ] );
1089 return $canCreateResult;
1109 $ignoreWarnings =
false, array $logEntryTags = []
1113 if ( $ignoreWarnings ? !$result->isOK() : !$result->isGood() ) {
1114 $result->value =
null;
1123 null, $logEntryTags );
1125 return Status::newGood( $logId );
1142 $dbw->startAtomic( __METHOD__ );
1148 $result = $dbw->select(
'change_tag',
1149 [
'ct_rc_id',
'ct_log_id',
'ct_rev_id',
'ct_tag' ],
1150 [
'ct_tag' => $tag ],
1152 foreach ( $result as $row ) {
1155 $tagsToRemove = [ $tag ];
1157 $row->ct_rev_id, $row->ct_log_id );
1161 $dbw->delete(
'change_tag', [
'ct_tag' => $tag ], __METHOD__ );
1163 $dbw->endAtomic( __METHOD__ );
1167 Hooks::run(
'ChangeTagAfterDelete', [ $tag, &
$status ] );
1170 wfDebug(
'ChangeTagAfterDelete error condition downgraded to warning' );
1192 if ( !is_null( $user ) ) {
1193 if ( !$user->isAllowed(
'deletechangetags' ) ) {
1194 return Status::newFatal(
'tags-delete-no-permission' );
1195 } elseif ( $user->isBlocked() ) {
1196 return Status::newFatal(
'tags-manage-blocked', $user->getName() );
1200 if ( !isset( $tagUsage[$tag] ) && !in_array( $tag, self::listDefinedTags() ) ) {
1201 return Status::newFatal(
'tags-delete-not-found', $tag );
1204 if ( isset( $tagUsage[$tag] ) && $tagUsage[$tag] > self::MAX_DELETE_USES ) {
1205 return Status::newFatal(
'tags-delete-too-many-uses', $tag, self::MAX_DELETE_USES );
1209 if ( in_array( $tag, $softwareDefined ) ) {
1212 $status = Status::newFatal(
'tags-delete-not-allowed' );
1218 Hooks::run(
'ChangeTagCanDelete', [ $tag, $user, &
$status ] );
1240 $ignoreWarnings =
false, array $logEntryTags = []
1244 if ( $ignoreWarnings ? !$result->isOK() : !$result->isGood() ) {
1245 $result->value =
null;
1251 $hitcount = isset( $tagUsage[$tag] ) ? $tagUsage[$tag] : 0;
1255 if ( !$deleteResult->isOK() ) {
1256 return $deleteResult;
1261 $hitcount, $logEntryTags );
1263 $deleteResult->value = $logId;
1264 return $deleteResult;
1276 if ( !Hooks::isRegistered(
'ChangeTagsListActive' ) ) {
1279 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
1280 return $cache->getWithSetCallback(
1281 $cache->makeKey(
'active-tags' ),
1282 WANObjectCache::TTL_MINUTE * 5,
1283 function ( $oldValue, &$ttl, array &$setOpts ) use ( $tags ) {
1287 Hooks::run(
'ChangeTagsListActive', [ &$tags ] );
1291 'checkKeys' => [
$cache->makeKey(
'active-tags' ) ],
1292 'lockTSE' => WANObjectCache::TTL_MINUTE * 5,
1293 'pcTTL' => WANObjectCache::TTL_PROC_LONG
1307 return array_values( array_unique( array_merge( $tags1, $tags2 ) ) );
1323 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
1324 return $cache->getWithSetCallback(
1325 $cache->makeKey(
'valid-tags-db' ),
1326 WANObjectCache::TTL_MINUTE * 5,
1330 $setOpts += Database::getCacheSetOptions(
$dbr );
1332 $tags =
$dbr->selectFieldValues(
'valid_tag',
'vt_tag', [],
$fname );
1334 return array_filter( array_unique( $tags ) );
1337 'checkKeys' => [
$cache->makeKey(
'valid-tags-db' ) ],
1338 'lockTSE' => WANObjectCache::TTL_MINUTE * 5,
1339 'pcTTL' => WANObjectCache::TTL_PROC_LONG
1356 if ( !Hooks::isRegistered(
'ListDefinedTags' ) ) {
1359 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
1360 return $cache->getWithSetCallback(
1361 $cache->makeKey(
'valid-tags-hook' ),
1362 WANObjectCache::TTL_MINUTE * 5,
1363 function ( $oldValue, &$ttl, array &$setOpts ) use ( $tags ) {
1366 Hooks::run(
'ListDefinedTags', [ &$tags ] );
1367 return array_filter( array_unique( $tags ) );
1370 'checkKeys' => [
$cache->makeKey(
'valid-tags-hook' ) ],
1371 'lockTSE' => WANObjectCache::TTL_MINUTE * 5,
1372 'pcTTL' => WANObjectCache::TTL_PROC_LONG
1383 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
1385 $cache->touchCheckKey(
$cache->makeKey(
'active-tags' ) );
1386 $cache->touchCheckKey(
$cache->makeKey(
'valid-tags-db' ) );
1387 $cache->touchCheckKey(
$cache->makeKey(
'valid-tags-hook' ) );
1397 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
1399 $cache->touchCheckKey(
$cache->makeKey(
'change-tag-statistics' ) );
1414 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
1415 return $cache->getWithSetCallback(
1416 $cache->makeKey(
'change-tag-statistics' ),
1417 WANObjectCache::TTL_MINUTE * 5,
1421 $setOpts += Database::getCacheSetOptions(
$dbr );
1425 [
'ct_tag',
'hitcount' =>
'count(*)' ],
1428 [
'GROUP BY' =>
'ct_tag',
'ORDER BY' =>
'hitcount DESC' ]
1432 foreach (
$res as $row ) {
1433 $out[$row->ct_tag] = $row->hitcount;
1439 'checkKeys' => [
$cache->makeKey(
'change-tag-statistics' ) ],
1440 'lockTSE' => WANObjectCache::TTL_MINUTE * 5,
1441 'pcTTL' => WANObjectCache::TTL_PROC_LONG
1461 return $user->isAllowed(
'changetags' ) && (bool)self::listExplicitlyDefinedTags();
$wgUseTagFilter
Allow filtering by change tag in recentchanges, history, etc Has no effect if no tags are defined in ...
array $wgSoftwareTags
List of core tags to enable.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
Class for creating log entries manually, to inject them into the database.
Utility class for creating new RC entries.
static getMain()
Get the RequestContext object associated with the main request.
static suggestTarget( $target, array $ids)
Suggest a target for the revision deletion Optionally override this function.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
when a variable name is used in a function
the array() calling protocol came about after MediaWiki 1.4rc1.
namespace being checked & $result
Status::newGood()` to allow deletion, and then `return false` from the hook function. Ensure you consume the 'ChangeTagAfterDelete' hook to carry out custom deletion actions. $tag:name of the tag $user:user initiating the action & $status:Status object. See above. 'ChangeTagsListActive':Allows you to nominate which of the tags your extension uses are in active use. & $tags:list of all active tags. Append to this array. 'ChangeTagsAfterUpdateTags':Called after tags have been updated with the ChangeTags::updateTags function. Params:$addedTags:tags effectively added in the update $removedTags:tags effectively removed in the update $prevTags:tags that were present prior to the update $rc_id:recentchanges table id $rev_id:revision table id $log_id:logging table id $params:tag params $rc:RecentChange being tagged when the tagging accompanies the action or null $user:User who performed the tagging when the tagging is subsequent to the action or null 'ChangeTagsAllowedAdd':Called when checking if a user can add tags to a change. & $allowedTags:List of all the tags the user is allowed to add. Any tags the user wants to add( $addTags) that are not in this array will cause it to fail. You may add or remove tags to this array as required. $addTags:List of tags user intends to add. $user:User who is adding the tags. 'ChangeUserGroups':Called before user groups are changed. $performer:The User who will perform the change $user:The User whose groups will be changed & $add:The groups that will be added & $remove:The groups that will be removed 'Collation::factory':Called if $wgCategoryCollation is an unknown collation. $collationName:Name of the collation in question & $collationObject:Null. Replace with a subclass of the Collation class that implements the collation given in $collationName. 'ConfirmEmailComplete':Called after a user 's email has been confirmed successfully. $user:user(object) whose email is being confirmed 'ContentAlterParserOutput':Modify parser output for a given content object. Called by Content::getParserOutput after parsing has finished. Can be used for changes that depend on the result of the parsing but have to be done before LinksUpdate is called(such as adding tracking categories based on the rendered HTML). $content:The Content to render $title:Title of the page, as context $parserOutput:ParserOutput to manipulate 'ContentGetParserOutput':Customize parser output for a given content object, called by AbstractContent::getParserOutput. May be used to override the normal model-specific rendering of page content. $content:The Content to render $title:Title of the page, as context $revId:The revision ID, as context $options:ParserOptions for rendering. To avoid confusing the parser cache, the output can only depend on parameters provided to this hook function, not on global state. $generateHtml:boolean, indicating whether full HTML should be generated. If false, generation of HTML may be skipped, but other information should still be present in the ParserOutput object. & $output:ParserOutput, to manipulate or replace 'ContentHandlerDefaultModelFor':Called when the default content model is determined for a given title. May be used to assign a different model for that title. $title:the Title in question & $model:the model name. Use with CONTENT_MODEL_XXX constants. 'ContentHandlerForModelID':Called when a ContentHandler is requested for a given content model name, but no entry for that model exists in $wgContentHandlers. Note:if your extension implements additional models via this hook, please use GetContentModels hook to make them known to core. $modeName:the requested content model name & $handler:set this to a ContentHandler object, if desired. 'ContentModelCanBeUsedOn':Called to determine whether that content model can be used on a given page. This is especially useful to prevent some content models to be used in some special location. $contentModel:ID of the content model in question $title:the Title in question. & $ok:Output parameter, whether it is OK to use $contentModel on $title. Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok. 'ContribsPager::getQueryInfo':Before the contributions query is about to run & $pager:Pager object for contributions & $queryInfo:The query for the contribs Pager 'ContribsPager::reallyDoQuery':Called before really executing the query for My Contributions & $data:an array of results of all contribs queries $pager:The ContribsPager object hooked into $offset:Index offset, inclusive $limit:Exact query limit $descending:Query direction, false for ascending, true for descending 'ContributionsLineEnding':Called before a contributions HTML line is finished $page:SpecialPage object for contributions & $ret:the HTML line $row:the DB row for this line & $classes:the classes to add to the surrounding< li > & $attribs:associative array of other HTML attributes for the< li > element. Currently only data attributes reserved to MediaWiki are allowed(see Sanitizer::isReservedDataAttribute). 'ContributionsToolLinks':Change tool links above Special:Contributions $id:User identifier $title:User page title & $tools:Array of tool links $specialPage:SpecialPage instance for context and services. Can be either SpecialContributions or DeletedContributionsPage. Extensions should type hint against a generic SpecialPage though. 'ConvertContent':Called by AbstractContent::convert when a conversion to another content model is requested. Handler functions that modify $result should generally return false to disable further attempts at conversion. $content:The Content object to be converted. $toModel:The ID of the content model to convert to. $lossy: boolean indicating whether lossy conversion is allowed. & $result:Output parameter, in case the handler function wants to provide a converted Content object. Note that $result->getContentModel() must return $toModel. 'CustomEditor':When invoking the page editor Return true to allow the normal editor to be used, or false if implementing a custom editor, e.g. for a special namespace, etc. $article:Article being edited $user:User performing the edit 'DatabaseOraclePostInit':Called after initialising an Oracle database $db:the DatabaseOracle object 'DeletedContribsPager::reallyDoQuery':Called before really executing the query for Special:DeletedContributions Similar to ContribsPager::reallyDoQuery & $data:an array of results of all contribs queries $pager:The DeletedContribsPager object hooked into $offset:Index offset, inclusive $limit:Exact query limit $descending:Query direction, false for ascending, true for descending 'DeletedContributionsLineEnding':Called before a DeletedContributions HTML line is finished. Similar to ContributionsLineEnding $page:SpecialPage object for DeletedContributions & $ret:the HTML line $row:the DB row for this line & $classes:the classes to add to the surrounding< li > & $attribs:associative array of other HTML attributes for the< li > element. Currently only data attributes reserved to MediaWiki are allowed(see Sanitizer::isReservedDataAttribute). 'DeleteUnknownPreferences':Called by the cleanupPreferences.php maintenance script to build a WHERE clause with which to delete preferences that are not known about. This hook is used by extensions that have dynamically-named preferences that should not be deleted in the usual cleanup process. For example, the Gadgets extension creates preferences prefixed with 'gadget-', and so anything with that prefix is excluded from the deletion. &where:An array that will be passed as the $cond parameter to IDatabase::select() to determine what will be deleted from the user_properties table. $db:The IDatabase object, useful for accessing $db->buildLike() etc. 'DifferenceEngineAfterLoadNewText':called in DifferenceEngine::loadNewText() after the new revision 's content has been loaded into the class member variable $differenceEngine->mNewContent but before returning true from this function. $differenceEngine:DifferenceEngine object 'DifferenceEngineLoadTextAfterNewContentIsLoaded':called in DifferenceEngine::loadText() after the new revision 's content has been loaded into the class member variable $differenceEngine->mNewContent but before checking if the variable 's value is null. This hook can be used to inject content into said class member variable. $differenceEngine:DifferenceEngine object 'DifferenceEngineMarkPatrolledLink':Allows extensions to change the "mark as patrolled" link which is shown both on the diff header as well as on the bottom of a page, usually wrapped in a span element which has class="patrollink". $differenceEngine:DifferenceEngine object & $markAsPatrolledLink:The "mark as patrolled" link HTML(string) $rcid:Recent change ID(rc_id) for this change(int) 'DifferenceEngineMarkPatrolledRCID':Allows extensions to possibly change the rcid parameter. For example the rcid might be set to zero due to the user being the same as the performer of the change but an extension might still want to show it under certain conditions. & $rcid:rc_id(int) of the change or 0 $differenceEngine:DifferenceEngine object $change:RecentChange object $user:User object representing the current user 'DifferenceEngineNewHeader':Allows extensions to change the $newHeader variable, which contains information about the new revision, such as the revision 's author, whether the revision was marked as a minor edit or not, etc. $differenceEngine:DifferenceEngine object & $newHeader:The string containing the various #mw-diff-otitle[1-5] divs, which include things like revision author info, revision comment, RevisionDelete link and more $formattedRevisionTools:Array containing revision tools, some of which may have been injected with the DiffRevisionTools hook $nextlink:String containing the link to the next revision(if any) $status
this hook is for auditing only RecentChangesLinked and Watchlist 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
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
Interface for objects which can provide a MediaWiki context on request.
if(!isset( $args[0])) $lang