(bug 37714) Use log type in target object when deleting logs of the same type
authorAlex Monk <krenair@gmail.com>
Sat, 13 Oct 2012 13:52:49 +0000 (14:52 +0100)
committerAlex Monk <krenair@gmail.com>
Wed, 12 Dec 2012 19:18:36 +0000 (19:18 +0000)
Change-Id: I8d721ef5784df624dc0de57adcdf75a4bc3fb604

includes/specials/SpecialRevisiondelete.php

index 7856e54..eaf0d52 100644 (file)
@@ -147,6 +147,19 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                } else {
                        $this->typeName = $request->getVal( 'type' );
                        $this->targetObj = Title::newFromText( $request->getText( 'target' ) );
+                       if ( $this->targetObj && $this->targetObj->isSpecial( 'Log' ) ) {
+                               $result = wfGetDB( DB_SLAVE )->select( 'logging',
+                                       'log_type',
+                                       array( 'log_id' => $this->ids ),
+                                       __METHOD__,
+                                       array( 'DISTINCT' )
+                               );
+
+                               if ( $result->numRows() == 1 ) {
+                                       // If there's only one type, the target can be set to include it.
+                                       $this->targetObj = SpecialPage::getTitleFor( 'Log', $result->current()->log_type );
+                               }
+                       }
                }
 
                # For reviewing deleted files...