4 * Support functions for the deleteOrphanedRevisions maintenance script
8 * @author Rob Church <robchur@gmail.com>
12 * Delete one or more revisions from the database
13 * Do this inside a transaction
15 * @param $id Array of revision id values
16 * @param $db Database class (needs to be a master)
18 function deleteRevisions( $id, &$dbw ) {
19 if( !is_array( $id ) )
21 $dbw->delete( 'revision', array( 'rev_id' => $id ), 'deleteRevision' );
25 * Spit out script usage information and exit
27 function showUsage() {
28 echo( "Finds revisions which refer to nonexisting pages and deletes them from the database\n" );
29 echo( "USAGE: php deleteOrphanedRevisions.php [--report]\n\n" );
30 echo( " --report : Prints out a count of affected revisions but doesn't delete them\n\n" );