Cenarium has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/210675

Change subject: Bulk revision deletion and tag editing from contributions
......................................................................

Bulk revision deletion and tag editing from contributions

This allows to delete revisions in bulk from Special:Contributions,
as requested in T78092 and T28230, as well as tag editing (T98611).
This only works for contributions from a single user (not newbies).
For revision deletion, a log entry is added for each target page.

Change-Id: I53aad4c844355a45bfe4296d76d24dae2021ddaa
---
M autoload.php
A includes/changetags/ChangeTagsContribsItem.php
A includes/changetags/ChangeTagsContribsList.php
M includes/changetags/ChangeTagsList.php
A includes/revisiondelete/RevDelContribsItem.php
A includes/revisiondelete/RevDelContribsList.php
M includes/revisiondelete/RevDelList.php
M includes/revisiondelete/RevisionDeleter.php
M includes/specials/SpecialContributions.php
M includes/specials/SpecialEditTags.php
M includes/specials/SpecialRevisiondelete.php
11 files changed, 543 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/75/210675/1

diff --git a/autoload.php b/autoload.php
index 6c623a3..cb1ae74 100644
--- a/autoload.php
+++ b/autoload.php
@@ -206,6 +206,8 @@
        'CgzCopyTransaction' => __DIR__ . 
'/maintenance/storage/recompressTracked.php',
        'ChangePassword' => __DIR__ . '/maintenance/changePassword.php',
        'ChangeTags' => __DIR__ . '/includes/changetags/ChangeTags.php',
+       'ChangeTagsContribsItem' => __DIR__ . 
'/includes/changetags/ChangeTagsContribsItem.php',
+       'ChangeTagsContribsList' => __DIR__ . 
'/includes/changetags/ChangeTagsContribsList.php',
        'ChangeTagsList' => __DIR__ . '/includes/changetags/ChangeTagsList.php',
        'ChangeTagsLogItem' => __DIR__ . 
'/includes/changetags/ChangeTagsLogItem.php',
        'ChangeTagsLogList' => __DIR__ . 
'/includes/changetags/ChangeTagsLogList.php',
@@ -1026,6 +1028,8 @@
        'RevDelArchivedFileItem' => __DIR__ . 
'/includes/revisiondelete/RevDelArchivedFileItem.php',
        'RevDelArchivedFileList' => __DIR__ . 
'/includes/revisiondelete/RevDelArchivedFileList.php',
        'RevDelArchivedRevisionItem' => __DIR__ . 
'/includes/revisiondelete/RevDelArchivedRevisionItem.php',
+       'RevDelContribsItem' => __DIR__ . 
'/includes/revisiondelete/RevDelContribsItem.php',
+       'RevDelContribsList' => __DIR__ . 
'/includes/revisiondelete/RevDelContribsList.php',
        'RevDelFileItem' => __DIR__ . 
'/includes/revisiondelete/RevDelFileItem.php',
        'RevDelFileList' => __DIR__ . 
'/includes/revisiondelete/RevDelFileList.php',
        'RevDelItem' => __DIR__ . '/includes/revisiondelete/RevDelItem.php',
