From 5942fe4295f1dd3a3b7bbea4132d9951c5713c88 Mon Sep 17 00:00:00 2001 From: Kevin Israel Date: Fri, 12 Sep 2014 04:00:00 -0400 Subject: [PATCH] Delete maintenance/purgeOldText.inc The only function it contains (PurgeRedundantText()) was superseded by Maintenance::purgeRedundantText() in r52006, yet the file had not been deleted. I grepped core and extensions in Gerrit for the names of both the function and the file and found no usage. The purgeOldText.php maintenance script uses the "new" (since 1.16) method and has been retained. Change-Id: I40afbd264242eab7fadc8352380779074d61d7f8 --- RELEASE-NOTES-1.24 | 3 ++ maintenance/purgeOldText.inc | 80 ------------------------------------ 2 files changed, 3 insertions(+), 80 deletions(-) delete mode 100644 maintenance/purgeOldText.inc diff --git a/RELEASE-NOTES-1.24 b/RELEASE-NOTES-1.24 index 13a0a6d18c..8733f94019 100644 --- a/RELEASE-NOTES-1.24 +++ b/RELEASE-NOTES-1.24 @@ -492,6 +492,9 @@ changes to languages because of Bugzilla reports. * (bug 67368) LESS functions embed() and embeddable(), added in MediaWiki 1.23 and broken by design, have been removed. Use appropriate LESS mixins instead. * Removed cssjanus.py from maintenance directory as it was unused. +* Removed maintenance/purgeOldText.inc and the PurgeRedundantText() function + it contained (superseded by Maintenance::purgeRedundantText() in 1.16). + The purgeOldText.php maintenance script has been retained. ==== Renamed classes ==== * CLDRPluralRuleConverter_Expression to CLDRPluralRuleConverterExpression diff --git a/maintenance/purgeOldText.inc b/maintenance/purgeOldText.inc deleted file mode 100644 index 5093cb391b..0000000000 --- a/maintenance/purgeOldText.inc +++ /dev/null @@ -1,80 +0,0 @@ - - */ - -/** - * @param bool $delete - */ -function PurgeRedundantText( $delete = false ) { - - # Data should come off the master, wrapped in a transaction - $dbw = wfGetDB( DB_MASTER ); - $dbw->begin( __METHOD__ ); - - $tbl_arc = $dbw->tableName( 'archive' ); - $tbl_rev = $dbw->tableName( 'revision' ); - $tbl_txt = $dbw->tableName( 'text' ); - - # Get "active" text records from the revisions table - echo "Searching for active text records in revisions table..."; - $res = $dbw->query( "SELECT DISTINCT rev_text_id FROM $tbl_rev" ); - foreach ( $res as $row ) { - $cur[] = $row->rev_text_id; - } - echo "done.\n"; - - # Get "active" text records from the archive table - echo "Searching for active text records in archive table..."; - $res = $dbw->query( "SELECT DISTINCT ar_text_id FROM $tbl_arc" ); - $cur = array(); - foreach ( $res as $row ) { - $cur[] = $row->ar_text_id; - } - echo "done.\n"; - - # Get the IDs of all text records not in these sets - echo "Searching for inactive text records..."; - $set = implode( ', ', $cur ); - $res = $dbw->query( "SELECT old_id FROM $tbl_txt WHERE old_id NOT IN ( $set )" ); - $old = array(); - foreach ( $res as $row ) { - $old[] = $row->old_id; - } - echo "done.\n"; - - # Inform the user of what we're going to do - $count = count( $old ); - echo "$count inactive items found.\n"; - - # Delete as appropriate - if ( $delete && $count ) { - echo "Deleting..."; - $set = implode( ', ', $old ); - $dbw->query( "DELETE FROM $tbl_txt WHERE old_id IN ( $set )" ); - echo "done.\n"; - } - - # Done - $dbw->commit( __METHOD__ ); -} -- 2.20.1