Merge "Restore formatting before split of RevisionDelete.php"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 8 Aug 2014 23:55:31 +0000 (23:55 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 8 Aug 2014 23:55:31 +0000 (23:55 +0000)
includes/revisiondelete/RevDelArchiveItem.php
includes/revisiondelete/RevDelArchiveList.php
includes/revisiondelete/RevDelArchivedFileItem.php
includes/revisiondelete/RevDelArchivedFileList.php
includes/revisiondelete/RevDelArchivedRevisionItem.php
includes/revisiondelete/RevDelFileItem.php
includes/revisiondelete/RevDelFileList.php
includes/revisiondelete/RevDelLogItem.php
includes/revisiondelete/RevDelLogList.php
includes/revisiondelete/RevDelRevisionItem.php

index d9aca88..0f1c7f0 100644 (file)
@@ -25,7 +25,8 @@
 class RevDelArchiveItem extends RevDelRevisionItem {
        public function __construct( $list, $row ) {
                RevDelItem::__construct( $list, $row );
-               $this->revision = Revision::newFromArchiveRow( $row, array( 'page' => $this->list->title->getArticleID() ) );
+               $this->revision = Revision::newFromArchiveRow( $row,
+                       array( 'page' => $this->list->title->getArticleID() ) );
        }
 
        public function getIdField() {
@@ -51,20 +52,38 @@ class RevDelArchiveItem extends RevDelRevisionItem {
 
        public function setBits( $bits ) {
                $dbw = wfGetDB( DB_MASTER );
-               $dbw->update( 'archive', array( 'ar_deleted' => $bits ), array( '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() ), __METHOD__ );
+               $dbw->update( 'archive',
+                       array( 'ar_deleted' => $bits ),
+                       array(
+                               '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()
+                       ),
+                       __METHOD__ );
 
-               return (bool) $dbw->affectedRows();
+               return (bool)$dbw->affectedRows();
        }
 
        protected function getRevisionLink() {
-               $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate( $this->revision->getTimestamp(), $this->list->getUser() ) );
+               $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
+                       $this->revision->getTimestamp(), $this->list->getUser() ) );
 
                if ( $this->isDeleted() && !$this->canViewContent() ) {
                        return $date;
                }
 
-               return Linker::link( SpecialPage::getTitleFor( 'Undelete' ), $date, array(), array( 'target' => $this->list->title->getPrefixedText(), 'timestamp' => $this->revision->getTimestamp() ) );
+               return Linker::link(
+                       SpecialPage::getTitleFor( 'Undelete' ),
+                       $date,
+                       array(),
+                       array(
+                               'target' => $this->list->title->getPrefixedText(),
+                               'timestamp' => $this->revision->getTimestamp()
+                       )
+               );
        }
 
        protected function getDiffLink() {
@@ -72,6 +91,15 @@ class RevDelArchiveItem extends RevDelRevisionItem {
                        return $this->list->msg( 'diff' )->escaped();
                }
 
-               return Linker::link( SpecialPage::getTitleFor( 'Undelete' ), $this->list->msg( 'diff' )->escaped(), array(), array( 'target' => $this->list->title->getPrefixedText(), 'diff' => 'prev', 'timestamp' => $this->revision->getTimestamp() ) );
+               return Linker::link(
+                       SpecialPage::getTitleFor( 'Undelete' ),
+                       $this->list->msg( 'diff' )->escaped(),
+                       array(),
+                       array(
+                               'target' => $this->list->title->getPrefixedText(),
+                               'diff' => 'prev',
+                               'timestamp' => $this->revision->getTimestamp()
+                       )
+               );
        }
-}
\ No newline at end of file
+}
index 07348f5..e7aed73 100644 (file)
@@ -41,7 +41,15 @@ class RevDelArchiveList extends RevDelRevisionList {
                        $timestamps[] = $db->timestamp( $id );
                }
 
-               return $db->select( 'archive', Revision::selectArchiveFields(), array( 'ar_namespace' => $this->title->getNamespace(), 'ar_title' => $this->title->getDBkey(), 'ar_timestamp' => $timestamps ), __METHOD__, array( 'ORDER BY' => 'ar_timestamp DESC' ) );
+               return $db->select( 'archive', Revision::selectArchiveFields(),
+                               array(
+                                       'ar_namespace' => $this->title->getNamespace(),
+                                       'ar_title' => $this->title->getDBkey(),
+                                       'ar_timestamp' => $timestamps
+                               ),
+                               __METHOD__,
+                               array( 'ORDER BY' => 'ar_timestamp DESC' )
+                       );
        }
 
        public function newItem( $row ) {
@@ -55,4 +63,4 @@ class RevDelArchiveList extends RevDelRevisionList {
        public function doPostCommitUpdates() {
                return Status::newGood();
        }
-}
\ No newline at end of file
+}
index dfb55ba..7c41c18 100644 (file)
@@ -50,13 +50,21 @@ class RevDelArchivedFileItem extends RevDelFileItem {
 
        public function setBits( $bits ) {
                $dbw = wfGetDB( DB_MASTER );
-               $dbw->update( 'filearchive', array( 'fa_deleted' => $bits ), array( 'fa_id' => $this->row->fa_id, 'fa_deleted' => $this->getBits(), ), __METHOD__ );
+               $dbw->update( 'filearchive',
+                       array( 'fa_deleted' => $bits ),
+                       array(
+                               'fa_id' => $this->row->fa_id,
+                               'fa_deleted' => $this->getBits(),
+                       ),
+                       __METHOD__
+               );
 
-               return (bool) $dbw->affectedRows();
+               return (bool)$dbw->affectedRows();
        }
 
        protected function getLink() {
-               $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate( $this->file->getTimestamp(), $this->list->getUser() ) );
+               $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
+                       $this->file->getTimestamp(), $this->list->getUser() ) );
 
                # Hidden files...
                if ( !$this->canViewContent() ) {
@@ -64,7 +72,13 @@ class RevDelArchivedFileItem extends RevDelFileItem {
                } else {
                        $undelete = SpecialPage::getTitleFor( 'Undelete' );
                        $key = $this->file->getKey();
-                       $link = Linker::link( $undelete, $date, array(), array( 'target' => $this->list->title->getPrefixedText(), 'file' => $key, 'token' => $this->list->getUser()->getEditToken( $key ) ) );
+                       $link = Linker::link( $undelete, $date, array(),
+                               array(
+                                       'target' => $this->list->title->getPrefixedText(),
+                                       'file' => $key,
+                                       'token' => $this->list->getUser()->getEditToken( $key )
+                               )
+                       );
                }
                if ( $this->isDeleted() ) {
                        $link = '<span class="history-deleted">' . $link . '</span>';
@@ -76,20 +90,40 @@ class RevDelArchivedFileItem extends RevDelFileItem {
        public function getApiData( ApiResult $result ) {
                $file = $this->file;
                $user = $this->list->getUser();
-               $ret = array( 'title' => $this->list->title->getPrefixedText(), 'timestamp' => wfTimestamp( TS_ISO_8601, $file->getTimestamp() ), 'width' => $file->getWidth(), 'height' => $file->getHeight(), 'size' => $file->getSize(), );
+               $ret = array(
+                       'title' => $this->list->title->getPrefixedText(),
+                       'timestamp' => wfTimestamp( TS_ISO_8601, $file->getTimestamp() ),
+                       'width' => $file->getWidth(),
+                       'height' => $file->getHeight(),
+                       'size' => $file->getSize(),
+               );
                $ret += $file->isDeleted( Revision::DELETED_USER ) ? array( 'userhidden' => '' ) : array();
                $ret += $file->isDeleted( Revision::DELETED_COMMENT ) ? array( 'commenthidden' => '' ) : array();
                $ret += $this->isDeleted() ? array( 'contenthidden' => '' ) : array();
                if ( $this->canViewContent() ) {
-                       $ret += array( 'url' => SpecialPage::getTitleFor( 'Revisiondelete' )->getLinkURL( array( 'target' => $this->list->title->getPrefixedText(), 'file' => $file->getKey(), 'token' => $user->getEditToken( $file->getKey() ) ), false, PROTO_RELATIVE ), );
+                       $ret += array(
+                               'url' => SpecialPage::getTitleFor( 'Revisiondelete' )->getLinkURL(
+                                       array(
+                                               'target' => $this->list->title->getPrefixedText(),
+                                               'file' => $file->getKey(),
+                                               'token' => $user->getEditToken( $file->getKey() )
+                                       ),
+                                       false, PROTO_RELATIVE
+                               ),
+                       );
                }
                if ( $file->userCan( Revision::DELETED_USER, $user ) ) {
-                       $ret += array( 'userid' => $file->getUser( 'id' ), 'user' => $file->getUser( 'text' ), );
+                       $ret += array(
+                               'userid' => $file->getUser( 'id' ),
+                               'user' => $file->getUser( 'text' ),
+                       );
                }
                if ( $file->userCan( Revision::DELETED_COMMENT, $user ) ) {
-                       $ret += array( 'comment' => $file->getRawDescription(), );
+                       $ret += array(
+                               'comment' => $file->getRawDescription(),
+                       );
                }
 
                return $ret;
        }
-}
\ No newline at end of file
+}
index 1538672..aec51b1 100644 (file)
@@ -38,10 +38,19 @@ class RevDelArchivedFileList extends RevDelFileList {
        public function doQuery( $db ) {
                $ids = array_map( 'intval', $this->ids );
 
-               return $db->select( 'filearchive', ArchivedFile::selectFields(), array( 'fa_name' => $this->title->getDBkey(), 'fa_id' => $ids ), __METHOD__, array( 'ORDER BY' => 'fa_id DESC' ) );
+               return $db->select(
+                       'filearchive',
+                       ArchivedFile::selectFields(),
+                       array(
+                               'fa_name' => $this->title->getDBkey(),
+                               'fa_id' => $ids
+                       ),
+                       __METHOD__,
+                       array( 'ORDER BY' => 'fa_id DESC' )
+               );
        }
 
        public function newItem( $row ) {
                return new RevDelArchivedFileItem( $this, $row );
        }
-}
\ No newline at end of file
+}
index 6a35b89..9ec548f 100644 (file)
@@ -27,7 +27,8 @@ class RevDelArchivedRevisionItem extends RevDelArchiveItem {
        public function __construct( $list, $row ) {
                RevDelItem::__construct( $list, $row );
 
-               $this->revision = Revision::newFromArchiveRow( $row, array( 'page' => $this->list->title->getArticleID() ) );
+               $this->revision = Revision::newFromArchiveRow( $row,
+                       array( 'page' => $this->list->title->getArticleID() ) );
        }
 
        public function getIdField() {
@@ -40,8 +41,13 @@ class RevDelArchivedRevisionItem extends RevDelArchiveItem {
 
        public function setBits( $bits ) {
                $dbw = wfGetDB( DB_MASTER );
-               $dbw->update( 'archive', array( 'ar_deleted' => $bits ), array( 'ar_rev_id' => $this->row->ar_rev_id, 'ar_deleted' => $this->getBits() ), __METHOD__ );
+               $dbw->update( 'archive',
+                       array( 'ar_deleted' => $bits ),
+                       array( 'ar_rev_id' => $this->row->ar_rev_id,
+                               'ar_deleted' => $this->getBits()
+                       ),
+                       __METHOD__ );
 
-               return (bool) $dbw->affectedRows();
+               return (bool)$dbw->affectedRows();
        }
-}
\ No newline at end of file
+}
index 0f1f2c4..d9472e7 100644 (file)
@@ -75,7 +75,11 @@ class RevDelFileItem extends RevDelItem {
                                # Newly undeleted
                                $key = $this->file->getStorageKey();
                                $srcRel = $this->file->repo->getDeletedHashPath( $key ) . $key;
-                               $this->list->storeBatch[] = array( $this->file->repo->getVirtualUrl( 'deleted' ) . '/' . $srcRel, 'public', $this->file->getRel() );
+                               $this->list->storeBatch[] = array(
+                                       $this->file->repo->getVirtualUrl( 'deleted' ) . '/' . $srcRel,
+                                       'public',
+                                       $this->file->getRel()
+                               );
                                $this->list->cleanupBatch[] = $key;
                        }
                } elseif ( $bits & File::DELETED_FILE ) {
@@ -87,9 +91,17 @@ class RevDelFileItem extends RevDelItem {
 
                # Do the database operations
                $dbw = wfGetDB( DB_MASTER );
-               $dbw->update( 'oldimage', array( 'oi_deleted' => $bits ), array( 'oi_name' => $this->row->oi_name, 'oi_timestamp' => $this->row->oi_timestamp, 'oi_deleted' => $this->getBits() ), __METHOD__ );
+               $dbw->update( 'oldimage',
+                       array( 'oi_deleted' => $bits ),
+                       array(
+                               'oi_name' => $this->row->oi_name,
+                               'oi_timestamp' => $this->row->oi_timestamp,
+                               'oi_deleted' => $this->getBits()
+                       ),
+                       __METHOD__
+               );
 
-               return (bool) $dbw->affectedRows();
+               return (bool)$dbw->affectedRows();
        }
 
        public function isDeleted() {
@@ -102,7 +114,8 @@ class RevDelFileItem extends RevDelItem {
         * @return string
         */
        protected function getLink() {
-               $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate( $this->file->getTimestamp(), $this->list->getUser() ) );
+               $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
+                       $this->file->getTimestamp(), $this->list->getUser() ) );
 
                if ( !$this->isDeleted() ) {
                        # Regular files...
@@ -113,7 +126,17 @@ class RevDelFileItem extends RevDelItem {
                if ( !$this->canViewContent() ) {
                        $link = $date;
                } else {
-                       $link = Linker::link( SpecialPage::getTitleFor( 'Revisiondelete' ), $date, array(), array( 'target' => $this->list->title->getPrefixedText(), 'file' => $this->file->getArchiveName(), 'token' => $this->list->getUser()->getEditToken( $this->file->getArchiveName() ) ) );
+                       $link = Linker::link(
+                               SpecialPage::getTitleFor( 'Revisiondelete' ),
+                               $date,
+                               array(),
+                               array(
+                                       'target' => $this->list->title->getPrefixedText(),
+                                       'file' => $this->file->getArchiveName(),
+                                       'token' => $this->list->getUser()->getEditToken(
+                                               $this->file->getArchiveName() )
+                               )
+                       );
                }
 
                return '<span class="history-deleted">' . $link . '</span>';
@@ -158,30 +181,57 @@ class RevDelFileItem extends RevDelItem {
        }
 
        public function getHTML() {
-               $data = $this->list->msg( 'widthheight' )->numParams( $this->file->getWidth(), $this->file->getHeight() )->text() . ' (' . $this->list->msg( 'nbytes' )->numParams( $this->file->getSize() )->text() . ')';
+               $data =
+                       $this->list->msg( 'widthheight' )->numParams(
+                               $this->file->getWidth(), $this->file->getHeight() )->text() .
+                       ' (' . $this->list->msg( 'nbytes' )->numParams( $this->file->getSize() )->text() . ')';
 
-               return '<li>' . $this->getLink() . ' ' . $this->getUserTools() . ' ' . $data . ' ' . $this->getComment() . '</li>';
+               return '<li>' . $this->getLink() . ' ' . $this->getUserTools() . ' ' .
+                       $data . ' ' . $this->getComment() . '</li>';
        }
 
        public function getApiData( ApiResult $result ) {
                $file = $this->file;
                $user = $this->list->getUser();
-               $ret = array( 'title' => $this->list->title->getPrefixedText(), 'archivename' => $file->getArchiveName(), 'timestamp' => wfTimestamp( TS_ISO_8601, $file->getTimestamp() ), 'width' => $file->getWidth(), 'height' => $file->getHeight(), 'size' => $file->getSize(), );
+               $ret = array(
+                       'title' => $this->list->title->getPrefixedText(),
+                       'archivename' => $file->getArchiveName(),
+                       'timestamp' => wfTimestamp( TS_ISO_8601, $file->getTimestamp() ),
+                       'width' => $file->getWidth(),
+                       'height' => $file->getHeight(),
+                       'size' => $file->getSize(),
+               );
                $ret += $file->isDeleted( Revision::DELETED_USER ) ? array( 'userhidden' => '' ) : array();
                $ret += $file->isDeleted( Revision::DELETED_COMMENT ) ? array( 'commenthidden' => '' ) : array();
                $ret += $this->isDeleted() ? array( 'contenthidden' => '' ) : array();
                if ( !$this->isDeleted() ) {
-                       $ret += array( 'url' => $file->getUrl(), );
+                       $ret += array(
+                               'url' => $file->getUrl(),
+                       );
                } elseif ( $this->canViewContent() ) {
-                       $ret += array( 'url' => SpecialPage::getTitleFor( 'Revisiondelete' )->getLinkURL( array( 'target' => $this->list->title->getPrefixedText(), 'file' => $file->getArchiveName(), 'token' => $user->getEditToken( $file->getArchiveName() ) ), false, PROTO_RELATIVE ), );
+                       $ret += array(
+                               'url' => SpecialPage::getTitleFor( 'Revisiondelete' )->getLinkURL(
+                                       array(
+                                               'target' => $this->list->title->getPrefixedText(),
+                                               'file' => $file->getArchiveName(),
+                                               'token' => $user->getEditToken( $file->getArchiveName() )
+                                       ),
+                                       false, PROTO_RELATIVE
+                               ),
+                       );
                }
                if ( $file->userCan( Revision::DELETED_USER, $user ) ) {
-                       $ret += array( 'userid' => $file->user, 'user' => $file->user_text, );
+                       $ret += array(
+                               'userid' => $file->user,
+                               'user' => $file->user_text,
+                       );
                }
                if ( $file->userCan( Revision::DELETED_COMMENT, $user ) ) {
-                       $ret += array( 'comment' => $file->description, );
+                       $ret += array(
+                               'comment' => $file->description,
+                       );
                }
 
                return $ret;
        }
-}
\ No newline at end of file
+}
index f485d16..8714a5e 100644 (file)
@@ -58,7 +58,16 @@ class RevDelFileList extends RevDelList {
                        $archiveNames[] = $timestamp . '!' . $this->title->getDBkey();
                }
 
-               return $db->select( 'oldimage', OldLocalFile::selectFields(), array( 'oi_name' => $this->title->getDBkey(), 'oi_archive_name' => $archiveNames ), __METHOD__, array( 'ORDER BY' => 'oi_timestamp DESC' ) );
+               return $db->select(
+                       'oldimage',
+                       OldLocalFile::selectFields(),
+                       array(
+                               'oi_name' => $this->title->getDBkey(),
+                               'oi_archive_name' => $archiveNames
+                       ),
+                       __METHOD__,
+                       array( 'ORDER BY' => 'oi_timestamp DESC' )
+               );
        }
 
        public function newItem( $row ) {
@@ -116,4 +125,4 @@ class RevDelFileList extends RevDelList {
        public function getSuppressBit() {
                return File::DELETED_RESTRICTED;
        }
-}
\ No newline at end of file
+}
index 01fc784..5c8b8c9 100644 (file)
@@ -53,27 +53,50 @@ class RevDelLogItem extends RevDelItem {
 
        public function setBits( $bits ) {
                $dbw = wfGetDB( DB_MASTER );
-               $dbw->update( 'recentchanges', array( 'rc_deleted' => $bits, 'rc_patrolled' => 1 ), array( 'rc_logid' => $this->row->log_id, 'rc_timestamp' => $this->row->log_timestamp // index
-                       ), __METHOD__ );
-               $dbw->update( 'logging', array( 'log_deleted' => $bits ), array( 'log_id' => $this->row->log_id, 'log_deleted' => $this->getBits() ), __METHOD__ );
-
-               return (bool) $dbw->affectedRows();
+               $dbw->update( 'recentchanges',
+                       array(
+                               'rc_deleted' => $bits,
+                               'rc_patrolled' => 1
+                       ),
+                       array(
+                               'rc_logid' => $this->row->log_id,
+                               'rc_timestamp' => $this->row->log_timestamp // index
+                       ),
+                       __METHOD__
+               );
+               $dbw->update( 'logging',
+                       array( 'log_deleted' => $bits ),
+                       array(
+                               'log_id' => $this->row->log_id,
+                               'log_deleted' => $this->getBits()
+                       ),
+                       __METHOD__
+               );
+
+               return (bool)$dbw->affectedRows();
        }
 
        public function getHTML() {
-               $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate( $this->row->log_timestamp, $this->list->getUser() ) );
+               $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
+                       $this->row->log_timestamp, $this->list->getUser() ) );
                $title = Title::makeTitle( $this->row->log_namespace, $this->row->log_title );
                $formatter = LogFormatter::newFromRow( $this->row );
                $formatter->setContext( $this->list->getContext() );
                $formatter->setAudience( LogFormatter::FOR_THIS_USER );
 
                // Log link for this page