diff --git a/includes/changetags/ChangeTagsContribsItem.php 
b/includes/changetags/ChangeTagsContribsItem.php
new file mode 100644
index 0000000..09490ef
--- /dev/null
+++ b/includes/changetags/ChangeTagsContribsItem.php
@@ -0,0 +1,104 @@
+<?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Change tagging
+ */
+
+/**
+ * Item class for a live revision table row with its associated change tags.
+ * @since 1.25
+ */
+class ChangeTagsContribsItem extends RevisionItem {
+       /**
+        * @return string Comma-separated list of tags
+        */
+       public function getTags() {
+               return $this->row->ts_tags;
+       }
+
+       /**
+        * Get the HTML link to the revision text.
+        * Overridden by RevDelArchiveItem.
+        * @return string
+        */
+       protected function getRevisionLink() {
+               $date = htmlspecialchars( 
$this->list->getLanguage()->userTimeAndDate(
+                       $this->revision->getTimestamp(), $this->list->getUser() 
) );
+
+               if ( $this->isDeleted() && !$this->canViewContent() ) {
+                       return $date;
+               }
+
+               return Linker::linkKnown(
+                       $this->revision->getTitle(),
+                       $date,
+                       array(),
+                       array(
+                               'oldid' => $this->revision->getId(),
+                               'unhide' => 1
+                       )
+               );
+       }
+
+       /**
+        * Get the HTML link to the diff.
+        * Overridden by RevDelArchiveItem
+        * @return string
+        */
+       protected function getDiffLink() {
+               if ( $this->isDeleted() && !$this->canViewContent() ) {
+                       return $this->list->msg( 'diff' )->escaped();
+               } else {
+                       return Linker::linkKnown(
+                                       $this->revision->getTitle(),
+                                       $this->list->msg( 'diff' )->escaped(),
+                                       array(),
+                                       array(
+                                               'diff' => 
$this->revision->getId(),
+                                               'oldid' => 'prev',
+                                               'unhide' => 1
+                                       )
+                               );
+               }
+       }
+
+       /**
+        * @return string A HTML <li> element representing this revision, 
showing
+        * change tags and everything
+        */
+       public function getHTML() {
+               $difflink = $this->list->msg( 'parentheses' )
+                       ->rawParams( $this->getDiffLink() )->escaped();
+               $revlink = $this->getRevisionLink();
+               $articlelink = Linker::link( $this->revision->getTitle() );
+               $comment = Linker::revComment( $this->revision );
+               if ( $this->isDeleted() ) {
+                       $revlink = "<span 
class=\"history-deleted\">$revlink</span>";
+               }
+
+               $content = "$difflink $revlink $articlelink $comment";
+               $attribs = array();
+               $tags = $this->getTags();
+               if ( $tags ) {
+                       list( $tagSummary, $classes ) = 
ChangeTags::formatSummaryRow( $tags, 'edittags' );
+                       $content .= " $tagSummary";
+                       $attribs['class'] = implode( ' ', $classes );
+               }
+               return Xml::tags( 'li', $attribs, $content );
+       }
+}
diff --git a/includes/changetags/ChangeTagsContribsList.php 
b/includes/changetags/ChangeTagsContribsList.php
new file mode 100644
index 0000000..e0ab5f5
--- /dev/null
+++ b/includes/changetags/ChangeTagsContribsList.php
@@ -0,0 +1,69 @@
+<?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Change tagging
+ */
+
+/**
+ * Stores a list of taggable revisions.
+ * @since 1.25
+ */
+class ChangeTagsContribsList extends ChangeTagsRevisionList {
+       public function getType() {
+               return 'contribs';
+       }
+
+       /**
+        * @param DatabaseBase $db
+        * @return mixed
+        */
+       public function doQuery( $db ) {
+               $ids = array_map( 'intval', $this->ids );
+               $queryInfo = array(
+                       'tables' => array( 'revision', 'user' ),
+                       'fields' => array_merge( Revision::selectFields(), 
Revision::selectUserFields() ),
+                       'conds' => array(
+                               'rev_id' => $ids,
+                       ),
+                       'options' => array( 'ORDER BY' => 'rev_id DESC' ),
+                       'join_conds' => array(
+                               'page' => Revision::pageJoinCond(),
+                               'user' => Revision::userJoinCond(),
+                       ),
+               );
+               ChangeTags::modifyDisplayQuery(
+                       $queryInfo['tables'],
+                       $queryInfo['fields'],
+                       $queryInfo['conds'],
+                       $queryInfo['join_conds'],
+                       $queryInfo['options']
+               );
+               return $db->select(
+                       $queryInfo['tables'],
+                       $queryInfo['fields'],
+                       $queryInfo['conds'],
+                       __METHOD__,
+                       $queryInfo['options'],
+                       $queryInfo['join_conds']
+               );
+       }
+
+       public function newItem( $row ) {
+               return new ChangeTagsContribsItem( $this, $row );
+       }
+}
diff --git a/includes/changetags/ChangeTagsList.php 
b/includes/changetags/ChangeTagsList.php
index dd8bab9..a94bde8 100644
--- a/includes/changetags/ChangeTagsList.php
+++ b/includes/changetags/ChangeTagsList.php
@@ -45,6 +45,9 @@
                        case 'revision':
                                $className = 'ChangeTagsRevisionList';
                                break;
