Commit graph

873 commits

Author SHA1 Message Date
Sam Reed
a02b99c55d Revert unintended changes from r86302 2011-04-18 12:00:20 +00:00
Sam Reed
a6569e0294 * (bug 28586) YAML: strings that are the same as boolean literals
* (bug 28591) Update/replace/supplement spyc (YAML parsing library)
* YAML API output is now 1.2 compliant, using JSON as the formatter

YAML 1.2 spec is a JSON subset - "The primary objective of this revision is to bring YAML into compliance with JSON as an official subset. YAML 1.2 is compatible with 1.1 for most practical applications - this is a minor revision." [1] Per discussion with Tim, switch YAML to use the JSON formatter

Was originally going to delete the ApiFormatYaml per Tim, but class needed to keep nicer (and apparent) output in API help page

Hence made subclass ApiFormatJson, minimal method overriding

spyc.php deleted from libs

[1] http://www.yaml.org/spec/1.2/spec.html#id2803629
2011-04-18 11:42:44 +00:00
Happy-melon
2c9cfd7cce Refactor the factory/i18n/list/etc static methods from SpecialPage into their own class; there's no reason we need to be parsing them in every single SpecialPage subclass. Leave all the methods as stubs in SpecialPage.php; if we required PHP 5.3 they could be replaced by a a __callStatic() magic method, but that doesn't work on PHP 5.2.
Also make a few changes to the functions available.  SpecialPageFactory::resolveAlias() now takes an optional subpage and returns array(<name>,<subpage>).  Similarly merge getPage() and getPageByAlias().  There were many examples of (extensions particularly) making dubious assumptions about the presence or absence of subpages or canonical-ness.

I didn't deprecate SpecialPage::getTitleFor() as it's got over six hundred calls.  I'm rather undecided on the best position of getPage()/executePath().  Although the latter needs cleanup anyway.
2011-04-17 11:31:11 +00:00
Chad Horohoe
a147c57165 Merge r81445 from 1.17: revert r70520 (js password complexity checker) 2011-04-15 23:38:34 +00:00
Happy-melon
47e3f922da Implement user-is-blocked and wiki-is-read-only as exceptions. 2011-04-13 14:30:55 +00:00
Happy-melon
2e1e9bf0e6 allow methods to generate a "user does not have required permissions" error by throwing an exception rather than calling $wgOut->permissionRequired(). Currently somewhat circular as the exception goes back to OutputPage::showErrorPage(), but hopefully that global dependency can be reduced in future. 2011-04-12 22:59:17 +00:00
Sam Reed
3112302c73 Remove unused globals 2011-04-11 13:53:57 +00:00
Alexandre Emsenhuber
9b1eb8bb3f Moved rateLimited() and showLagWarning() near other similar functions 2011-04-07 16:04:08 +00:00
Roan Kattouw
672e9f6a2a Fix copypaste fail in r85616 2011-04-07 13:14:33 +00:00
Roan Kattouw
82bf4764ea For bug 27488: move the startup script, jquery+mediawiki and the mw.config.set() call for configuration variables back to the <head> . Let modules control whether they're loaded in the <head> ('top') or at the bottom of the <body> ('bottom') through the position parameter/property
Also rearranges the loading order a little bit such that only=messages comes before only=scripts, and config comes before everything except startup and jquery+mediawiki
2011-04-07 12:07:25 +00:00
Brion Vibber
77da0488dc * (bug 28444) Fix regression: edit-on-doubleclick retains revision id again
Regression in 61071 caused by dropping $title->getLocalUrl($skin->getEditUrlOptions())
for the less informational $title->getEditUrl(), thus losing oldid view information.
Switching back nicely resolves it.
2011-04-06 21:58:10 +00:00
Happy-melon
e400425bfc Follow-up r85403: rm debugging code and a defunct method call. 2011-04-05 10:44:07 +00:00
Happy-melon
625695317e Follow-up r85302: update OutputPage constructors in core. 2011-04-05 00:06:47 +00:00
Niklas Laxström
cc7e83544a Follow-up r85302: whitespace fix 2011-04-04 07:24:14 +00:00
Aaron Schulz
3a49b629e6 Follow-up changes to r84610:
* Cleaned up mImageTimeKeys format
* ImageMap: Removed redundant addImage call (makeImage handes this)
* ParserFunctions: added time/sha1 to addImage() call
* Removed excess ampersands in hooks
* Added some function doc comments
2011-04-04 01:22:08 +00:00
Daniel Friesen
3c48938f9f Instead of creating an OutputPage and then setting a context start initializing OutputPages 'with' a context and send depreciated calls to extensions directly creating OutputPage instances.
Now that we've taken care of the mess of mTitle inside OutputPage and Skin and made RequestContext track Skin instead of $wgUser we don't need the hack in SpecialPage anymore.
2011-04-04 00:37:42 +00:00
Happy-melon
4a0500a514 Follow-up to r85240:
* Don't stub RequestContext.  The chances of us getting away without needing to access *any* of the six major globals is nil, and in the meantime it's screwing up strong function typing and throwing catchable fatals everywhere.  

