From 183851b06bd6c52f3cae5375f433da720d410447 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 11 Oct 2006 18:12:39 +0000 Subject: MediaWiki 1.7.1 wiederhergestellt --- maintenance/deleteOrphanedRevisions.inc.php | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 maintenance/deleteOrphanedRevisions.inc.php (limited to 'maintenance/deleteOrphanedRevisions.inc.php') diff --git a/maintenance/deleteOrphanedRevisions.inc.php b/maintenance/deleteOrphanedRevisions.inc.php new file mode 100644 index 00000000..7cfb1c6b --- /dev/null +++ b/maintenance/deleteOrphanedRevisions.inc.php @@ -0,0 +1,33 @@ + + */ + +/** + * Delete one or more revisions from the database + * Do this inside a transaction + * + * @param $id Array of revision id values + * @param $db Database class (needs to be a master) + */ +function deleteRevisions( $id, &$dbw ) { + if( !is_array( $id ) ) + $id = array( $id ); + $dbw->delete( 'revision', array( 'rev_id' => $id ), 'deleteRevision' ); +} + +/** + * Spit out script usage information and exit + */ +function showUsage() { + echo( "Finds revisions which refer to nonexisting pages and deletes them from the database\n" ); + echo( "USAGE: php deleteOrphanedRevisions.php [--report]\n\n" ); + echo( " --report : Prints out a count of affected revisions but doesn't delete them\n\n" ); +} + +?> \ No newline at end of file -- cgit v1.2.2