'adviseStat' => true // avoid HEADs
] );
if ( $srcPathsRel === null ) {
- $this->error( "Could not list files in $container.", 1 ); // die
+ $this->fatalError( "Could not list files in $container." );
}
}
'adviseStat' => true // avoid HEADs
] );
if ( $dstPathsRel === null ) {
- $this->error( "Could not list files in $container.", 1 ); // die
+ $this->fatalError( "Could not list files in $container." );
}
$this->statCache = [];
foreach ( $dstPathsRel as $dstPathRel ) {
* @param FileBackend $src
* @param FileBackend $dst
* @param string $backendRel
- * @return array (rel paths in $src minus those in $dst)
+ * @return string[] (rel paths in $src minus those in $dst)
*/
protected function getListingDiffRel( FileBackend $src, FileBackend $dst, $backendRel ) {
$srcPathsRel = $src->getFileList( [
'dir' => $src->getRootStoragePath() . "/$backendRel" ] );
if ( $srcPathsRel === null ) {
- $this->error( "Could not list files in source container.", 1 ); // die
+ $this->fatalError( "Could not list files in source container." );
}
$dstPathsRel = $dst->getFileList( [
'dir' => $dst->getRootStoragePath() . "/$backendRel" ] );
if ( $dstPathsRel === null ) {
- $this->error( "Could not list files in destination container.", 1 ); // die
+ $this->fatalError( "Could not list files in destination container." );
}
// Get the list of destination files
$relFilesDstSha1 = [];
}
/**
- * @param array $srcPathsRel
+ * @param string[] $srcPathsRel
* @param string $backendRel
* @param FileBackend $src
* @param FileBackend $dst
$status = $dst->prepare( [ 'dir' => dirname( $dstPath ), 'bypassReadOnly' => 1 ] );
if ( !$status->isOK() ) {
$this->error( print_r( $status->getErrorsArray(), true ) );
- $this->error( "$wikiId: Could not copy $srcPath to $dstPath.", 1 ); // die
+ $this->fatalError( "$wikiId: Could not copy $srcPath to $dstPath." );
}
$ops[] = [ 'op' => 'store',
'src' => $fsFile->getPath(), 'dst' => $dstPath, 'overwrite' => 1 ];
$elapsed_ms = floor( ( microtime( true ) - $t_start ) * 1000 );
if ( !$status->isOK() ) {
$this->error( print_r( $status->getErrorsArray(), true ) );
- $this->error( "$wikiId: Could not copy file batch.", 1 ); // die
+ $this->fatalError( "$wikiId: Could not copy file batch." );
} elseif ( count( $copiedRel ) ) {
$this->output( "\n\tCopied these file(s) [{$elapsed_ms}ms]:\n\t" .
implode( "\n\t", $copiedRel ) . "\n\n" );
}
/**
- * @param array $dstPathsRel
+ * @param string[] $dstPathsRel
* @param string $backendRel
* @param FileBackend $dst
* @return void
$elapsed_ms = floor( ( microtime( true ) - $t_start ) * 1000 );
if ( !$status->isOK() ) {
$this->error( print_r( $status->getErrorsArray(), true ) );
- $this->error( "$wikiId: Could not delete file batch.", 1 ); // die
+ $this->fatalError( "$wikiId: Could not delete file batch." );
} elseif ( count( $deletedRel ) ) {
$this->output( "\n\tDeleted these file(s) [{$elapsed_ms}ms]:\n\t" .
implode( "\n\t", $deletedRel ) . "\n\n" );
$dPathSha1 = sha1( $dPath );
if ( $this->statCache !== null ) {
// All dst files are already in stat cache
- $dstStat = isset( $this->statCache[$dPathSha1] )
- ? $this->statCache[$dPathSha1]
- : false;
+ $dstStat = $this->statCache[$dPathSha1] ?? false;
} else {
$dstStat = $dst->getFileStat( [ 'src' => $dPath ] );
}
}
}
-$maintClass = 'CopyFileBackend';
+$maintClass = CopyFileBackend::class;
require_once RUN_MAINTENANCE_IF_MAIN;