Check return value from wfMkdirParents() rather than proceeding and probably failing
authorChad Horohoe <demon@users.mediawiki.org>
Sun, 20 Jun 2010 15:32:54 +0000 (15:32 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Sun, 20 Jun 2010 15:32:54 +0000 (15:32 +0000)
includes/filerepo/ForeignAPIRepo.php

index dbfdab0..da6d155 100644 (file)
@@ -204,7 +204,10 @@ class ForeignAPIRepo extends FileRepo {
                        $fileName = rawurldecode( pathinfo( $foreignUrl, PATHINFO_BASENAME ) );
                        $path = 'thumb/' . $this->getHashPath( $name ) . $name . "/";
                        if ( !is_dir($wgUploadDirectory . '/' . $path) ) {
-                               wfMkdirParents($wgUploadDirectory . '/' . $path);
+                               if( !wfMkdirParents($wgUploadDirectory . '/' . $path) ) {
+                                       wfDebug(  __METHOD__ . " could not create directory for thumb\n" );
+                                       return $foreignUrl;
+                               }
                        }
                        $localUrl =  $wgServer . $wgUploadPath . '/' . $path . $fileName;
                        # FIXME: Delete old thumbs that aren't being used. Maintenance script?