+                       case 'contribs':
+                               $className = 'ChangeTagsContribsList';
+                               break;
                        case 'logentry':
                                $className = 'ChangeTagsLogList';
                                break;
diff --git a/includes/revisiondelete/RevDelContribsItem.php 
b/includes/revisiondelete/RevDelContribsItem.php
new file mode 100644
index 0000000..9248f28
--- /dev/null
+++ b/includes/revisiondelete/RevDelContribsItem.php
@@ -0,0 +1,90 @@
+<?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup RevisionDelete
+ */
+
+/**
+ * Item class for a live revision table row
+ */
+class RevDelContribsItem extends RevDelRevisionItem {
+
+       /**
+        * Get the HTML link to the revision text.
+        * Overridden by RevDelArchiveItem.
+        * @return string
+        */
+       protected function getRevisionLink() {
+               $date = htmlspecialchars( 
$this->list->getLanguage()->userTimeAndDate(
+                       $this->revision->getTimestamp(), $this->list->getUser() 
) );
+
+               if ( $this->isDeleted() && !$this->canViewContent() ) {
+                       return $date;
+               }
+
+               return Linker::linkKnown(
+                       $this->revision->getTitle(),
+                       $date,
+                       array(),
+                       array(
+                               'oldid' => $this->revision->getId(),
+                               'unhide' => 1
+                       )
+               );
+       }
+
+       /**
+        * Get the HTML link to the diff.
+        * Overridden by RevDelArchiveItem
+        * @return string
+        */
+       protected function getDiffLink() {
+               if ( $this->isDeleted() && !$this->canViewContent() ) {
+                       return $this->list->msg( 'diff' )->escaped();
+               } else {
+                       return Linker::linkKnown(
+                                       $this->revision->getTitle(),
+                                       $this->list->msg( 'diff' )->escaped(),
+                                       array(),
+                                       array(
+                                               'diff' => 
$this->revision->getId(),
+                                               'oldid' => 'prev',
+                                               'unhide' => 1
+                                       )
+                               );
+               }
+       }
+
+       public function getHTML() {
+               $difflink = $this->list->msg( 'parentheses' )
+                       ->rawParams( $this->getDiffLink() )->escaped();
+               $revlink = $this->getRevisionLink();
+               $articlelink = Linker::Link( $this->revision->getTitle() );
+               $comment = Linker::revComment( $this->revision );
+               if ( $this->isDeleted() ) {
+                       $revlink = "<span 
class=\"history-deleted\">$revlink</span>";
+               }
+
+               return "<li>$difflink $revlink $articlelink $comment</li>";
+       }
+
+       public function isHideCurrentOp( $newBits ) {
+               return ( $newBits & Revision::DELETED_TEXT )
+                       && isset( $this->list->getLatestIds()[$this->getId()] );
+       }
+}
diff --git a/includes/revisiondelete/RevDelContribsList.php 
b/includes/revisiondelete/RevDelContribsList.php
new file mode 100644
index 0000000..5010c9b
--- /dev/null
+++ b/includes/revisiondelete/RevDelContribsList.php
@@ -0,0 +1,145 @@
+<?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup RevisionDelete
+ */
+
+/**
+ * List for logging table items
+ */
+class RevDelContribsList extends RevDelList {
+       /**
+       * @var array
+       */
+       protected $latestIds;
+
+       function __construct( IContextSource $context, Title $title, array $ids 
) {
+               parent::__construct( $context, $title, $ids );
+
+               // Make array mapping ids to the latest rev id of the title the 
id belongs to
+               $latest = array();
+               foreach ( $ids as $id ) {
+                       $rev = Revision::newFromId( $id );
+                       $latest[$id]= $rev->getTitle()->getLatestRevID();
+               }
+
+               // Map each latest rev id to the set of ids belonging to the 
same title
+               $map = array();
+               foreach ( array_unique( $latest ) as $latestRevID ) {
+                       $map[$latestRevID] = array_keys( $latest, $latestRevID 
);
+               }
+
+               $this->latestIds = $map;
+       }
+
+       public function getLatestIds() {
+               return $this->latestIds;
+       }
+
+       public function getType() {
+               return 'revision';
+       }
+
+       public static function getRelationType() {
+               return 'rev_id';
+       }
+
+       public static function getRestriction() {
+               return 'deleterevision';
+       }
+
+       public static function getRevdelConstant() {
+               return Revision::DELETED_TEXT;
+       }
+
+       public static function suggestTarget( $target, array $ids ) {
+               $rev = Revision::newFromId( $ids[0] );
+               return SpecialPage::getTitleFor( 'Contributions', 
$rev->getUserText( Revision::RAW ) );
+       }
+
+       /**
+        * @param IDatabase $db
+        * @return mixed
+        */
+       public function doQuery( $db ) {
+               $ids = array_map( 'intval', $this->ids );
+               $live = $db->select(
+                       array( 'revision', 'page', 'user' ),
+                       array_merge( Revision::selectFields(), 
Revision::selectUserFields() ),
+                       array(
+                               'rev_id' => $ids,
+                       ),
+                       __METHOD__,
+                       array( 'ORDER BY' => 'rev_id DESC' ),
+                       array(
+                               'page' => Revision::pageJoinCond(),
+                               'user' => Revision::userJoinCond() )
+               );
+
+               // Revisions in the archive table are ignored.
+               return $live;
+       }
+
+       public function newItem( $row ) {
+               if ( isset( $row->rev_id ) ) {
+                       return new RevDelContribsItem( $this, $row );
+               } elseif ( isset( $row->ar_rev_id ) ) {
+                       return;
+               } else {
+                       // This shouldn't happen. :)
+                       throw new MWException( 'Invalid row type in 
RevDelRevisionList' );
+               }
+       }
+
+       public function getSuppressBit() {
+               return Revision::DELETED_RESTRICTED;
+       }
+
+       public function doPreCommitUpdates() {
+               foreach ( array_keys( $this->latestIds ) as $id ) {
+                       $rev = Revision::newFromId( $id );
+                       $rev->getTitle()->invalidateCache();
+               }
+               return Status::newGood();
+       }
+
+       public function doPostCommitUpdates() {
+               foreach ( array_keys( $this->latestIds ) as $id ) {
+                       $rev = Revision::newFromId( $id );
+                       $rev->getTitle()->purgeSquid();
+                       // Extensions that require referencing previous 
revisions may need this
+                       Hooks::run( 'ArticleRevisionVisibilitySet', array( 
$rev->getTitle(), $id ) );
+               }
+               return Status::newGood();
+       }
+
+       protected function updateLog( $params ) {
+               // Add one log entry by target page
+               foreach ( $this->latestIds as $latestRevID => $ids ) {
+                       $entryParams = $params;
+                       $entryParams['ids'] = array_intersect( $params['ids'], 
$ids );
+                       $entryParams['count'] = count( $params['ids'] );
+                       if ( !$entryParams['count'] ) {
+                               // Ignore if this target page had no revision 
updated
+                               continue;
+                       }
+                       $entryParams['title'] = Revision::newFromId( 
$latestRevID )->getTitle();
+                       $this->addLogEntry( $entryParams );
+               }
+       }
+}
diff --git a/includes/revisiondelete/RevDelList.php 
b/includes/revisiondelete/RevDelList.php
index f16fd15..0137e28 100644
--- a/includes/revisiondelete/RevDelList.php
+++ b/includes/revisiondelete/RevDelList.php
@@ -229,6 +229,14 @@
        }
 
        /**
+        * Updates the deletion log.
+        * Subclasses may add several log entries
+        */
+       protected function updateLog( $params ) {
+               $this->addLogEntry( $params );
+       }
+
+       /**
         * Record a log entry on the action
         * @param array $params Associative array of parameters:
         *     newBits:         The new value of the *_deleted bitfield
@@ -240,7 +248,7 @@
         *     authorsIPs:      The array of the IP/anon user offenders
         * @throws MWException
         */
