summaryrefslogtreecommitdiff
path: root/maintenance/deleteArchivedRevisions.inc
blob: 67e4c5a26175741eb1d757c9d9f83bc7851cc1a1 (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
<?php

/**
 * Support functions for the deleteArchivedRevisions script
 *
 * @file
 * @ingroup 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 );
	}

}