From 45e820b970a32632ea1df0e9205b904dd739d21f Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Fri, 10 Apr 2009 21:24:35 +0000 Subject: [PATCH] (bug 18115) ForeignAPIRepo cache isn't working, fixed a broken is_writable() call. This also coincidentally fixes bug 17835. --- RELEASE-NOTES | 2 ++ includes/filerepo/ForeignAPIRepo.php | 9 ++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b9dd86affb..11df4a7662 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -338,6 +338,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 7830) Pending transactions failed to commit on loginToUse() error * (bug 11613) session.save_handler being over-ridden * (bug 11381) session.save_handler being set twice (causes error) +* (bug 17835) ForeignAPIRepo throwing error on first page load for file +* (bug 18115) ForeignAPIRepo cache isn't working == API changes in 1.15 == * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions diff --git a/includes/filerepo/ForeignAPIRepo.php b/includes/filerepo/ForeignAPIRepo.php index e63e4a6ba8..613f4c000c 100644 --- a/includes/filerepo/ForeignAPIRepo.php +++ b/includes/filerepo/ForeignAPIRepo.php @@ -162,14 +162,13 @@ 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? - file_put_contents($wgUploadDirectory . '/' . $path . $fileName, $thumb ); + if( !file_put_contents($wgUploadDirectory . '/' . $path . $fileName, $thumb ) ) { + wfDebug( __METHOD__ . " could not write to thumb path\n" ); + return $foreignUrl; + } $wgMemc->set( $key, $localUrl, $this->apiThumbCacheExpiry ); wfDebug( __METHOD__ . " got local thumb $localUrl, saving to cache \n" ); return $localUrl; -- 2.20.1