From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Dec 2013 09:55:49 +0100 Subject: Update to MediaWiki 1.22.0 --- includes/revisiondelete/RevisionDelete.php | 86 ++++++++++++++++++++++-------- 1 file changed, 64 insertions(+), 22 deletions(-) (limited to 'includes/revisiondelete/RevisionDelete.php') diff --git a/includes/revisiondelete/RevisionDelete.php b/includes/revisiondelete/RevisionDelete.php index f4c07968..71850877 100644 --- a/includes/revisiondelete/RevisionDelete.php +++ b/includes/revisiondelete/RevisionDelete.php @@ -41,6 +41,19 @@ class RevDel_RevisionList extends RevDel_List { 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 $rev ? $rev->getTitle() : $target; + } + /** * @param $db DatabaseBase * @return mixed @@ -52,7 +65,7 @@ class RevDel_RevisionList extends RevDel_List { array_merge( Revision::selectFields(), Revision::selectUserFields() ), array( 'rev_page' => $this->title->getArticleID(), - 'rev_id' => $ids, + 'rev_id' => $ids, ), __METHOD__, array( 'ORDER BY' => 'rev_id DESC' ), @@ -242,8 +255,7 @@ class RevDel_RevisionItem extends RevDel_Item { if ( $this->isDeleted() && !$this->canViewContent() ) { return $this->list->msg( 'diff' )->escaped(); } else { - return - Linker::linkKnown( + return Linker::linkKnown( $this->list->title, $this->list->msg( 'diff' )->escaped(), array(), @@ -293,7 +305,7 @@ class RevDel_ArchiveList extends RevDel_RevisionList { return $db->select( 'archive', '*', array( 'ar_namespace' => $this->title->getNamespace(), - 'ar_title' => $this->title->getDBkey(), + 'ar_title' => $this->title->getDBkey(), 'ar_timestamp' => $timestamps ), __METHOD__, @@ -350,12 +362,12 @@ class RevDel_ArchiveItem extends RevDel_RevisionItem { $dbw->update( 'archive', array( 'ar_deleted' => $bits ), array( - 'ar_namespace' => $this->list->title->getNamespace(), - 'ar_title' => $this->list->title->getDBkey(), + 'ar_namespace' => $this->list->title->getNamespace(), + 'ar_title' => $this->list->title->getDBkey(), // use timestamp for index - 'ar_timestamp' => $this->row->ar_timestamp, - 'ar_rev_id' => $this->row->ar_rev_id, - 'ar_deleted' => $this->getBits() + 'ar_timestamp' => $this->row->ar_timestamp, + 'ar_rev_id' => $this->row->ar_rev_id, + 'ar_deleted' => $this->getBits() ), __METHOD__ ); return (bool)$dbw->affectedRows(); @@ -442,6 +454,14 @@ class RevDel_FileList extends RevDel_List { return 'oi_archive_name'; } + public static function getRestriction() { + return 'deleterevision'; + } + + public static function getRevdelConstant() { + return File::DELETED_FILE; + } + var $storeBatch, $deleteBatch, $cleanupBatch; /** @@ -450,14 +470,14 @@ class RevDel_FileList extends RevDel_List { */ public function doQuery( $db ) { $archiveNames = array(); - foreach( $this->ids as $timestamp ) { + foreach ( $this->ids as $timestamp ) { $archiveNames[] = $timestamp . '!' . $this->title->getDBkey(); } return $db->select( 'oldimage', OldLocalFile::selectFields(), array( - 'oi_name' => $this->title->getDBkey(), + 'oi_name' => $this->title->getDBkey(), 'oi_archive_name' => $archiveNames ), __METHOD__, @@ -635,8 +655,8 @@ class RevDel_FileItem extends RevDel_Item { array(), array( 'target' => $this->list->title->getPrefixedText(), - 'file' => $this->file->getArchiveName(), - 'token' => $this->list->getUser()->getEditToken( + 'file' => $this->file->getArchiveName(), + 'token' => $this->list->getUser()->getEditToken( $this->file->getArchiveName() ) ) ); @@ -648,13 +668,13 @@ class RevDel_FileItem extends RevDel_Item { * @return string HTML */ protected function getUserTools() { - if( $this->file->userCan( Revision::DELETED_USER, $this->list->getUser() ) ) { + if ( $this->file->userCan( Revision::DELETED_USER, $this->list->getUser() ) ) { $link = Linker::userLink( $this->file->user, $this->file->user_text ) . Linker::userToolLinks( $this->file->user, $this->file->user_text ); } else { $link = $this->list->msg( 'rev-deleted-user' )->escaped(); } - if( $this->file->isDeleted( Revision::DELETED_USER ) ) { + if ( $this->file->isDeleted( Revision::DELETED_USER ) ) { return '' . $link . ''; } return $link; @@ -667,12 +687,12 @@ class RevDel_FileItem extends RevDel_Item { * @return string HTML */ protected function getComment() { - if( $this->file->userCan( File::DELETED_COMMENT, $this->list->getUser() ) ) { + if ( $this->file->userCan( File::DELETED_COMMENT, $this->list->getUser() ) ) { $block = Linker::commentBlock( $this->file->description ); } else { $block = ' ' . $this->list->msg( 'rev-deleted-comment' )->escaped(); } - if( $this->file->isDeleted( File::DELETED_COMMENT ) ) { + if ( $this->file->isDeleted( File::DELETED_COMMENT ) ) { return "$block"; } return $block; @@ -685,7 +705,7 @@ class RevDel_FileItem extends RevDel_Item { ' (' . $this->list->msg( 'nbytes' )->numParams( $this->file->getSize() )->text() . ')'; return '
  • ' . $this->getLink() . ' ' . $this->getUserTools() . ' ' . - $data . ' ' . $this->getComment(). '
  • '; + $data . ' ' . $this->getComment() . ''; } } @@ -712,7 +732,7 @@ class RevDel_ArchivedFileList extends RevDel_FileList { ArchivedFile::selectFields(), array( 'fa_name' => $this->title->getDBkey(), - 'fa_id' => $ids + 'fa_id' => $ids ), __METHOD__, array( 'ORDER BY' => 'fa_id DESC' ) @@ -771,7 +791,7 @@ class RevDel_ArchivedFileItem extends RevDel_FileItem { $this->file->getTimestamp(), $this->list->getUser() ) ); # Hidden files... - if( !$this->canViewContent() ) { + if ( !$this->canViewContent() ) { $link = $date; } else { $undelete = SpecialPage::getTitleFor( 'Undelete' ); @@ -784,7 +804,7 @@ class RevDel_ArchivedFileItem extends RevDel_FileItem { ) ); } - if( $this->isDeleted() ) { + if ( $this->isDeleted() ) { $link = '' . $link . ''; } return $link; @@ -803,6 +823,28 @@ class RevDel_LogList extends RevDel_List { return 'log_id'; } + public static function getRestriction() { + return 'deletelogentry'; + } + + public static function getRevdelConstant() { + return LogPage::DELETED_ACTION; + } + + public static function suggestTarget( $target, array $ids ) { + $result = wfGetDB( DB_SLAVE )->select( 'logging', + 'log_type', + array( 'log_id' => $ids ), + __METHOD__, + array( 'DISTINCT' ) + ); + if ( $result->numRows() == 1 ) { + // If there's only one type, the target can be set to include it. + return SpecialPage::getTitleFor( 'Log', $result->current()->log_type ); + } + return SpecialPage::getTitleFor( 'Log' ); + } + /** * @param $db DatabaseBase * @return mixed @@ -913,7 +955,7 @@ class RevDel_LogItem extends RevDel_Item { $action = $formatter->getActionText(); // Comment $comment = $this->list->getLanguage()->getDirMark() . Linker::commentBlock( $this->row->log_comment ); - if( LogEventsList::isDeleted( $this->row, LogPage::DELETED_COMMENT ) ) { + if ( LogEventsList::isDeleted( $this->row, LogPage::DELETED_COMMENT ) ) { $comment = '' . $comment . ''; } -- cgit v1.2.2