-       protected function updateLog( $params ) {
+       protected final function addLogEntry( $params ) {
                // Get the URL param's corresponding DB field
                $field = RevisionDeleter::getRelationType( $this->getType() );
                if ( !$field ) {
diff --git a/includes/revisiondelete/RevisionDeleter.php 
b/includes/revisiondelete/RevisionDeleter.php
index ba1f0f6..9700243 100644
--- a/includes/revisiondelete/RevisionDeleter.php
+++ b/includes/revisiondelete/RevisionDeleter.php
@@ -30,6 +30,7 @@
        /** List of known revdel types, with their corresponding list classes */
        private static $allowedTypes = array(
                'revision' => 'RevDelRevisionList',
+               'contribs' => 'RevDelContribsList',
                'archive' => 'RevDelArchiveList',
                'oldimage' => 'RevDelFileList',
                'filearchive' => 'RevDelArchivedFileList',
diff --git a/includes/specials/SpecialContributions.php 
b/includes/specials/SpecialContributions.php
index c2cd812..63fc9ab 100644
--- a/includes/specials/SpecialContributions.php
+++ b/includes/specials/SpecialContributions.php
@@ -205,6 +205,9 @@
 
                                $output = $pager->getBody();
                                if ( !$this->including() ) {
+                                       if ( $this->opts['contribs'] !== 
'newbie' ) {
+                                               $output = 
$this->getActionButtons( $output );
+                                       }
                                        $output = '<p>' . 
$pager->getNavigationBar() . '</p>' .
                                                $output .
                                                '<p>' . 
$pager->getNavigationBar() . '</p>';
@@ -235,6 +238,56 @@
                                }
                        }
                }
+       }
+
+       // Add revision delete and tag editing buttons (adapted from 
HistoryAction class)
+       private function getActionButtons( $formcontents ) {
+               $user = $this->getUser();
+               $canRevDelete = $user->isAllowedAll( 'deletedhistory', 
'deletelogentry' );
+               $showTagEditUI = ChangeTags::showTagEditingUI( $user );
+               # If the user doesn't have the ability to delete log entries 
nor edit tags,
+               # don't bother showing them the button(s).
+               if ( !$canRevDelete && !$showTagEditUI ) {
+                       return $formcontents;
+               }
+
+               # Show button to hide revisions and/or edit change tags
+               $s = Html::openElement(
+                       'form',
+                       array( 'action' => wfScript(), 'id' => 
'mw-contributions-deleterevision-submit' )
+               ) . "\n";
+               $s .= Html::hidden( 'action', 'historysubmit' ) . "\n";
+               $s .= Html::hidden( 'type', 'contribs' ) . "\n";
+
+               $buttons = '';
+               if ( $canRevDelete ) {
+                       $buttons .= Html::element(
+                               'button',
+                               array(
+                                       'type' => 'submit',
+                                       'name' => 'revisiondelete',
+                                       'value' => '1',
+                                       'class' => 
"deleterevision-contributions-submit mw-contributions-deleterevision-button"
+                               ),
+                               $this->msg( 'showhideselectedversions' )->text()
+                       ) . "\n";
+               }
+               if ( $showTagEditUI ) {
+                       $buttons .= Html::element(
+                               'button',
+                               array(
+                                       'type' => 'submit',
+                                       'name' => 'editchangetags',
+                                       'value' => '1',
+                                       'class' => 
"editchangetags-contributions-submit mw-contributions-editchangetags-button"
+                               ),
+                               $this->msg( 'history-edit-tags' )->text()
+                       ) . "\n";
+               }
+               $s .= $buttons . $formcontents . $buttons;
+               $s .= Html::closeElement( 'form' );
+
+               return $s;
        }
 
        /**
@@ -1080,9 +1133,43 @@
                                $mflag = '';
                        }
 
-                       $del = Linker::getRevDeleteLink( $user, $rev, $page );
-                       if ( $del !== '' ) {
-                               $del .= ' ';
+                       if ( $this->contribs === 'newbie' ) {
+                               $del = Linker::getRevDeleteLink( $user, $rev, 
$page );
+                               if ( $del !== '' ) {
+                                       $del .= ' ';
+                               }
+                       } else {
+                               // Add checkboxes (adapted from HistoryAction 
class)
+                               $del = '';
+                               $user = $this->getUser();
+                               $canRevDelete = $user->isAllowed( 
'deleterevision' );
+                               $showTagEditUI = ChangeTags::showTagEditingUI( 
$user );
+                               // Show checkboxes for each revision, to allow 
for revision deletion and
+                               // change tags
+                               if ( $canRevDelete || $showTagEditUI ) {
+                                       $this->preventClickjacking();
+                                       // If revision was hidden from sysops 
and we don't need the checkbox
+                                       // for anything else, disable it
+                                       if ( !$showTagEditUI && !$rev->userCan( 
Revision::DELETED_RESTRICTED, $user ) ) {
+                                               $del = Xml::check( 
'deleterevisions', false, array( 'disabled' => 'disabled' ) );
+                                       // Otherwise, enable the checkbox...
+                                       } else {
+                                               $del = Xml::check( 
'showhiderevisions', false,
+                                                       array( 'name' => 'ids[' 
. $rev->getId() . ']' ) );
+                                       }
+                               // User can only view deleted revisions...
+                               } elseif ( $rev->getVisibility() && 
$user->isAllowed( 'deletedhistory' ) ) {
+                                       // If revision was hidden from sysops, 
disable the link
+                                       if ( !$rev->userCan( 
Revision::DELETED_RESTRICTED, $user ) ) {
+                                               $del = 
Linker::revDeleteLinkDisabled( false );
+                                       // Otherwise, show the link...
+                                       } else {
+                                               $query = array( 'type' => 
'contribs',
+                                                       'target' => 
$this->target, 'ids' => $rev->getId() );
+                                               $del .= Linker::revDeleteLink( 
$query,
+                                                       $rev->isDeleted( 
Revision::DELETED_RESTRICTED ), false );
+                                       }
+                               }
                        }
 
                        $diffHistLinks = $this->msg( 'parentheses' )
diff --git a/includes/specials/SpecialEditTags.php 
b/includes/specials/SpecialEditTags.php
index bfd1717..95e5b85 100644
--- a/includes/specials/SpecialEditTags.php
+++ b/includes/specials/SpecialEditTags.php
@@ -55,6 +55,18 @@
                parent::__construct( 'EditTags', 'changetags' );
        }
 
+       /**
+        * Helper function giving message key prefix appropriate for the 
typeName
+        */
+       public function appendMessagePrefix( $name ) {
+               if ( $this->typeName === 'contribs' ) {
+                       $type = 'revision';
+               } else {
+                       $type = $this->typeName;
+               }
+               return 'tags-edit-' . $type . '-' . $name;
+               }
+
        public function execute( $par ) {
                $this->checkPermissions();
                $this->checkReadOnly();
@@ -96,6 +108,9 @@
                        case 'logging':
                                $this->typeName = 'logentry';
                                break;
+                       case 'contribs':
+                               $this->typeName = 'contribs';
+                               break;
                        default:
                                $this->typeName = 'revision';
                                break;
@@ -105,7 +120,7 @@
                // Yuck! Copied straight out of SpecialRevisiondelete, but it 
does exactly
                // what we want
                $this->targetObj = RevisionDeleter::suggestTarget(
-                       $this->typeName === 'revision' ? 'revision' : 'logging',
+                       ( $this->typeName === 'logentry' ) ? 'logging' : 
$this->typeName,
                        $this->targetObj,
                        $this->ids
                );
@@ -201,7 +216,7 @@
                $out = $this->getOutput();
                // Messages: tags-edit-revision-selected, 
tags-edit-logentry-selected
                $out->wrapWikiMsg( "<strong>$1</strong>", array(
-                       "tags-edit-{$this->typeName}-selected",
+                       $this->appendMessagePrefix( 'selected' ),
                        $this->getLanguage()->formatNum( count( $this->ids ) ),
                        $this->targetObj->getPrefixedText()
                ) );
@@ -226,14 +241,14 @@
 
                $out->addHTML( "</ul>" );
                // Explanation text
-               $out->wrapWikiMsg( '<p>$1</p>', 
"tags-edit-{$this->typeName}-explanation" );
+               $out->wrapWikiMsg( '<p>$1</p>', $this->appendMessagePrefix( 
'explanation' ) );
 
                // Show form if the user can submit
                if ( $this->isAllowed ) {
                        $form = Xml::openElement( 'form', array( 'method' => 
'post',
                                        'action' => 
$this->getPageTitle()->getLocalURL( array( 'action' => 'submit' ) ),
                                        'id' => 'mw-revdel-form-revisions' ) ) .
-                               Xml::fieldset( $this->msg( 
"tags-edit-{$this->typeName}-legend",
+                               Xml::fieldset( $this->msg( 
$this->appendMessagePrefix( 'legend' ),
                                        count( $this->ids ) )->text() ) .
                                $this->buildCheckBoxes() .
                                Xml::openElement( 'table' ) .
@@ -252,7 +267,7 @@
                                "</tr><tr>\n" .
                                        '<td></td>' .
                                        '<td class="mw-submit">' .
-                                               Xml::submitButton( $this->msg( 
"tags-edit-{$this->typeName}-submit",
+                                               Xml::submitButton( $this->msg( 
$this->appendMessagePrefix( 'submit' ),
                                                        $numRevisions 
)->text(), array( 'name' => 'wpSubmit' ) ) .
                                        '</td>' .
                                "</tr>\n" .
diff --git a/includes/specials/SpecialRevisiondelete.php 
b/includes/specials/SpecialRevisiondelete.php
index 62025e7..fd4e40c 100644
--- a/includes/specials/SpecialRevisiondelete.php
+++ b/includes/specials/SpecialRevisiondelete.php
@@ -82,6 +82,13 @@
                        'text' => 'revdelete-text-text',
                        'selected'=> 'revdelete-selected-text',
                ),
+               'contribs' => array(
+                       'check-label' => 'revdelete-hide-text',
+                       'success' => 'revdelete-success',
+                       'failure' => 'revdelete-failure',
+                       'text' => 'revdelete-text-text',
+                       'selected'=> 'revdelete-selected-text',
+               ),
                'oldimage' => array(
                        'check-label' => 'revdelete-hide-image',
                        'success' => 'revdelete-success',
@@ -206,7 +213,7 @@
                LogEventsList::showLogExtract(
                        $output,
                        'delete',
-                       $this->targetObj,
+                       ( $this->typeName === 'contribs' ) ? '' : 
$this->targetObj,
                        '', /* user */
                        array( 'lim' => 25, 'conds' => $qc, 'useMaster' => 
$this->wasSaved )
                );

-- 
To view, visit https://gerrit.wikimedia.org/r/210675
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I53aad4c844355a45bfe4296d76d24dae2021ddaa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Cenarium <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to