Merge "Revert "Add .gitignore to the /skins directory""
[lhc/web/wiklou.git] / includes / revisiondelete / RevisionDelete.php
index 191286d..0c887e4 100644 (file)
@@ -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
@@ -441,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;
 
        /**
@@ -648,8 +669,9 @@ class RevDel_FileItem extends RevDel_Item {
         */
        protected function getUserTools() {
                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 );
+                       $uid = $this->file->getUser( 'id' );
+                       $name = $this->file->getUser( 'text' );
+                       $link = Linker::userLink( $uid, $name ) . Linker::userToolLinks( $uid, $name );
                } else {
                        $link = $this->list->msg( 'rev-deleted-user' )->escaped();
                }
@@ -667,7 +689,7 @@ class RevDel_FileItem extends RevDel_Item {
         */
        protected function getComment() {
                if ( $this->file->userCan( File::DELETED_COMMENT, $this->list->getUser() ) ) {
-                       $block = Linker::commentBlock( $this->file->description );
+                       $block = Linker::commentBlock( $this->file->getDescription() );
                } else {
                        $block = ' ' . $this->list->msg( 'rev-deleted-comment' )->escaped();
                }
@@ -802,6 +824,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