Localisation updates for core and extension messages from translatewiki.net (2010...
[lhc/web/wiklou.git] / maintenance / deleteArchivedRevisions.inc
1 <?php
2
3 /**
4 * Delete archived (deleted from public) revisions from the database
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * http://www.gnu.org/copyleft/gpl.html
20 *
21 * @ingroup Maintenance
22 */
23
24 class DeleteArchivedRevisionsImplementation {
25
26 /**
27 * Perform the delete on archived revisions.
28
29 * @param $maint Object An object (typically of class Maintenance)
30 * that implements two methods: handleOutput() and
31 * purgeRedundantText(). See Maintenance for a description of
32 * those methods.
33 */
34 static public function doDelete( $maint ) {
35 $dbw = wfGetDB( DB_MASTER );
36
37 $dbw->begin();
38
39 $tbl_arch = $dbw->tableName( 'archive' );
40
41 # Delete as appropriate
42 $maint->handleOutput( "Deleting archived revisions... " );
43 $dbw->query( "DELETE FROM $tbl_arch" );
44
45 $count = $dbw->affectedRows();
46 $deletedRows = $count != 0;
47
48 $maint->handleOutput( "done. $count revisions deleted.\n" );
49
50 # This bit's done
51 # Purge redundant text records
52 $dbw->commit();
53 if ( $deletedRows ) {
54 $maint->purgeRedundantText( true );
55 }
56 }
57 }