Merge "Add new core tags"
[lhc/web/wiklou.git] / includes / page / WikiPage.php
index 8b34928..9df3d8c 100644 (file)
@@ -1617,13 +1617,15 @@ class WikiPage implements Page, IDBAccessObject {
                $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';
+               $handler = $content->getContentHandler();
+               $tag = $handler->getChangeTag( $old_content, $content, $flags );
+               // If there is no applicable tag, null is returned, so we need to check
+               if ( $tag ) {
+                       $tags[] = $tag;
                }
 
-               // Provide autosummaries if one is not provided and autosummaries are enabled
+               // Provide autosummaries if summary is not provided and autosummaries are enabled
                if ( $wgUseAutomaticEditSummaries && ( $flags & EDIT_AUTOSUMMARY ) && $summary == '' ) {
-                       $handler = $content->getContentHandler();
                        $summary = $handler->getAutosummary( $old_content, $content, $flags );
                }
 
@@ -3211,6 +3213,10 @@ class WikiPage implements Page, IDBAccessObject {
                $targetContent = $target->getContent();
                $changingContentModel = $targetContent->getModel() !== $current->getContentModel();
 
+               if ( in_array( 'mw-rollback', ChangeTags::getSoftwareTags() ) ) {
+                       $tags[] = 'mw-rollback';
+               }
+
                // Actually store the edit
                $status = $this->doEditContent(
                        $targetContent,
@@ -3287,7 +3293,8 @@ class WikiPage implements Page, IDBAccessObject {
                        'summary' => $summary,
                        'current' => $current,
                        'target' => $target,
-                       'newid' => $revId
+                       'newid' => $revId,
+                       'tags' => $tags
                ];
 
                return [];