Bow out more gracefully if we can't write to the file. We've already got the foreign...
authorChad Horohoe <demon@users.mediawiki.org>
Fri, 5 Dec 2008 20:22:43 +0000 (20:22 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Fri, 5 Dec 2008 20:22:43 +0000 (20:22 +0000)
includes/filerepo/ForeignAPIRepo.php

index a6773e1..c1d2ce1 100644 (file)
@@ -133,7 +133,10 @@ class ForeignAPIRepo extends FileRepo {
                        if ( !is_dir($wgUploadDirectory . '/' . $path) ) {
                                wfMkdirParents($wgUploadDirectory . '/' . $path);
                        }
-                       
+                       if ( !is_writable( $wgUploadDirectory . '/' . $path . $fileName ) ) {
+                               wfDebug( __METHOD__ . " could not write to thumb path\n" );
+                               return $foreignUrl;
+                       }
                        $localUrl =  $wgServer . $wgUploadPath . '/' . $path . $fileName;
                        $thumb = Http::get( $foreignUrl );
                        # FIXME: Delete old thumbs that aren't being used. Maintenance script?