]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - maintenance/deleteOrphanedRevisions.inc.php
MediaWiki 1.14.0-scripts
[autoinstallsdev/mediawiki.git] / maintenance / deleteOrphanedRevisions.inc.php
1 <?php
2
3 /**
4  * Support functions for the deleteOrphanedRevisions maintenance script
5  *
6  * @file
7  * @ingroup Maintenance
8  * @author Rob Church <robchur@gmail.com>
9  */
10
11 /**
12  * Delete one or more revisions from the database
13  * Do this inside a transaction
14  *
15  * @param $id Array of revision id values
16  * @param $db Database class (needs to be a master)
17  */
18 function deleteRevisions( $id, &$dbw ) {
19         if( !is_array( $id ) )
20                 $id = array( $id );
21         $dbw->delete( 'revision', array( 'rev_id' => $id ), 'deleteRevision' );
22 }
23
24 /**
25  * Spit out script usage information and exit
26  */
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" );
31 }
32