From: Mark A. Hershberger Date: Mon, 22 Feb 2010 00:37:05 +0000 (+0000) Subject: add --force option to delete db table rows X-Git-Tag: 1.31.0-rc.0~37661 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=b17a9e2f66a1735424595a5d62597a8ba27c29b4;p=lhc%2Fweb%2Fwiklou.git add --force option to delete db table rows --- diff --git a/maintenance/deleteArchivedFiles.php b/maintenance/deleteArchivedFiles.php index 3a575733fd..3d8253fc9f 100644 --- a/maintenance/deleteArchivedFiles.php +++ b/maintenance/deleteArchivedFiles.php @@ -37,6 +37,10 @@ class DeleteArchivedFiles extends Maintenance { $this->output( "Use --delete to actually confirm this script\n" ); return; } + $force = false; + if( $this->hasOption('force') ) { + $force = true; + } # Data should come off the master, wrapped in a transaction $dbw = wfGetDB( DB_MASTER ); $dbw->begin(); @@ -65,6 +69,10 @@ class DeleteArchivedFiles extends Maintenance { $dbw->query( "DELETE FROM $tbl_arch WHERE fa_id = $id" ); } else { $this->output( "Notice - file '$key' not found in group '$group'\n" ); + if ( $force ) { + $this->output( "Got --force, deleting DB entry\n" ); + $dbw->query( "DELETE FROM $tbl_arch WHERE fa_id = $id" ); + } } } $dbw->commit();