svn:eol-style native

This commit is contained in:
Antoine Musso 2007-05-12 17:56:09 +00:00
parent 00b3b67205
commit 9288ab2f48
4 changed files with 150 additions and 150 deletions

View file

@ -1,57 +1,57 @@
<?php
/**
* Support functions for the deleteArchivedFiles script
*
* @addtogroup Maintenance
* @author Aaron Schulz
*/
require_once( "$IP/includes/FileStore.php" );
function DeleteArchivedFiles( $delete = false ) {
# Data should come off the master, wrapped in a transaction
$dbw = wfGetDB( DB_MASTER );
$dbw->begin();
$transaction = new FSTransaction();
if( !FileStore::lock() ) {
wfDebug( __METHOD__.": failed to acquire file store lock, aborting\n" );
return false;
}
$tbl_arch = $dbw->tableName( 'filearchive' );
# Get "active" revisions from the filearchive table
echo( "Searching for and deleting archived files...\n" );
$res = $dbw->query( "SELECT fa_id,fa_storage_group,fa_storage_key FROM $tbl_arch" );
while( $row = $dbw->fetchObject( $res ) ) {
$key = $row->fa_storage_key;
$group = $row->fa_storage_group;
$id = $row->fa_id;
$store = FileStore::get( $group );
if ( $store ) {
$path = $store->filePath( $key );
if ( $path && file_exists($path) ) {
$transaction->addCommit( FSTransaction::DELETE_FILE, $path );
$dbw->query( "DELETE FROM $tbl_arch WHERE fa_id = $id" );
} else {
echo( "Notice - file '$key' not found in group '$group'\n" );
}
} else {
echo( "Notice - invalid file storage group '$group'\n" );
}
}
echo( "done.\n" );
$transaction->commit();
# This bit's done
# Purge redundant text records
$dbw->commit();
}
<?php
/**
* Support functions for the deleteArchivedFiles script
*
* @addtogroup Maintenance
* @author Aaron Schulz
*/
require_once( "$IP/includes/FileStore.php" );
function DeleteArchivedFiles( $delete = false ) {
# Data should come off the master, wrapped in a transaction
$dbw = wfGetDB( DB_MASTER );
$dbw->begin();
$transaction = new FSTransaction();
if( !FileStore::lock() ) {
wfDebug( __METHOD__.": failed to acquire file store lock, aborting\n" );
return false;
}
$tbl_arch = $dbw->tableName( 'filearchive' );
# Get "active" revisions from the filearchive table
echo( "Searching for and deleting archived files...\n" );
$res = $dbw->query( "SELECT fa_id,fa_storage_group,fa_storage_key FROM $tbl_arch" );
while( $row = $dbw->fetchObject( $res ) ) {
$key = $row->fa_storage_key;
$group = $row->fa_storage_group;
$id = $row->fa_id;
$store = FileStore::get( $group );
if ( $store ) {
$path = $store->filePath( $key );
if ( $path && file_exists($path) ) {
$transaction->addCommit( FSTransaction::DELETE_FILE, $path );
$dbw->query( "DELETE FROM $tbl_arch WHERE fa_id = $id" );
} else {
echo( "Notice - file '$key' not found in group '$group'\n" );
}
} else {
echo( "Notice - invalid file storage group '$group'\n" );
}
}
echo( "done.\n" );
$transaction->commit();
# This bit's done
# Purge redundant text records
$dbw->commit();
}
?>

View file

@ -1,31 +1,31 @@
<?php
/**
* Delete archived (non-current) files from the database
*
* @addtogroup Maintenance
* @author Aaron Schulz
* Based on deleteOldRevisions.php by Rob Church
*/
$options = array( 'delete', 'help' );
require_once( 'commandLine.inc' );
require_once( 'deleteArchivedFiles.inc' );
echo( "Delete Archived Images\n\n" );
if( @$options['help'] ) {
ShowUsage();
} else {
DeleteArchivedFiles( @$options['delete'] );
}
function ShowUsage() {
echo( "Deletes all archived images.\n\n" );
echo( "These images will no longer be restorable.\n\n" );
echo( "Usage: php deleteArchivedRevisions.php [--delete|--help]\n\n" );
echo( "delete : Performs the deletion\n" );
echo( " help : Show this usage information\n" );
}
<?php
/**
* Delete archived (non-current) files from the database
*
* @addtogroup Maintenance
* @author Aaron Schulz
* Based on deleteOldRevisions.php by Rob Church
*/
$options = array( 'delete', 'help' );
require_once( 'commandLine.inc' );
require_once( 'deleteArchivedFiles.inc' );
echo( "Delete Archived Images\n\n" );
if( @$options['help'] ) {
ShowUsage();
} else {
DeleteArchivedFiles( @$options['delete'] );
}
function ShowUsage() {
echo( "Deletes all archived images.\n\n" );
echo( "These images will no longer be restorable.\n\n" );
echo( "Usage: php deleteArchivedRevisions.php [--delete|--help]\n\n" );
echo( "delete : Performs the deletion\n" );
echo( " help : Show this usage information\n" );
}
?>

View file

@ -1,35 +1,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 );
}
}
<?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 );
}
}
?>

View file

@ -1,31 +1,31 @@
<?php
/**
* Delete arcived (deleted from public) revisions from the database
*
* @addtogroup Maintenance
* @author Aaron Schulz
* Shamelessly stolen from deleteOldRevisions.php by Rob Church :)
*/
$options = array( 'delete', 'help' );
require_once( 'commandLine.inc' );
require_once( 'deleteArchivedRevisions.inc' );
echo( "Delete Archived Revisions\n\n" );
if( @$options['help'] ) {
ShowUsage();
} else {
DeleteArchivedRevisions( @$options['delete'] );
}
function ShowUsage() {
echo( "Deletes all archived revisions.\n\n" );
echo( "These revisions will no longer be restorable.\n\n" );
echo( "Usage: php deleteArchivedRevisions.php [--delete|--help]\n\n" );
echo( "delete : Performs the deletion\n" );
echo( " help : Show this usage information\n" );
}
<?php
/**
* Delete arcived (deleted from public) revisions from the database
*
* @addtogroup Maintenance
* @author Aaron Schulz
* Shamelessly stolen from deleteOldRevisions.php by Rob Church :)
*/
$options = array( 'delete', 'help' );
require_once( 'commandLine.inc' );
require_once( 'deleteArchivedRevisions.inc' );
echo( "Delete Archived Revisions\n\n" );
if( @$options['help'] ) {
ShowUsage();
} else {
DeleteArchivedRevisions( @$options['delete'] );
}
function ShowUsage() {
echo( "Deletes all archived revisions.\n\n" );
echo( "These revisions will no longer be restorable.\n\n" );
echo( "Usage: php deleteArchivedRevisions.php [--delete|--help]\n\n" );
echo( "delete : Performs the deletion\n" );
echo( " help : Show this usage information\n" );
}
?>