Last modified: 2009-11-28 04:43:45 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T20115, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 18115 - ForeignAPIRepo cache isn't working
ForeignAPIRepo cache isn't working
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
1.15.x
All All
: Normal normal (vote)
: ---
Assigned To: Chad H.
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-03-23 18:02 UTC by Mohamed Magdy
Modified: 2009-11-28 04:43 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Mohamed Magdy 2009-03-23 18:02:54 UTC
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
Comment 1 Mohamed Magdy 2009-03-23 18:06:53 UTC
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).
Comment 2 Chad H. 2009-03-23 22:49:48 UTC
(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.
Comment 3 Mohamed Magdy 2009-03-24 16:21:54 UTC
(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
Comment 4 Chad H. 2009-04-10 21:25:00 UTC
Fixed in r49381

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links