summaryrefslogtreecommitdiff
path: root/maintenance/deleteArchivedRevisions.inc
blob: f820ccb044fe03e44d61ea8282ca5f932239090b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php

/**
 * Support functions for the deleteArchivedRevisions script
 *
 * @addtogroup Maintenance
 * @author Aaron Schulz
 */
 
require_once( 'purgeOldText.inc' );

function DeleteArchivedRevisions( $delete = false ) {

	# Data should come off the master, wrapped in a transaction
	$dbw = wfGetDB( DB_MASTER );
	$dbw->begin();
	
	$tbl_arch = $dbw->tableName( 'archive' );
	# Delete as appropriate
	echo( "Deleting archived revisions..." );
	$dbw->query( "TRUNCATE TABLE $tbl_arch" );
	echo( "done.\n" );
	
	$delete = $dbw->affectedRows() != 0;
	
	# This bit's done
	# Purge redundant text records
	$dbw->commit();
	if( $delete ) {
		PurgeRedundantText( true );
	}

}

?>