Page MenuHomePhabricator

ForeignAPIRepo cache isn't working
Closed, ResolvedPublic

Description

Author: mohamed.m.k

Description:
Hi,

Three issues:

It isn't saving files to disk (in $IP/images/thumb).. I think that's because $fileName (ltrim( substr( $foreignUrl, strrpos( $foreignUrl, '/' ) ), '/' );) is never echoed in the other variables (but if I add wfDebug( METHOD . " $fileName \n" ), it is shown in the debug file);) (in if ( !is_writable( ... and $localUrl ... and file_put_contents($wgUploadDi ...). I have no idea why. example*.

hashLevels is set to zero by default (I think), so $this->getHashPath( $name ) (line 161) isn't giving anything. I had to add

'hashLevels' => 2, so that it gets set (shouldn't it detect that or I am wrong at that assumption).

It isn't working in Windows because of the different slashes style.

Http::request: GET http://commons.wikimedia.org/w/api.php?titles=Image%3AGnome-face-sad.svg&iiprop=timestamp%7Cuser%7Ccomment%7Curl%7Csize%7Csha1%7Cmetadata%7Cmime&prop=imageinfo&format=json&action=query
FileCache MISS for Gnome-face-sad.svg
Http::request: GET http://commons.wikimedia.org/w/api.php?titles=Image%3AGnome-face-sad.svg&iiprop=url&iiurlwidth=48&iiurlheight=-1&prop=imageinfo&format=json&action=query
ForeignAPIRepo::getThumbUrl got remote thumb http://upload.wikimedia.org/wikipedia/commons/thumb/b/b3/Gnome-face-sad.svg/48px-Gnome-face-sad.svg.png
ForeignAPIRepo::getThumbUrlFromCache could not write to thumb path


Version: 1.15.x
Severity: normal

Details

Reference
bz18115

Event Timeline

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

mohamed.m.k wrote:

Forgot to mention that "images/thumb/b/b3/Gnome-face-sad.svg" directory is created but empty (no 48px-Gnome-face-sad.svg.png inside it).

(In reply to comment #0)

Hi,

Three issues:

It isn't saving files to disk (in $IP/images/thumb).. I think that's because

$fileName (ltrim( substr( $foreignUrl, strrpos( $foreignUrl, '/' ) ), '/' );)
is never echoed in the other variables (but if I add wfDebug( METHOD . "
$fileName \n" ), it is shown in the debug file);) (in if ( !is_writable( ...
and $localUrl ... and file_put_contents($wgUploadDi ...). I have no idea why.
example*.

Can you rephrase here? $fileName is getting used at several points after I construct it in line 160.

hashLevels is set to zero by default (I think), so $this->getHashPath( $name

) (line 161) isn't giving anything. I had to add
'hashLevels' => 2, so that it gets set (shouldn't it detect that or I am wrong
at that assumption).

getHashPath should return '' if hashLevels == 0, making $path = 'thumb/imagename.jpg/'.

It isn't working in Windows because of the different slashes style.

Http::request: GET
http://commons.wikimedia.org/w/api.php?titles=Image%3AGnome-face-sad.svg&iiprop=timestamp%7Cuser%7Ccomment%7Curl%7Csize%7Csha1%7Cmetadata%7Cmime&prop=imageinfo&format=json&action=query
FileCache MISS for Gnome-face-sad.svg
Http::request: GET
http://commons.wikimedia.org/w/api.php?titles=Image%3AGnome-face-sad.svg&iiprop=url&iiurlwidth=48&iiurlheight=-1&prop=imageinfo&format=json&action=query
ForeignAPIRepo::getThumbUrl got remote thumb
http://upload.wikimedia.org/wikipedia/commons/thumb/b/b3/Gnome-face-sad.svg/48px-Gnome-face-sad.svg.png
ForeignAPIRepo::getThumbUrlFromCache could not write to thumb path

WORKSFORME on Windows && CentOS.

mohamed.m.k wrote:

(In reply to comment #2)

(In reply to comment #0)

Hi,

Three issues:

It isn't saving files to disk (in $IP/images/thumb).. I think that's because

$fileName (ltrim( substr( $foreignUrl, strrpos( $foreignUrl, '/' ) ), '/' );)
is never echoed in the other variables (but if I add wfDebug( METHOD . "
$fileName \n" ), it is shown in the debug file);) (in if ( !is_writable( ...
and $localUrl ... and file_put_contents($wgUploadDi ...). I have no idea why.
example*.

Can you rephrase here? $fileName is getting used at several points after I
construct it in line 160.

As far as I can tell it is not echoed (is that the right word?) in the all three points.

hashLevels is set to zero by default (I think), so $this->getHashPath( $name

) (line 161) isn't giving anything. I had to add
'hashLevels' => 2, so that it gets set (shouldn't it detect that or I am wrong
at that assumption).

getHashPath should return '' if hashLevels == 0, making $path =
'thumb/imagename.jpg/'.

So that is the correct behavior? I thought that the local thumb structure should be like common's structure (i.e. /thumb/b/b3/filename.svg/48px-filename.svg.png instead of /thumb/filename.svg/48px-filename.svg.png)..

It isn't working in Windows because of the different slashes style.

Http::request: GET
http://commons.wikimedia.org/w/api.php?titles=Image%3AGnome-face-sad.svg&iiprop=timestamp%7Cuser%7Ccomment%7Curl%7Csize%7Csha1%7Cmetadata%7Cmime&prop=imageinfo&format=json&action=query
FileCache MISS for Gnome-face-sad.svg
Http::request: GET
http://commons.wikimedia.org/w/api.php?titles=Image%3AGnome-face-sad.svg&iiprop=url&iiurlwidth=48&iiurlheight=-1&prop=imageinfo&format=json&action=query
ForeignAPIRepo::getThumbUrl got remote thumb
http://upload.wikimedia.org/wikipedia/commons/thumb/b/b3/Gnome-face-sad.svg/48px-Gnome-face-sad.svg.png
ForeignAPIRepo::getThumbUrlFromCache could not write to thumb path

WORKSFORME on Windows && CentOS.

So it saves the files under images/thumb/* correctly? this is weird as I tried on Windows and Ubuntu and the images gets displayed successfully but they aren't saved to the file cache. I used the example config @mw.org to use commons. could it be something with PHP config or version?

mediawiki: svn up
on windows i used: http://www.easyphp.org
on ubuntu: PHP 5.2.6-2ubuntu4.1 with Suhosin-Patch 0.9.6.2

demon added a comment.Apr 10 2009, 9:25 PM

Fixed in r49381

Gilles moved this task from Untriaged to Done on the Multimedia board.Dec 4 2014, 10:49 AM