X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FrefreshFileHeaders.php;h=e07550151840978ae6662f56888afbd00fc0768a;hb=c71fde92ad0a9edce65a41b5482d7e4e54eb127f;hp=6bc72ec838046cd0e829db51009571bf92ca8632;hpb=77a8bbd406de8194432bbc92ce0b781ba44b43bc;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/refreshFileHeaders.php b/maintenance/refreshFileHeaders.php index 6bc72ec838..e075501518 100644 --- a/maintenance/refreshFileHeaders.php +++ b/maintenance/refreshFileHeaders.php @@ -34,7 +34,7 @@ require_once __DIR__ . '/Maintenance.php'; class RefreshFileHeaders extends Maintenance { function __construct() { parent::__construct(); - $this->mDescription = 'Script to update file HTTP headers'; + $this->addDescription( 'Script to update file HTTP headers' ); $this->addOption( 'verbose', 'Output information about each file.', false, false, 'v' ); $this->addOption( 'start', 'Name of file to start with', false, true ); $this->addOption( 'end', 'Name of file to end with', false, true ); @@ -47,14 +47,14 @@ class RefreshFileHeaders extends Maintenance { $end = str_replace( ' ', '_', $this->getOption( 'end', '' ) ); // page on img_name $count = 0; - $dbr = $this->getDB( DB_SLAVE ); + $dbr = $this->getDB( DB_REPLICA ); do { - $conds = array( "img_name > {$dbr->addQuotes( $start )}" ); + $conds = [ "img_name > {$dbr->addQuotes( $start )}" ]; if ( strlen( $end ) ) { $conds[] = "img_name <= {$dbr->addQuotes( $end )}"; } $res = $dbr->select( 'image', '*', $conds, - __METHOD__, array( 'LIMIT' => $this->mBatchSize, 'ORDER BY' => 'img_name ASC' ) ); + __METHOD__, [ 'LIMIT' => $this->mBatchSize, 'ORDER BY' => 'img_name ASC' ] ); foreach ( $res as $row ) { $file = $repo->newFileFromRow( $row ); $headers = $file->getStreamHeaders(); @@ -80,9 +80,9 @@ class RefreshFileHeaders extends Maintenance { } protected function updateFileHeaders( File $file, array $headers ) { - $status = $file->getRepo()->getBackend()->describe( array( + $status = $file->getRepo()->getBackend()->describe( [ 'src' => $file->getPath(), 'headers' => $headers - ) ); + ] ); if ( !$status->isGood() ) { $this->error( "Encountered error: " . print_r( $status, true ) ); }