*/
const MAX_DELETE_USES = 5000;
+ /**
+ * @var string[]
+ */
+ private static $coreTags = [ 'mw-contentmodelchange' ];
+
/**
* Creates HTML for the given tags
*
}
/**
- * Lists those tags which extensions report as being "active".
+ * Lists those tags which core or extensions report as being "active".
*
* @return array
* @since 1.25
*/
public static function listExtensionActivatedTags() {
+ // core active tags
+ $tags = self::$coreTags;
if ( !Hooks::isRegistered( 'ChangeTagsListActive' ) ) {
- return [];
+ return $tags;
}
return ObjectCache::getMainWANInstance()->getWithSetCallback(
wfMemcKey( 'active-tags' ),
WANObjectCache::TTL_MINUTE * 5,
- function ( $oldValue, &$ttl, array &$setOpts ) {
+ function ( $oldValue, &$ttl, array &$setOpts ) use ( $tags ) {
$setOpts += Database::getCacheSetOptions( wfGetDB( DB_REPLICA ) );
// Ask extensions which tags they consider active
- $extensionActive = [];
- Hooks::run( 'ChangeTagsListActive', [ &$extensionActive ] );
- return $extensionActive;
+ Hooks::run( 'ChangeTagsListActive', [ &$tags ] );
+ return $tags;
},
[
'checkKeys' => [ wfMemcKey( 'active-tags' ) ],
}
/**
- * Lists tags defined by extensions using the ListDefinedTags hook.
+ * Lists tags defined by core or extensions using the ListDefinedTags hook.
* Extensions need only define those tags they deem to be in active use.
*
* Tries memcached first.
* @since 1.25
*/
public static function listExtensionDefinedTags() {
+ // core defined tags
+ $tags = self::$coreTags;
if ( !Hooks::isRegistered( 'ListDefinedTags' ) ) {
- return [];
+ return $tags;
}
return ObjectCache::getMainWANInstance()->getWithSetCallback(
wfMemcKey( 'valid-tags-hook' ),
WANObjectCache::TTL_MINUTE * 5,
- function ( $oldValue, &$ttl, array &$setOpts ) {
+ function ( $oldValue, &$ttl, array &$setOpts ) use ( $tags ) {
$setOpts += Database::getCacheSetOptions( wfGetDB( DB_REPLICA ) );
- $tags = [];
Hooks::run( 'ListDefinedTags', [ &$tags ] );
return array_filter( array_unique( $tags ) );
},
*/
public function doEditContent(
Content $content, $summary, $flags = 0, $baseRevId = false,
- User $user = null, $serialFormat = null, $tags = null
+ User $user = null, $serialFormat = null, $tags = []
) {
global $wgUser, $wgUseAutomaticEditSummaries;
+ // Old default parameter for $tags was null
+ if ( $tags === null ) {
+ $tags = [];
+ }
+
// Low-level sanity check
if ( $this->mTitle->getText() === '' ) {
throw new MWException( 'Something is trying to edit an article with an empty title' );
$old_revision = $this->getRevision(); // current revision
$old_content = $this->getContent( Revision::RAW ); // current revision's content
+ if ( $old_content && $old_content->getModel() !== $content->getModel() ) {
+ $tags[] = 'mw-contentmodelchange';
+ }
+
// Provide autosummaries if one is not provided and autosummaries are enabled
if ( $wgUseAutomaticEditSummaries && ( $flags & EDIT_AUTOSUMMARY ) && $summary == '' ) {
$handler = $content->getContentHandler();
"tag-filter": "[[Special:Tags|Tag]] filter:",
"tag-filter-submit": "Filter",
"tag-list-wrapper": "([[Special:Tags|{{PLURAL:$1|Tag|Tags}}]]: $2)",
+ "tag-mw-contentmodelchange": "content model change",
+ "tag-mw-contentmodelchange-description": "Edits that [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:ChangeContentModel change the content model] of a page",
"tags-title": "Tags",
"tags-intro": "This page lists the tags that the software may mark an edit with, and their meaning.",
"tags-tag": "Tag name",
"tags-actions-header": "Actions",
"tags-active-yes": "Yes",
"tags-active-no": "No",
- "tags-source-extension": "Defined by an extension",
+ "tags-source-extension": "Defined by the software",
"tags-source-manual": "Applied manually by users and bots",
"tags-source-none": "No longer in use",
"tags-edit": "edit",
"tag-filter": "Caption of a filter shown on lists of changes (e.g. [[Special:Log]], [[Special:Contributions]], [[Special:Newpages]], [[Special:Recentchanges]], [[Special:Recentchangeslinked]], page histories)",
"tag-filter-submit": "Caption of the submit button displayed next to the tag filter on lists of changes (e.g. [[Special:Log]], [[Special:Contributions]], [[Special:Newpages]], [[Special:Recentchanges]], [[Special:Recentchangeslinked]], page histories)\n\n{{Identical|Filter}}",
"tag-list-wrapper": "Wrapper for the list of tags shown on recent changes, watchlists, history pages and diffs.\n\nParameters:\n* $1 - number of distinct tags for given edit\n* $2 - comma-separated list of tags for given edit",
+ "tag-mw-contentmodelchange": "Change tag for edits that change the content model of a page",
+ "tag-mw-contentmodelchange-description": "Description for \"content model change\" change tag",
"tags-title": "The title of [[Special:Tags]].\n{{Identical|Tag}}",
"tags-intro": "Explanation on top of [[Special:Tags]]. For more information on tags see [[mw:Manual:Tags|MediaWiki]].",
"tags-tag": "Caption of a column in [[Special:Tags]]. For more information on tags see [[mw:Manual:Tags|MediaWiki]].",
"tags-actions-header": "Caption of a column in [[Special:Tags]]. The column contains action links like \"delete\". For more information on tags see [[mw:Manual:Tags|MediaWiki]].\n{{Identical|Action}}",
"tags-active-yes": "Table cell contents if given tag is \"active\".\n\nSee also:\n* {{msg-mw|Tags-active-no}}\n{{Identical|Yes}}",
"tags-active-no": "Table cell contents if given tag is not \"active\".\n\nSee also:\n* {{msg-mw|Tags-active-yes}}\n{{Identical|No}}",
- "tags-source-extension": "Table cell contents if given tag can be applied automatically by a software [[mw:Manual:Extensions|extension]].\n\nSee also:\n* {{msg-mw|Tags-source-manual}}\n* {{msg-mw|Tags-source-none}}",
+ "tags-source-extension": "Table cell contents if given tag can be applied automatically by the MediaWiki software.\n\nSee also:\n* {{msg-mw|Tags-source-manual}}\n* {{msg-mw|Tags-source-none}}",
"tags-source-manual": "\"Applied\" is not past tense, but an adjective that describes an action that sometimes happens, as in the sentence: \"(this tag is usually) applied by users and bots\".\n\nTable cell contents if given tag can be applied by users or bots.\n\nSee also:\n* {{msg-mw|Tags-source-extension}}\n* {{msg-mw|Tags-source-none}}",
"tags-source-none": "Table cell contents if given tag is no longer in use. (It was applied in the past, but it is currently not applied.)\n\nSee also:\n* {{msg-mw|Tags-source-extension}}\n* {{msg-mw|Tags-source-manual}}",
"tags-edit": "Used on [[Special:Tags]]. Verb. Used as display text on a link to create/edit a description.\n{{Identical|Edit}}",