* @param array $params Parameters include:
* - srcs : list of source storage paths
* - latest : use the latest available data
+ * @return bool All requests proceeded without I/O errors (since 1.24)
* @since 1.23
*/
- public function preloadFileStat( array $params ) {
- }
+ abstract public function preloadFileStat( array $params );
/**
* Lock the files at the given storage paths in the backend.
// Load from the persistent container caches
$this->primeContainerCache( $paths );
// Get the latest stat info for all the files (having locked them)
- $this->preloadFileStat( array( 'srcs' => $paths, 'latest' => true ) );
+ $ok = $this->preloadFileStat( array( 'srcs' => $paths, 'latest' => true ) );
- // Actually attempt the operation batch...
- $opts = $this->setConcurrencyFlags( $opts );
- $subStatus = FileOpBatch::attempt( $performOps, $opts, $this->fileJournal );
+ if ( $ok ) {
+ // Actually attempt the operation batch...
+ $opts = $this->setConcurrencyFlags( $opts );
+ $subStatus = FileOpBatch::attempt( $performOps, $opts, $this->fileJournal );
+ } else {
+ // If we could not even stat some files, then bail out...
+ $subStatus = Status::newFatal( 'backend-fail-internal', $this->name );
+ foreach ( $ops as $i => $op ) { // mark each op as failed
+ $subStatus->success[$i] = false;
+ ++$subStatus->failCount;
+ }
+ }
// Merge errors into status fields
$status->merge( $subStatus );
final public function preloadFileStat( array $params ) {
$section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $success = true; // no network errors
$params['concurrency'] = ( $this->parallelize !== 'off' ) ? $this->concurrency : 1;
$stats = $this->doGetFileStatMulti( $params );
if ( $stats === null ) {
- return; // not supported
+ return true; // not supported
}
$latest = !empty( $params['latest'] ); // use latest data?
array( 'hash' => false, 'latest' => $latest ) );
wfDebug( __METHOD__ . ": File $path does not exist.\n" );
} else { // an error occurred
+ $success = false;
wfDebug( __METHOD__ . ": Could not stat file $path.\n" );
}
}
+
+ return $success;
}
/**
// This will check if the archive file also exists and fail if does.
// This is a sanity check to avoid data loss. On Windows and Linux,
// copy() will overwrite, so the existence check is vulnerable to
- // race conditions unless an functioning LockManager is used.
+ // race conditions unless a functioning LockManager is used.
// LocalFile also uses SELECT FOR UPDATE for synchronization.
$operations[] = array(
'op' => 'copy',