From c1a9303abab2dbafcdf952269fe599616c09b350 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 4 Nov 2015 20:19:17 -0800 Subject: [PATCH] Make FindOrphanedFiles handle bad file titles Change-Id: Idb926097b6159c9c442ee6f427f1da60c5c5d2eb --- maintenance/findOrphanedFiles.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/maintenance/findOrphanedFiles.php b/maintenance/findOrphanedFiles.php index a1e274cdc4..41650bd0e6 100644 --- a/maintenance/findOrphanedFiles.php +++ b/maintenance/findOrphanedFiles.php @@ -136,7 +136,11 @@ class FindOrphanedFiles extends Maintenance { foreach ( array_diff( $curNames, $curNamesFound ) as $name ) { $file = $repo->newFile( $name ); // Print name and public URL to ease recovery - $this->output( $name . "\n" . $file->getCanonicalUrl() . "\n\n" ); + if ( $file ) { + $this->output( $name . "\n" . $file->getCanonicalUrl() . "\n\n" ); + } else { + $this->error( "Cannot get URL for bad file title '$name'" ); + } } foreach ( array_diff( $oldNames, $oldNamesFound ) as $name ) { -- 2.20.1