r62798 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62797‎ | r62798 | r62799 >
Date:00:37, 22 February 2010
Author:mah
Status:ok
Tags:
Comment:
add --force option to delete db table rows
Modified paths:
  • /trunk/phase3/maintenance/deleteArchivedFiles.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/deleteArchivedFiles.php
@@ -37,6 +37,10 @@
3838 $this->output( "Use --delete to actually confirm this script\n" );
3939 return;
4040 }
 41+ $force = false;
 42+ if( $this->hasOption('force') ) {
 43+ $force = true;
 44+ }
4145 # Data should come off the master, wrapped in a transaction
4246 $dbw = wfGetDB( DB_MASTER );
4347 $dbw->begin();
@@ -65,6 +69,10 @@
6670 $dbw->query( "DELETE FROM $tbl_arch WHERE fa_id = $id" );
6771 } else {
6872 $this->output( "Notice - file '$key' not found in group '$group'\n" );
 73+ if ( $force ) {
 74+ $this->output( "Got --force, deleting DB entry\n" );
 75+ $dbw->query( "DELETE FROM $tbl_arch WHERE fa_id = $id" );
 76+ }
6977 }
7078 }
7179 $dbw->commit();

Follow-up revisions

RevisionCommit summaryAuthorDate
r62800Cleanup r62798: If you add a new param then document it, simplify check for -...demon00:54, 22 February 2010

Status & tagging log