* Stop stubbing $wgOut.  The only path where we can avoid unstubbing it is if we immediately die due to maxlag overflow, and that's a) a pretty uncommon code path, and b) a DB issue which won't be affected by a tiny bit of extra apache load.  That allows us to do strong typing on function parameters with it, which is a Good Thing (TM).

Also make OutputPage::getContext() private; I'm not convinced that a context belongs here (it's *part of* the context, not a consumer of it), let's work through it a it more before we advertise its existence.
2011-04-03 20:40:27 +00:00
Daniel Friesen
8c83c75bd7 Followup r85250; Revert a static method back to use of $wgRequest... :/ damnit resourceloader... 2011-04-03 12:55:48 +00:00
Daniel Friesen
b185adf24f Continue with r85240; Move getSkin from User to RequestContext, do it without globals, strip out the non-functional $title related stuff, and update Skin to use a RequestContext. 2011-04-03 12:46:36 +00:00
Daniel Friesen
c08158368c Implement the RequestContext class. Some credit to IAlex, ;) other credit for me and that plethora of bugs and hicoughs I had to deal with in impelenting it.
http://www.mediawiki.org/wiki/Requests_for_comment/Context_object (it's little different though)
2011-04-03 10:41:14 +00:00
Niklas Laxström
7d7d6cb56a Follow-up r85226, r85227: add @since annotations 2011-04-03 08:33:53 +00:00
Aaron Schulz
ed303469fe * Removed isset() checks - redundant given Parser::version
* For sanity in insertOn(), if the template/file version arrays are null, don't hit the DB - just assume they are empty
* Refactored mFlags handling in FlaggedRevision
* Use accessors for ParserOutput template/file versions
* Added OutputPage accessors for template/file versions
* Changed instance of NS_IMAGE -> NS_FILE
2011-04-03 05:53:07 +00:00
Daniel Friesen
86583c7c8f Start better utalizing OutputPage as the focal point for things related to the output of the page. Like getTitle use $out->get{User,Skin} instead of $wgUser and $wgUser->getSkin() for things where the user or skin is being used for output generation back to $out instead of using globals with bad structure. 2011-04-03 03:59:47 +00:00
Alexandre Emsenhuber
b7f8d0f41d * Moved all <link> definitions in OutputPage::getHeadLinks() instead of having them in a *lot* of different functions
* Also moved there generic <meta> and removed OutputPage::addDefaultMeta() with its $called static local variable which was breaking the output when generating multiple pages on the same request (rebuildFileCache.php, dumpHTML.php) since that function could only be executed completely once for all instances, and not once per instance
* Moved default module from OutputPage::output() to its own function and don't call it when executing a body only request, since it's useless in that case
* Call Skin::setMembers() from Skin::initPage() instead of Skin::outputPage()
2011-04-02 18:38:42 +00:00
Brion Vibber
f0eacb3554 * (bug 27893) Edit-on-doubleclick now applies only on view and purge actions;
no longer triggers unexpectedly on delete, history etc.
2011-03-31 23:40:51 +00:00
Purodha B Blissenbach
a00a51ebf7 Fix new typos introduced in r84799. 2011-03-30 06:35:32 +00:00
Purodha B Blissenbach
5c368d8084 Minor: removed some typos in comment lines. 2011-03-26 15:18:16 +00:00
Happy-melon
fdb862df2c $wgUser->blockedBy() already returns a name, doesn't need to be passed through User::whoIs(). Probably something I broke at some point :D 2011-03-23 18:53:50 +00:00
Aaron Schulz
a2e9b8be7e * Put parser output file version tracking to core
* Added some ParserOutput accessors
* A few cleanups to fetchFile()
2011-03-23 17:35:40 +00:00
Happy-melon
6dbcdc1be0 Blame hashar for this giant commit; he teased me for making so many smaller ones earlier... :D
* Internalise $mAddress/$mUser, $mBy/$mByName, $mEnableAutoblock, $mId as getTarget(), getBlockers(), isAutoblocking(), getId().  
* This required editing AbuseFilter and CheckUser backwards-incompatibly, so push the rest of the changes out to those extensions.
* Attack the evil 14-parameter constructor and gratuitously-confusing newFromDB( $notVeryImportantParameter, $moreImportantParameter)
* Reimplement the hack for bug 13611 in a slightly less fragile fashion; could still do with further cleanup, but then again the login frontend is its own can of worms... :S
* Remove transitionary getTargetAndType() and newFromTargetAndType() methods
* Some optimisation in parseTarget()
* Fix the broken phpunit test mentioned in r84251
2011-03-21 19:12:41 +00:00
Happy-melon
4f1638a5a6 Follow-up r81524: fix fatal when modules are deregistered 2011-03-19 21:19:50 +00:00
Happy-melon
21fcf991d0 Follow-ups to r84258 2011-03-18 22:28:39 +00:00
Happy-melon
91e7b5a93c More cleanup in Block.php. Push Block::encodeExpiry() and Block::decodeExpiry() deeper into the callstack, to DatabaseBase for encode and Language for decode. The vast majority of callers of these functions are not handling block expiries, but expiries generally, particularly page protections. 2011-03-18 19:15:56 +00:00
Roan Kattouw
51b959dcdc (bug 27564) Timestamp of site module embedded in Squid-cached page HTML 2011-03-14 15:16:43 +00:00
Alexandre Emsenhuber
9834cbb559 Fix for r83698: pass the Title object to the skin so that we are sure to show the correct context 2011-03-13 11:24:27 +00:00
Happy-melon
3d161feebf Follow-up r83755: @deprecated @since is wrong, doesn't have the expected semantic meaning. 2011-03-12 18:14:33 +00:00
Alexandre Emsenhuber
08861c5638 Only call User::getSkin() when necessary.
(With this, a parser cache hit on action=render may not load the skin at all)
2011-03-11 14:31:12 +00:00
Happy-melon
0ebda6b3e4 Include MediaWiki:Noscript.css in <noscript></noscript> tags in the header, to allow wikis to load styles for users with JS disabled. 2011-03-05 16:01:25 +00:00
Happy-melon
1b39e95b17 Optionally disable including mediawiki.legacy (wikibits.js) module. 2011-03-03 21:40:14 +00:00
Alexandre Emsenhuber
477e6e0610 * (bug 27680) Fix for r82273: wgCanonicalSpecialPageName no longer false when requesting a special page with subpage parameter
The problem is that in this case $wgOut's Title object is not exactely the same $wgTitle because of line 600 of SpecialPage:
	$wgTitle = $page->getTitle();
