From d71efc78bff19ad42b53745d81f7f5280b69c58f Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 28 Aug 2014 14:58:29 -0700 Subject: [PATCH] Made findMissingFiles use preloadFileStat() on old versions too to speed it up Change-Id: I03133c146f5a4f07f27b26dd033d6c93b72aea04 --- maintenance/findMissingFiles.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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" ); + } } } } -- 2.20.1