-               $loglink = Linker::link( SpecialPage::getTitleFor( 'Log' ), $this->list->msg( 'log' )->escaped(), array(), array( 'page' => $title->getPrefixedText() ) );
+               $loglink = Linker::link(
+                       SpecialPage::getTitleFor( 'Log' ),
+                       $this->list->msg( 'log' )->escaped(),
+                       array(),
+                       array( 'page' => $title->getPrefixedText() )
+               );
                $loglink = $this->list->msg( 'parentheses' )->rawParams( $loglink )->escaped();
                // User links and action text
                $action = $formatter->getActionText();
                // Comment
-               $comment = $this->list->getLanguage()->getDirMark() . Linker::commentBlock( $this->row->log_comment );
+               $comment = $this->list->getLanguage()->getDirMark()
+                       . Linker::commentBlock( $this->row->log_comment );
 
                if ( LogEventsList::isDeleted( $this->row, LogPage::DELETED_COMMENT ) ) {
                        $comment = '<span class="history-deleted">' . $comment . '</span>';
@@ -85,21 +108,44 @@ class RevDelLogItem extends RevDelItem {
        public function getApiData( ApiResult $result ) {
                $logEntry = DatabaseLogEntry::newFromRow( $this->row );
                $user = $this->list->getUser();
-               $ret = array( 'id' => $logEntry->getId(), 'type' => $logEntry->getType(), 'action' => $logEntry->getSubtype(), );
-               $ret += $logEntry->isDeleted( LogPage::DELETED_USER ) ? array( 'userhidden' => '' ) : array();
-               $ret += $logEntry->isDeleted( LogPage::DELETED_COMMENT ) ? array( 'commenthidden' => '' ) : array();
-               $ret += $logEntry->isDeleted( LogPage::DELETED_ACTION ) ? array( 'actionhidden' => '' ) : array();
+               $ret = array(
+                       'id' => $logEntry->getId(),
+                       'type' => $logEntry->getType(),
+                       'action' => $logEntry->getSubtype(),
+               );
+               $ret += $logEntry->isDeleted( LogPage::DELETED_USER )
+                       ? array( 'userhidden' => '' )
+                       : array();
+               $ret += $logEntry->isDeleted( LogPage::DELETED_COMMENT )
+                       ? array( 'commenthidden' => '' )
+                       : array();
+               $ret += $logEntry->isDeleted( LogPage::DELETED_ACTION )
+                       ? array( 'actionhidden' => '' )
+                       : array();
 
                if ( LogEventsList::userCan( $this->row, LogPage::DELETED_ACTION, $user ) ) {
-                       ApiQueryLogEvents::addLogParams( $result, $ret, $logEntry->getParameters(), $logEntry->getType(), $logEntry->getSubtype(), $logEntry->getTimestamp(), $logEntry->isLegacy() );
+                       ApiQueryLogEvents::addLogParams(
+                               $result,
+                               $ret,
+                               $logEntry->getParameters(),
+                               $logEntry->getType(),
+                               $logEntry->getSubtype(),
+                               $logEntry->getTimestamp(),
+                               $logEntry->isLegacy()
+                       );
                }
                if ( LogEventsList::userCan( $this->row, LogPage::DELETED_USER, $user ) ) {
-                       $ret += array( 'userid' => $this->row->log_user, 'user' => $this->row->log_user_text, );
+                       $ret += array(
+                               'userid' => $this->row->log_user,
+                               'user' => $this->row->log_user_text,
+                       );
                }
                if ( LogEventsList::userCan( $this->row, LogPage::DELETED_COMMENT, $user ) ) {
-                       $ret += array( 'comment' => $this->row->log_comment, );
+                       $ret += array(
+                               'comment' => $this->row->log_comment,
+                       );
                }
 
                return $ret;
        }
-}
\ No newline at end of file
+}
index 933fb01..ad04042 100644 (file)
@@ -40,7 +40,12 @@ class RevDelLogList extends RevDelList {
        }
 
        public static function suggestTarget( $target, array $ids ) {
-               $result = wfGetDB( DB_SLAVE )->select( 'logging', 'log_type', array( 'log_id' => $ids ), __METHOD__, array( 'DISTINCT' ) );
+               $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 );
@@ -56,7 +61,24 @@ class RevDelLogList extends RevDelList {
        public function doQuery( $db ) {
                $ids = array_map( 'intval', $this->ids );
 
-               return $db->select( 'logging', array( 'log_id', 'log_type', 'log_action', 'log_timestamp', 'log_user', 'log_user_text', 'log_namespace', 'log_title', 'log_page', 'log_comment', 'log_params', 'log_deleted' ), array( 'log_id' => $ids ), __METHOD__, array( 'ORDER BY' => 'log_id DESC' ) );
+               return $db->select( 'logging', array(
+                               'log_id',
+                               'log_type',
+                               'log_action',
+                               'log_timestamp',
+                               'log_user',
+                               'log_user_text',
+                               'log_namespace',
+                               'log_title',
+                               'log_page',
+                               'log_comment',
+                               'log_params',
+                               'log_deleted'
+                       ),
+                       array( 'log_id' => $ids ),
+                       __METHOD__,
+                       array( 'ORDER BY' => 'log_id DESC' )
+               );
        }
 
        public function newItem( $row ) {
@@ -72,6 +94,10 @@ class RevDelLogList extends RevDelList {
        }
 
        public function getLogParams( $params ) {
-               return array( implode( ',', $params['ids'] ), "ofield={$params['oldBits']}", "nfield={$params['newBits']}" );
+               return array(
+                       implode( ',', $params['ids'] ),
+                       "ofield={$params['oldBits']}",
+                       "nfield={$params['newBits']}"
+               );
        }
-}
\ No newline at end of file
+}
index 2e953f1..81ca3d6 100644 (file)
@@ -62,15 +62,32 @@ class RevDelRevisionItem extends RevDelItem {
        public function setBits( $bits ) {
                $dbw = wfGetDB( DB_MASTER );
                // Update revision table
-               $dbw->update( 'revision', array( 'rev_deleted' => $bits ), array( 'rev_id' => $this->revision->getId(), 'rev_page' => $this->revision->getPage(), 'rev_deleted' => $this->getBits() ), __METHOD__ );
+               $dbw->update( 'revision',
+                       array( 'rev_deleted' => $bits ),
+                       array(
+                               'rev_id' => $this->revision->getId(),
+                               'rev_page' => $this->revision->getPage(),
+                               'rev_deleted' => $this->getBits()
+                       ),
+                       __METHOD__
+               );
                if ( !$dbw->affectedRows() ) {
                        // Concurrent fail!
                        return false;
                }
                // Update recentchanges table
-               $dbw->update( 'recentchanges', array( 'rc_deleted' => $bits, 'rc_patrolled' => 1 ), array( 'rc_this_oldid' => $this->revision->getId(), // condition
+               $dbw->update( 'recentchanges',
+                       array(
+                               'rc_deleted' => $bits,
+                               'rc_patrolled' => 1
+                       ),
+                       array(
+                               'rc_this_oldid' => $this->revision->getId(), // condition
                                // non-unique timestamp index
-                               'rc_timestamp' => $dbw->timestamp( $this->revision->getTimestamp() ), ), __METHOD__ );
+                               'rc_timestamp' => $dbw->timestamp( $this->revision->getTimestamp() ),
+                       ),
+                       __METHOD__
+               );
 
                return true;
        }
@@ -80,7 +97,8 @@ class RevDelRevisionItem extends RevDelItem {
        }
 
        public function isHideCurrentOp( $newBits ) {
-               return ( $newBits & Revision::DELETED_TEXT ) && $this->list->getCurrent() == $this->getId();
+               return ( $newBits & Revision::DELETED_TEXT )
+                       && $this->list->getCurrent() == $this->getId();
        }
 
        /**
@@ -89,13 +107,22 @@ class RevDelRevisionItem extends RevDelItem {
         * @return string
         */
        protected function getRevisionLink() {
-               $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate( $this->revision->getTimestamp(), $this->list->getUser() ) );
+               $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
+                       $this->revision->getTimestamp(), $this->list->getUser() ) );
 
                if ( $this->isDeleted() && !$this->canViewContent() ) {
                        return $date;
                }
 
