Restore all the search messages destroyed by r42366
[lhc/web/wiklou.git] / maintenance / deleteBatch.php
index 3021b11..d10948a 100644 (file)
@@ -1,12 +1,17 @@
 <?php
 
-# delete a batch of pages
-# Usage: php deleteBatch.php [-u <user>] [-r <reason>] [-i <interval>] <listfile>
-# where
-#      <listfile> is a file where each line contains the title of a page to be deleted.
-#      <user> is the username
-#      <reason> is the delete reason
-#      <interval> is the number of seconds to sleep for after each delete
+/**
+ * Deletes a batch of pages
+ * Usage: php deleteBatch.php [-u <user>] [-r <reason>] [-i <interval>] <listfile>
+ * where
+ *     <listfile> is a file where each line contains the title of a page to be deleted.
+ *     <user> is the username
+ *     <reason> is the delete reason
+ *     <interval> is the number of seconds to sleep for after each delete
+ *
+ * @file
+ * @ingroup Maintenance
+ */
 
 $oldCwd = getcwd();
 $optionsWithArgs = array( 'u', 'r', 'i' );
@@ -67,6 +72,10 @@ for ( $linenum = 1; !feof( $file ); $linenum++ ) {
        $dbw->begin();
        if( $page->getNamespace() == NS_IMAGE ) {
                $art = new ImagePage( $page );
+               $img = wfFindFile( $art->mTitle );
+               if( !$img || !$img->delete( $reason ) ) {
+                       print "FAILED to delete image file... ";
+               }
        } else {
                $art = new Article( $page );
        }
@@ -75,7 +84,7 @@ for ( $linenum = 1; !feof( $file ); $linenum++ ) {
        if ( $success ) {
                print "\n";
        } else {
-               print " FAILED\n";
+               print " FAILED to delete image page\n";
        }
 
        if ( $interval ) {
@@ -85,4 +94,4 @@ for ( $linenum = 1; !feof( $file ); $linenum++ ) {
 }
 
 
-?>
+