* Make tests work better together. Tests are now skipped or marked incomplete.
[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 static public function doDelete($output) {
27 $dbw = wfGetDB( DB_MASTER );
28
29 $dbw->begin();
30
31 $tbl_arch = $dbw->tableName( 'archive' );
32
33 # Delete as appropriate
34 $output->handleOutput( "Deleting archived revisions... " );
35 $dbw->query( "TRUNCATE TABLE $tbl_arch" );
36
37 $count = $dbw->affectedRows();
38 $deletedRows = $count != 0;
39
40 $output->handleOutput( "done. $count revisions deleted.\n" );
41
42 # This bit's done
43 # Purge redundant text records
44 $dbw->commit();
45 if( $deletedRows ) {
46 $output->purgeRedundantText( true );
47 }
48 }
49 }