-               return Linker::linkKnown( $this->list->title, $date, array(), array( 'oldid' => $this->revision->getId(), 'unhide' => 1 ) );
+               return Linker::linkKnown(
+                       $this->list->title,
+                       $date,
+                       array(),
+                       array(
+                               'oldid' => $this->revision->getId(),
+                               'unhide' => 1
+                       )
+               );
        }
 
        /**
@@ -107,7 +134,16 @@ class RevDelRevisionItem extends RevDelItem {
                if ( $this->isDeleted() && !$this->canViewContent() ) {
                        return $this->list->msg( 'diff' )->escaped();
                } else {
-                       return Linker::linkKnown( $this->list->title, $this->list->msg( 'diff' )->escaped(), array(), array( 'diff' => $this->revision->getId(), 'oldid' => 'prev', 'unhide' => 1 ) );
+                       return Linker::linkKnown(
+                                       $this->list->title,
+                                       $this->list->msg( 'diff' )->escaped(),
+                                       array(),
+                                       array(
+                                               'diff' => $this->revision->getId(),
+                                               'oldid' => 'prev',
+                                               'unhide' => 1
+                                       )
+                               );
                }
        }
 
@@ -127,17 +163,25 @@ class RevDelRevisionItem extends RevDelItem {
        public function getApiData( ApiResult $result ) {
                $rev = $this->revision;
                $user = $this->list->getUser();
-               $ret = array( 'id' => $rev->getId(), 'timestamp' => wfTimestamp( TS_ISO_8601, $rev->getTimestamp() ), );
+               $ret = array(
+                       'id' => $rev->getId(),
+                       'timestamp' => wfTimestamp( TS_ISO_8601, $rev->getTimestamp() ),
+               );
                $ret += $rev->isDeleted( Revision::DELETED_USER ) ? array( 'userhidden' => '' ) : array();
                $ret += $rev->isDeleted( Revision::DELETED_COMMENT ) ? array( 'commenthidden' => '' ) : array();
                $ret += $rev->isDeleted( Revision::DELETED_TEXT ) ? array( 'texthidden' => '' ) : array();
                if ( $rev->userCan( Revision::DELETED_USER, $user ) ) {
-                       $ret += array( 'userid' => $rev->getUser( Revision::FOR_THIS_USER ), 'user' => $rev->getUserText( Revision::FOR_THIS_USER ), );
+                       $ret += array(
+                               'userid' => $rev->getUser( Revision::FOR_THIS_USER ),
+                               'user' => $rev->getUserText( Revision::FOR_THIS_USER ),
+                       );
                }
                if ( $rev->userCan( Revision::DELETED_COMMENT, $user ) ) {
-                       $ret += array( 'comment' => $rev->getComment( Revision::FOR_THIS_USER ), );
+                       $ret += array(
+                               'comment' => $rev->getComment( Revision::FOR_THIS_USER ),
+                       );
                }
 
                return $ret;
        }
-}
\ No newline at end of file
+}