From a1764b164c0caf7b660c3f9875a6196351c122f5 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Fri, 5 Dec 2008 20:22:43 +0000 Subject: [PATCH] Bow out more gracefully if we can't write to the file. We've already got the foreign thumb URL on hand, so just use that. --- includes/filerepo/ForeignAPIRepo.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/filerepo/ForeignAPIRepo.php b/includes/filerepo/ForeignAPIRepo.php index a6773e11ec..c1d2ce1504 100644 --- a/includes/filerepo/ForeignAPIRepo.php +++ b/includes/filerepo/ForeignAPIRepo.php @@ -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? -- 2.20.1