Last modified: 2011-04-30 01:21:23 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 T26347, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 24347 - Generalization of the File::getArchiveUrl method
Generalization of the File::getArchiveUrl method
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
1.15.x
All All
: Lowest enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-12 08:48 UTC by Ed
Modified: 2011-04-30 01:21 UTC (History)
3 users (show)

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


Attachments

Description Ed 2010-07-12 08:48:13 UTC
In writing an extension to implement a filerepo which uses the Amazon S3 system, I found that there were a few changes needed to the File class. This is because the File class assumes that it knows how to calculate the URL based on the hash directory and so forth. In the case of the S3 system, the URL may need a "signature", which is a suffix to the normal URL of the desired file. This affected the links presented on the ImagePage screen for the archive files.

To make a long story short, I added a couple of lines to the beginning of the File::getArchiveUrl() method:

   if(is_callable(array($this->repo,'getArchiveUrl'))) {
      $path = $this->repo->getArchiveUrl($this, $suffix);
      return $path;
   }

With this change, the repo, if the corresponding method exists, is used to calculate the URL for the archive files, allowing for signatures, etc.

With just this change, my S3 extension works. But I noticed that there are other methods in the File class which have the same problem, but I am unsure what effect they might have. Also, it is possible that the ImagePage screen creates the file object incorrectly (the "object factory" should be used, and it isn't, so the inheritance doesn't apply).

Anyway, I would like to publish my S3 extension, but I would need to know if this change can be made to the File::getArchiveUrl() method, or if some other change would be better.
Comment 1 Bryan Tong Minh 2010-07-12 18:28:06 UTC
You just should override the File::getArchiveUrl method in your derived File class.
Comment 2 Ed 2010-07-12 21:27:32 UTC
That is what I tried to do first, but since the "object factory" isn't called, it doesn't use my class. Anyway, further debugging showed that I'm missing a few overrides in my S3 file class, which is why it isn't calling the object factory. I'll check it some more.

Thank you for your help.

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


Navigation
Links