Last modified: 2013-03-13 12:41:54 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 T43835, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 41835 - Requesting a new hook to allow manipulation of image data (e.g. src attribute) before the image is rendered
Requesting a new hook to allow manipulation of image data (e.g. src attribute...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
1.21.x
All All
: Unprioritized enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-06 21:11 UTC by Victor Danilchenko
Modified: 2013-03-13 12:41 UTC (History)
8 users (show)

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


Attachments
The patch to add a new hook, 'ThumbnailBeforeProduceHTML', to ThumbnailImage::toHtml method, in order to permit the user to manipulate the image attributes before the HTML is rendered (907 bytes, patch)
2012-11-06 21:11 UTC, Victor Danilchenko
Details
The documentation patch for the ThumbnailBeforeProduceHTML hook (637 bytes, patch)
2012-11-06 21:35 UTC, Victor Danilchenko
Details
The FIXED patch to add a new hook, 'ThumbnailBeforeProduceHTML', to ThumbnailImage::toHtml method, in order to permit the user to manipulate the image attributes before the HTML is rendered (635 bytes, patch)
2012-12-05 20:02 UTC, Victor Danilchenko
Details

Description Victor Danilchenko 2012-11-06 21:11:59 UTC
Created attachment 11318 [details]
The patch to add a new hook, 'ThumbnailBeforeProduceHTML', to ThumbnailImage::toHtml method, in order to permit the user to manipulate the image attributes before the HTML is rendered

We ran into this when trying to ensure that the images get updated promptly when the user uploads a new file. Browsers tend to overcache, and MediaWiki seems to currently offer no facilities to address this, though there are come future plans to add file versioning.

Our (Knowledge Management group at Vistaprint inc.) proposed solution is to add a new hook, 'ThumbnailBeforeProduceHTML', to ThumbnailImage::toHtml method. This would allow the user to edit the src attribute and append a timestamp parameter to it when the file's mtime changes.

We have implemented and tested this solution internally, and it works as intended. The patchfile is attached.
Comment 1 Sam Reed (reedy) 2012-11-06 21:23:25 UTC
You should also add some documentation for this hook to docs/hooks.txt
Comment 2 Victor Danilchenko 2012-11-06 21:35:46 UTC
Created attachment 11319 [details]
The documentation patch for the ThumbnailBeforeProduceHTML hook

As requested, the patch for the docs/hooks.txt file.
Comment 3 Nischay Nahata 2012-11-07 05:35:30 UTC
I made a patchset for you https://gerrit.wikimedia.org/r/#/c/32189/

Please consider making an account on gerrit so you can do this yourself in future, it enables you to get code review faster.
http://www.mediawiki.org/wiki/Developer_access
Comment 4 Nischay Nahata 2012-12-02 15:00:00 UTC
(In reply to comment #0)
I already made a gerrit patch for you, but your patch seems to have some errors which I don't know how to fix. Please see https://gerrit.wikimedia.org/r/#/c/32189/
Comment 5 Victor Danilchenko 2012-12-05 20:02:29 UTC
Created attachment 11468 [details]
The FIXED patch to add a new hook, 'ThumbnailBeforeProduceHTML', to ThumbnailImage::toHtml method, in order to permit the user to manipulate the image attributes before the HTML is rendered

I removed the cargo-cult wrap around the hook call. Due to the nature of the hook, no special processing is needed in case one of the hook calls fails.
Comment 6 Andre Klapper 2012-12-05 20:54:55 UTC
Victor: Thanks for the updated patch! Did you have time / are you interested in getting developer access? See http://www.mediawiki.org/wiki/Developer_access
Comment 7 Victor Danilchenko 2012-12-06 14:34:48 UTC
I already received commit privileges, but frankly I simply don't feel qualified to make commits directly yet. I will likely do so at some point in the future, but for now I feel it safest to let those far more qualified than I handle the logistics around getting the code into the codebase.
Comment 8 Andre Klapper 2012-12-16 13:46:40 UTC
Victor: Gerrit is not about committing directly. It's also a review tool for patches, that's why I asked if you could put patches there.
Comment 9 Nischay Nahata 2012-12-20 13:47:50 UTC
(In reply to comment #7)
> I already received commit privileges, but frankly I simply don't feel
> qualified
> to make commits directly yet.
You don't have to be qualified for this, you won't be changing the code directly but putting up code for review for other "qualified" developers.


Also not sure why this bug is now marked Unconfirmed
Comment 10 Alex Monk 2012-12-20 16:16:43 UTC
(In reply to comment #9)
> Also not sure why this bug is now marked Unconfirmed

There's nothing in the history about it, must've always been unconfirmed.
Comment 11 Nischay Nahata 2012-12-20 17:09:14 UTC
(In reply to comment #10)
> There's nothing in the history about it, must've always been unconfirmed.

New+enhancement sounds better to me.
Comment 12 Victor Danilchenko 2012-12-20 17:12:38 UTC
I am not sure why it's a bug... it's an improvement. The functionality prior to this patch was not broken, merely absent.

yea, new enhancement should be the proper classification for this patch.
Comment 13 Alex Monk 2012-12-20 17:13:51 UTC
Everything in Bugzilla is a 'bug', even when it's actually an enhancement request. :)
Comment 14 Andre Klapper 2013-03-13 10:25:47 UTC
https://gerrit.wikimedia.org/r/#/c/32189/ was merged on December 23, 2012.

Hence I'm closing this as FIXED as I cannot see anything left to do for this request. Please reopen if I'm wrong, and elaborate what's left.

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


Navigation
Links