phpdoc @return MediaWikiTitleCodec in Title::getTitleParser
[lhc/web/wiklou.git] / maintenance / findOrphanedFiles.php
index a1e274c..2362957 100644 (file)
@@ -25,7 +25,7 @@ class FindOrphanedFiles extends Maintenance {
        function __construct() {
                parent::__construct();
 
-               $this->mDescription = "Find unregistered files in the 'public' repo zone.";
+               $this->addDescription( "Find unregistered files in the 'public' repo zone." );
                $this->addOption( 'subdir',
                        'Only scan files in this subdirectory (e.g. "a/a0")', false, true );
                $this->addOption( 'verbose', "Mention file paths checked" );
@@ -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 ) {