which strips the subpage parameter. Now using SpecialPage::resolveAliasWithSubpage() so that it works in all cases.

Also PHP strikes again for not allowing SpecialPage::resolveAliasWithSubpage( $title->getDBkey() )[0] syntax. YAY :)
2011-02-25 11:48:14 +00:00
Sam Reed
9d5cfab4ea Fixup and add another return type 2011-02-21 17:12:33 +00:00
Roan Kattouw
977d20741b (bug 27468) Move private styles out to their own section, so they override everything except user styles. Moved from one makeResourceLoaderLink() call with array_merge() to multiple calls, because makeResourceLoaderLink() orders the modules, then groups them, so the input order is not preserved. Also fixed an issue in makeResourceLoaderLink() where the $uery variable was reused in each iteration but not cleared, allowing pollution to occur in theory (doesn't seem to have happened in practice, though). 2011-02-20 17:24:42 +00:00
Krinkle
b2378a694c Using the mw alias for mediaWiki in core. Saves bandwidth and makes sense (there's no point in a wrapper function for ($,mw) if we use jQuery and mediaWiki inside of it).
TODO: Since the alias is globally available from the start, the 'mw' argument in the wrapper is redundant, so that should be removed at some point as well.
2011-02-19 22:59:44 +00:00
Roan Kattouw
880f09b10c (bug 27302) Avoid unnecessary requests for user and site modules if the relevant wiki pages don't exist.
Done by adding isKnownEmpty() to ResourceLoaderModule and overriding it to check for page existence in ResourceLoaderWikiModule. Needed to rearrange some code in OutputPage::makeResourceLoaderLink() to have the emptiness check and dropping of modules work properly. Also factored the page_touched check in ResourceLoaderWikiModule::getModifiedTime() out to a separate method (getTitleMtimes()) and moved in-object caching there as well, so getModifiedTime() and isKnownEmpty() share code and caching for their timestamp/existence checks.

This does not account for the case where e.g. a user has user CSS but no user JS: I had implemented this by checking for $context->getOnly() in getTitleMtimes(), but then realized it's not safe to do this in a function called by getModifiedTime(): it causes the timestamp list in the startup module to only take scripts in account for wiki modules, because the startup module has &only=scripts set
2011-02-19 17:07:05 +00:00
Alexandre Emsenhuber
3f8df56044 We have already have a printable flag in the OutputPage object, so use it.
This was causing to have the printable version for every non-empty version of the printable paramter, instead of only for "yes".
2011-02-18 11:55:11 +00:00
Happy-melon
eb9cf4b00c Create a user.groups module in ResourceLoader, which bundles a CSS and JS page for each usergroup the user is a member of (MediaWiki:Sysop.js, MediaWiki:Autoconfirmed.css, etc). Groups '*' and 'user' are not included. 2011-02-16 19:54:02 +00:00
Happy-melon
ef6041d750 revert r82283, loads of unrelated changes 2011-02-16 19:51:25 +00:00
Happy-melon
d64cd26a7c Create a user.groups module in ResourceLoader, which bundles a CSS and JS page for each usergroup the user is a member of (MediaWiki:Sysop.js, MediaWiki:Autoconfirmed.css, etc). Groups '*' and 'user' are not included. 2011-02-16 19:49:37 +00:00
Alexandre Emsenhuber
4fe955e32b Moved Skin::makeGlobalVariablesScript() to OutputPage::getJSVars()
* merged <script> and if ( window.mediaWiki ) block with the one of mediaWiki.loader as stated in the doc
* removed dependency of $wgTitle
* the two only calls to this functions are in SemanticForms, but will not affect current version of MediaWiki:
** specials/SF_UploadWindow.php: this file is only used before 1.16
** specials/SF_UploadWindow2.php: the call is part of the else branch of a "method_exists( $wgOut, 'addModules' )" check, which means it's not called since 1.17
2011-02-16 18:25:44 +00:00
Sam Reed
fd8be135e7 Fix text description of OutputPage::getLanguageLinks(), it doesn't return 'fr' => 'Title', it returns 'fr:Title' 2011-02-16 10:28:24 +00:00