X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FeraseArchivedFile.php;h=1ddc0f509776f39187e963163e1ac7e5bcce233a;hb=5120937028f768749d058aa91dde82a96de0af1c;hp=69a95e20bd5d5913b24bbb1b12d34d835e23de8e;hpb=a7f35b785943ecf471095e79bc907aa5bbe228ca;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/eraseArchivedFile.php b/maintenance/eraseArchivedFile.php index 69a95e20bd..d94d49b72b 100644 --- a/maintenance/eraseArchivedFile.php +++ b/maintenance/eraseArchivedFile.php @@ -19,7 +19,6 @@ * * @file * @ingroup Maintenance - * @author Aaron Schulz */ require_once __DIR__ . '/Maintenance.php'; @@ -35,7 +34,7 @@ require_once __DIR__ . '/Maintenance.php'; class EraseArchivedFile extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Erases traces of deleted files."; + $this->addDescription( 'Erases traces of deleted files.' ); $this->addOption( 'delete', 'Perform the deletion' ); $this->addOption( 'filename', 'File name', false, true ); $this->addOption( 'filekey', 'File storage key (with extension) or "*"', true, true ); @@ -56,9 +55,10 @@ class EraseArchivedFile extends Maintenance { $afile = false; } else { // specified version $dbw = $this->getDB( DB_MASTER ); - $row = $dbw->selectRow( 'filearchive', '*', - array( 'fa_storage_group' => 'deleted', 'fa_storage_key' => $filekey ), - __METHOD__ ); + $fileQuery = ArchivedFile::getQueryInfo(); + $row = $dbw->selectRow( $fileQuery['tables'], $fileQuery['fields'], + [ 'fa_storage_group' => 'deleted', 'fa_storage_key' => $filekey ], + __METHOD__, [], $fileQuery['joins'] ); if ( !$row ) { $this->error( "No deleted file exists with key '$filekey'.", 1 ); } @@ -86,9 +86,10 @@ class EraseArchivedFile extends Maintenance { protected function scrubAllVersions( $name ) { $dbw = $this->getDB( DB_MASTER ); - $res = $dbw->select( 'filearchive', '*', - array( 'fa_name' => $name, 'fa_storage_group' => 'deleted' ), - __METHOD__ ); + $fileQuery = ArchivedFile::getQueryInfo(); + $res = $dbw->select( $fileQuery['tables'], $fileQuery['fields'], + [ 'fa_name' => $name, 'fa_storage_group' => 'deleted' ], + __METHOD__, [], $fileQuery['joins'] ); foreach ( $res as $row ) { $this->scrubVersion( ArchivedFile::newFromRow( $row ) ); } @@ -101,7 +102,7 @@ class EraseArchivedFile extends Maintenance { $repo = RepoGroup::singleton()->getLocalRepo(); $path = $repo->getZonePath( 'deleted' ) . '/' . $repo->getDeletedHashPath( $key ) . $key; if ( $this->hasOption( 'delete' ) ) { - $status = $repo->getBackend()->delete( array( 'src' => $path ) ); + $status = $repo->getBackend()->delete( [ 'src' => $path ] ); if ( $status->isOK() ) { $this->output( "Deleted version '$key' ($ts) of file '$name'\n" ); } else {