Nobody wants to touch this....
[mediawiki.git] / maintenance / deleteOrphanedRevisions.inc.php
blob707eaf98d8ae750f33b78573ccd9a3d4bae738e5
1 <?php
3 /**
4 * Support functions for the deleteOrphanedRevisions maintenance script
6 * @addtogroup Maintenance
7 * @author Rob Church <robchur@gmail.com>
8 */
10 /**
11 * Delete one or more revisions from the database
12 * Do this inside a transaction
14 * @param $id Array of revision id values
15 * @param $db Database class (needs to be a master)
17 function deleteRevisions( $id, &$dbw ) {
18 if( !is_array( $id ) )
19 $id = array( $id );
20 $dbw->delete( 'revision', array( 'rev_id' => $id ), 'deleteRevision' );
23 /**
24 * Spit out script usage information and exit
26 function showUsage() {
27 echo( "Finds revisions which refer to nonexisting pages and deletes them from the database\n" );
28 echo( "USAGE: php deleteOrphanedRevisions.php [--report]\n\n" );
29 echo( " --report : Prints out a count of affected revisions but doesn't delete them\n\n" );