27require_once __DIR__ .
'/Maintenance.php';
38 parent::__construct();
40 'Maintenance script to delete revisions which refer to a nonexisting page' );
41 $this->
addOption(
'report',
'Prints out a count of affected revisions but doesn\'t delete them' );
45 $this->
output(
"Delete Orphaned Revisions\n" );
51 list( $page, $revision ) = $dbw->tableNamesN(
'page',
'revision' );
53 # Find all the orphaned revisions
54 $this->
output(
"Checking for orphaned revisions..." );
55 $sql =
"SELECT rev_id FROM {$revision} LEFT JOIN {$page} ON rev_page = page_id "
56 .
"WHERE page_namespace IS NULL";
57 $res = $dbw->query( $sql,
'deleteOrphanedRevisions' );
59 # Stash 'em all up for deletion (if needed)
61 foreach (
$res as $row ) {
62 $revisions[] = $row->rev_id;
64 $count = count( $revisions );
65 $this->
output(
"found {$count}.\n" );
68 if ( $report || $count == 0 ) {
73 # Delete each revision
74 $this->
output(
"Deleting..." );
76 $this->
output(
"done.\n" );
78 # Close the transaction and call the script to purge unused text records
91 $dbw->delete(
'revision', [
'rev_id' => $id ], __METHOD__ );
94 $dbw->delete(
'ip_changes', [
'ipc_rev_id' => $id ], __METHOD__ );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Maintenance script that deletes revisions which refer to a nonexisting page.
execute()
Do the actual work.
deleteRevs(array $id, &$dbw)
Delete one or more revisions from the database Do this inside a transaction.
__construct()
Default constructor.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
beginTransaction(IDatabase $dbw, $fname)
Begin a transcation on a DB.
commitTransaction(IDatabase $dbw, $fname)
Commit the transcation on a DB handle and wait for replica DBs to catch up.
output( $out, $channel=null)
Throw some output to the user.
getDB( $db, $groups=[], $wiki=false)
Returns a database to be used by current maintenance script.
hasOption( $name)
Checks to see if a particular option exists.
purgeRedundantText( $delete=true)
Support function for cleaning up redundant text records.
addDescription( $text)
Set the description text.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
require_once RUN_MAINTENANCE_IF_MAIN
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))