Last modified: 2011-03-13 18:04:35 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 T24552, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 22552 - Add instance-specific JavaScript and CSS
Add instance-specific JavaScript and CSS
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.16.x
All All
: Lowest enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-02-16 17:45 UTC by Dan Barrett
Modified: 2011-03-13 18:04 UTC (History)
2 users (show)

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


Attachments

Description Dan Barrett 2010-02-16 17:45:31 UTC
Motivation: If you maintain multiple MediaWiki instances, and you want them to share SOME, but not ALL, of the content in MediaWiki:Common.js and MediaWiki:Common.css, it is a royal pain.

Suggestion: For a given MediaWiki instance with $wgSitename = Foo, create these two system messages automatically:

MediaWiki:Foo.js
MediaWiki:Foo.css

Just like common.js and common.css, these would be loaded automatically on each page view, but ONLY for the given $wgSitename.

This would let you maintain the JS and CSS for a whole set of wikis in a single place, and only the one matching $wgSitename would be used.
Comment 1 Bawolff (Brian Wolff) 2010-02-17 12:06:28 UTC
One could just add something along the lines of importScript("mediawiki:" +wgDBname +".js"); to mediawiki:Common.js. 

I personally can't see having yet another js page as being very useful outside of a very specific setup. (but that's just my personal opinion).
Comment 2 Chad H. 2010-02-17 12:08:08 UTC
I'm with you on this one. It has very little application for most installs, and there's a viable workaround. WONTFIX.
Comment 3 Dan Barrett 2010-02-17 13:39:58 UTC
Thanks for the workaround! That will work great.
Comment 4 Dan Barrett 2010-02-17 16:50:39 UTC
The workaround doesn't work. "wgDBname" is not unique enough: you can have any number of wikis on various servers that use "wikidb" as the database name, for example.  All of ours do.

If "wgSitename" were an available JS variable, that would work.  But it isn't.

Also the workaround is only for JavaScript, not CSS.
Comment 5 Dan Barrett 2010-02-17 17:04:09 UTC
Never mind about the CSS: I see how to do it:

importStylesheet("mediawiki:" +wgDBname +".css");

But the "wikidb" comment still stands.
Comment 6 Bawolff (Brian Wolff) 2010-02-17 18:27:35 UTC
Use wgServer.substring(7) if your database names are the same. (or some other variable depending on your set up. if they're same server different path you can use wgScriptPath).

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


Navigation
Links