Last modified: 2011-02-08 21:57:17 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 T10433, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 8433 - Allow skin CSS to be flushed remotely
Allow skin CSS to be flushed remotely
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
All All
: Normal enhancement with 4 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
Blocks: css
  Show dependency treegraph
Reported: 2006-12-29 23:22 UTC by Titoxd
Modified: 2011-02-08 21:57 UTC (History)
2 users (show)

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

a patch to purge site css after edit (1.09 KB, patch)
2008-09-23 10:27 UTC, Emil Podlaszewski

Description Titoxd 2006-12-29 23:22:01 UTC
When a wiki's local [[MediaWiki:Monobook.css]] (or any other style sheet) is
revised significantly, the old style sheet is not flushable, as the software's
/skins-1.5/monobook/main.css can be with $wgStyleVersion. Is it possible to
create a message similar to the $wgStyleVersion, such as
[[MediaWiki:Monobook_css_version]], that can be used to flush caches remotely?
The same could be used with [[MediaWiki:Monobook.js]] as well.
Comment 1 renesis4 2006-12-29 23:26:48 UTC
Shouldn't there be a MediaWiki namespace way of updating this, so we don't have
to persuade a developer to change the parameter every time?
Comment 2 Titoxd 2006-12-29 23:28:54 UTC
That's the issue - looking at the HTML source of a rendered page, the CSS does not have any way to be purged 
remotely, even by developers. 
Comment 3 Rob Church 2006-12-29 23:34:23 UTC
An alternative would be to append the timestamp of the current revision of the
CSS page to the URI which causes it to be included. This would be similar to how
$wgStyleVersion works, and wouldn't require administrators to remember to update
a second message with each customisation.
Comment 4 Titoxd 2006-12-29 23:39:04 UTC
That works, although I worry about issues with admins modifying whitespace or doing other trivial changes. Those 
could have a harsh impact on server load... :(
Comment 5 Rob Church 2006-12-29 23:41:29 UTC
Something I didn't mention, of course, is something which Brion phrased
effectively: "that implies you know it, in which case you're doing several extra
database lookups for every page view".
Comment 6 Titoxd 2006-12-29 23:44:18 UTC
Hmm... that implies you know the timestamp of the latest version? (I'm not sure
if I understood)... that could be written on memory somewhere. In a way, it
seems ok that if a change to a skin CSS file was done within a wiki, the number
should be changed manually only if the impact to the appearance of the site is
bad enough...
Comment 7 Omegatron 2006-12-30 01:17:55 UTC
Shouldn't this just happen when someone edits [[MediaWiki:Common.css]]?
Comment 8 Mets501 2006-12-30 01:21:25 UTC
Definitely.  It's worth the extra server load for everyone to see the same
display.  It should happen when [[MediaWiki:Common.css]],
[[MediaWiki:Monobook.css]], [[MediaWiki:Common.js]], and any of the other
skin-specific css's and js's are updated.
Comment 9 Rob Church 2006-12-30 09:52:00 UTC
(In reply to comment #7)
> Shouldn't this just happen when someone edits [[MediaWiki:Common.css]]?

The problem is *making it* happen.
Comment 10 Titoxd 2007-01-10 03:32:53 UTC
Again, can't the timestamp be stored in the message cache? Or another message
stored in the cache, like I suggested originally?
Comment 11 Mike Dillon 2008-03-22 22:53:24 UTC
This ticket has been open for quite a while, so I'm wondering if there is still interest in getting this to happen. I would definitely love to see this happen since the Wikimedia caching strategy can make any site-wide style changes a time-consuming process. I've seen multiple instances on both Wikipedia and Wiktionary where inline styles were left in templates to force client displays to look correct for the month or so that we have to wait to be sure that all users caches have caught up.

If we can come to some agreement as to the mechanism, I have no problem providing a patch for this.
Comment 12 Mike Dillon 2008-05-06 01:56:01 UTC
Just following up on this ticket again, it seems like Titoxd's suggestion would be workable. Is there a reason that solution wouldn't work?
Comment 13 Brion Vibber 2008-05-06 23:21:07 UTC
Should work, in theory.

Note a general issue with the use of version markers on style URLs like this: the updated version marker bumps the URL to ensure that any *newly* rendered page, with the new URL, will show up with a fresh copy of the new external resource.

Older cached HTML (eg, cached pages for anonymous visitors) will still include the older URLs as long as they remain in cache, so will get the older resource as long as _that_ also remains in cache.

So while this will guarantee bumps for logged-in users who are always bumping their own cache invalidation timestamps, and for newly-changed pages, it *won't* push the updates to every page everywhere at once.
Comment 14 Emil Podlaszewski 2008-09-23 10:27:40 UTC
Created attachment 5359 [details]
a patch to purge site css after edit

A simple patch that causes a skin css to be purged after an edit. 

Note that there may be required some changes in your Squid config too.
Comment 15 Krinkle 2011-01-02 16:11:02 UTC
See also bug 17524
Comment 16 Roan Kattouw 2011-01-02 18:59:09 UTC
ResourceLoader takes care of this, see also bug 17524

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