From: Aaron Schulz Date: Thu, 28 Aug 2014 21:58:29 +0000 (-0700) Subject: Made findMissingFiles use preloadFileStat() on old versions too to speed it up X-Git-Tag: 1.31.0-rc.0~14229 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27votes%27%2C%20votes=%27waiting%27%29%20%7D%7D?a=commitdiff_plain;h=d71efc78bff19ad42b53745d81f7f5280b69c58f;p=lhc%2Fweb%2Fwiklou.git Made findMissingFiles use preloadFileStat() on old versions too to speed it up Change-Id: I03133c146f5a4f07f27b26dd033d6c93b72aea04 --- diff --git a/maintenance/findMissingFiles.php b/maintenance/findMissingFiles.php index 4bb9dc7549..8a8bcb14b0 100644 --- a/maintenance/findMissingFiles.php +++ b/maintenance/findMissingFiles.php @@ -85,14 +85,22 @@ class FindMissingFiles extends Maintenance { array( 'oi_name' => array_keys( $pathsByName ) ), __METHOD__ ); + + $checkPaths = array(); foreach ( $ores as $row ) { if ( !strlen( $row->oi_archive_name ) ) { continue; // broken row } $file = $repo->newFromArchiveName( $row->oi_name, $row->oi_archive_name ); - $path = $file->getPath(); - if ( $be->fileExists( array( 'src' => $path ) ) === false ) { - $this->output( "$path\n" ); + $checkPaths[] = $file->getPath(); + } + + foreach ( array_chunk( $checkPaths, $this->mBatchSize ) as $paths ) { + $be->preloadFileStat( array( 'srcs' => $paths ) ); + foreach ( $paths as $path ) { + if ( $be->fileExists( array( 'src' => $path ) ) === false ) { + $this->output( "$path\n" ); + } } } }