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