Page MenuHomePhabricator

ForeignAPIRepo throwing error on first page load for file
Closed, ResolvedPublic

Description

Author: overlordq

Description:
The first time somebody loads a page of a file from a ForeignAPIRepo (eg: commons) you get a PHP error:

Warning: file_put_contents(/var/www/host/wiki/images/thumb/BackUpAndPush.ogg/) function.file-put-contents: failed to open stream: Is a directory in /var/www/host/wiki/includes/filerepo/ForeignAPIRepo.php on line 172


Version: 1.15.x
Severity: minor

Details

Reference
bz17835

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:36 PM
bzimport set Reference to bz17835.

overlordq wrote:

I noticed this occurs only with files other then images, such as audio/video since these wont have thumbnails.

Browsing through the code it doesn't seem to take into account cases like this.

Odd. I can't seem to replicate this locally. What configuration do you have for $wgForeignFileRepos? Do you have any extensions related to Ogg like OggHandler?

overlordq wrote:

It's the example Commons config:

$wgForeignFileRepos[] = array(

'class'                   => 'ForeignAPIRepo',
'name'                    => 'shared',
'apibase'                 => 'http://commons.wikimedia.org/w/api.php',
'fetchDescription'        => true, // Optional
'descriptionCacheExpiry'  => 43200, // 12 hours, optional
'apiThumbCacheExpiry'     => 43200, // 12 hours, optional, but required for local thumb caching

);

And yea, good eye, doesn't seem to trigger if OggPlayer is disabled. Didn't think about that.