Thread:Project:Support desk/InstantCommons doesn't cache

I'm cross-posting this here from a question I posted on StackOverflow: http://stackoverflow.com/questions/13976995

I'm the main developer behind Practical Plants. We're using InstantCommons to grab images from the commons, but it seems like they're failing to cache locally, making page loads slow and placing unnecessary burden on the Commons.

I've set $wgUseInstantCommons=true, which downloads images just fine, but doesn't cache them. I get this in my debug.log:

ForeignAPIRepo: HTTP GET: http://commons.wikimedia.org/w/api.php?titles=File%3ABrassica_oleracea0.jpg&iiprop=timestamp%7Cuser%7Ccomment%7Curl%7Csize%7Csha1%7Cmetadata%7Cmime&prop=imageinfo&iimetadataversion=2&format=json&action=query&redirects=true Class PEAR_Error not found; skipped loading ForeignAPIRepo: HTTP GET: http://commons.wikimedia.org/w/api.php?titles=File%3ABrassica_oleracea0.jpg&iiprop=url%7Ctimestamp&iiurlwidth=248&iiurlheight=-1&iiurlparam=248px&prop=imageinfo&format=json&action=query&redirects=true ForeignAPIRepo::getThumbUrl got remote thumb http://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Brassica_oleracea0.jpg/248px-Brassica_oleracea0.jpg ForeignAPIRepo: HTTP GET: http://commons.wikimedia.org/w/api.php?titles=mwstore%3A%2F%2Fwikimediacommons-backend%2Fwikimediacommons-thumb%2F1%2F11%2FBrassica_oleracea0.jpg%2F248px-Brassica_oleracea0.jpg&prop=imageinfo&format=json&action=query&redirects=true ForeignAPIRepo::getThumbUrlFromCache Thumbnail was already downloaded before ForeignAPIRepo: HTTP GET: http://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Brassica_oleracea0.jpg/248px-Brassica_oleracea0.jpg ForeignAPIRepo::getThumbUrlFromCache could not write to thumb path: mwstore://wikimediacommons-backend/wikimediacommons-thumb/1/11/Brassica_oleracea0.jpg/248px-Brassica_oleracea0.jpg

Note that the path output in the error ForeignAPIRepo:getThumbUrlFromCache was added by me to try and understand the problem a little - I added $localFilename to the debug output so that lines 300-305 in my ForeignAPIRepo.php file look like this

$op = array( 'op' => 'create', 'dst' => $localFilename, 'content' => $thumb ); if( !$backend->doOperation( $op )->isOK ) { wfRestoreWarnings; wfDebug( __METHOD__ . " could not write to thumb path: ".$localFilename."\n" ); return $foreignUrl; }

But the mwstore://wikimedia-commons-backend makes things pretty opaque for me. Anyone have a clue what might be going on here? My images dir and all subdirectories are 775 (apache user has group rights) so they're definately writable. Furthermore, locally uploaded images work fine.

If I can provide any more information, please let me know!