Commit graph

879 commits

Author SHA1 Message Date
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
Happy-melon
626e9fd811 Fix fatal in Standard skin. 2011-04-16 20:22:18 +00:00
Happy-melon
e76c7823c1 Update Skin.php to not call the now-separate Linker methods via $this->foo(). 2011-04-16 20:01:39 +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
Tim Starling
7bb50c630a The beginnings of HipHop compiled mode support. It works now for parser cache hits.
* Work around HipHop issue 314 (volatile broken) and issue 308 (no compilation detection) by adding some large and ugly compilation detection code to WebStart.php and doMaintenance.php.
* Provide an MW_COMPILED constant which can be used to detect compiled mode throughout the codebase.
* Introduced wfIsHipHop(), which detects either compiled or interpreted mode. Used this to work around unusual eval() return value in eval.php.
* Work around lack of ini_get() in Maintenance.php, by duplicating wfIsHipHop(). 
* In Maintenance::shouldExecute(), accept "include" as an inclusion function name, since all kinds of inclusion give this string in HipHop.
* Introduced new class MWInit, which provides some static functions in the pre-autoloader environment.
* Introduced MWInit::compiledPath(), which provides a relative path for invoking a compiled file, and MWInit::interpretedPath(), which provides an absolute path for interpreting a PHP file. Used these new functions in the appropriate places.
* When we are running compiled code, don't include files which would generate duplicate class, function or constant definitions. Documented the new requirements on the contents of Defines.php and UtfNormalDefines.php.
* In HipHop compiled mode, it's not possible to have executable code in the same file as a class definition. 
  ** Moved MimeMagic initialisation to the constructor.
  ** Moved Namespace.php global variable initialisation to Setup.php.
  ** Moved MemcachedSessions.php initialisation to the caller in GlobalFunctions.php.
  ** Moved Sanitizer.php constants and global variables to static class members. Introduced an accessor function for the attribs regex, as a new place to put code formerly at file level. 
  ** Moved Language.php initialisation of $wgLanguageNames to Language::getLanguageNames(). Removed the global variable, marked "private" since forever.

* In two places: don't use error_log() with type=3 to append to a file, HipHop doesn't support it. Use file_put_contents() with FILE_APPEND instead.
* Work around the terrible breakage of class_exists() by using MWInit::classExists() instead in various places. In WebInstaller::getPageByName(), the class_exists() was marked with a fixme comment already, so I replaced it with an autoloader solution.
2011-04-04 12:59:55 +00:00
Tim Starling
1402a56f2a Fix for r85244: HipHop does not support the static form of method_exists(). 2011-04-04 03:42:34 +00:00
Daniel Friesen
7d0622b0cc Remove a dead patch of Skin code that was migrated completely into SkinLegacy and SkinTemplate already. 2011-04-04 00:42:52 +00:00
Daniel Friesen
ea8bfcd496 Fix use of mUser noted by c15657 on r85250. 2011-04-03 23:38:44 +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
4d1624f9f5 Followup r85244; Fix a small issue with the case of a variable name. 2011-04-03 12:37:07 +00:00
Daniel Friesen
c817a24081 Drop connetion between Skin and Linker and turn Linker into a staticly usable class. 2011-04-03 11:44:11 +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
Happy-melon
1abc3ba112 Follow-up r83336, r83460: abandon hardcoded styles altogether, and instead use a semantic element to pick up appropriate styles which are already in the global stylesheets. This makes it easier to keep track of where we have implemented this browser-specific tweak in case we have to modify it in future. By turning debugging on devs have already volunteered themselves to masses of gratuitous extra text-on-page, a few extra elements won't inconvenience them too much further. 2011-03-26 13:27:50 +00:00
Alexandre Emsenhuber
fc4c38348b * Make Skin::formatDebugHTML() work with $wgDebugTimestamps = true
* Removed escaping of ' since the string is defined with "
2011-03-07 18:21:58 +00:00
Antoine Musso
8a3dcccbda Remove second parameters from wfEmptyMsg() calls
The second parameter was removed in r64178 and is now useless.
There is probably no need to backport this in 1.17.
2011-03-07 17:10:22 +00:00
Antoine Musso
ae7215c4ad Keep monospace as a fallback for HTML debugging
Per CR on r83336. We also keep this as inline style since it is only
needed by developers anyway.
2011-03-07 16:36:35 +00:00
Antoine Musso
a8a47d6a12 Use 'Courier new' for $wgShowDebug HTML output
'Courier new' is rendered with a constant size in both monobook
and vector skins.  monospace is rendered too small under vector
with firefox/Linux.
Thus, this patch makes the font size consistent.
2011-03-05 22:26:09 +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
Daniel Friesen
bc19677685 Reduce usage of $wgOut inside Skin. 2011-03-03 10:22:46 +00:00
Alexandre Emsenhuber
304ce524eb Per Reedy, fix for r82034: forgot to change a wfGetCacheNotice() call (and also changed a comment) 2011-03-01 08:52:38 +00:00
Sam Reed
d677412428 Improve method documentation
Few bits of fixup
2011-02-19 21:16:47 +00:00
Alexandre Emsenhuber
461ef632c0 Follow-up r82452: need to transform entries sinces some wiki like to use variables or parser functions in the sidebar 2011-02-19 19:15:45 +00:00
Alexandre Emsenhuber
d0483bf747 * Use $this->mTitle instead of $wgTitle
* Put back the wfMsgForContentNoTrans() added in r66835 but reverted in r68707 since wfMsgForContent() is breaking the {{...}} syntax
2011-02-19 13:39:09 +00:00
Sam Reed
8b1bdb6e68 Remove unreachable line in DifferenceEngine
Documentation for ObjectCache.php

Remove unused variables from CompareParsers and PreprocessDump
2011-02-18 01:06:04 +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
Roan Kattouw
e2dc92dcbc Fix fatal in r82258 2011-02-16 17:31:53 +00:00
Roan Kattouw
f5533b0c98 Per Philip Tzou, move wgUserVariant from the set of config variables to the set of pageview-specific variables, because it depends on user settings and such 2011-02-16 17:06:24 +00:00
Alexandre Emsenhuber
b2a0cc74d5 Moved wfGetSiteNotice(), wfGetNamespaceNotice() and wfGetCachedNotice() to Skin call to allow passing the Skin object to the SiteNoticeBefore and SiteNoticeAfter hooks.
I didn't left compatibility functions since there's no other call to these functions in core or extensions.
2011-02-12 21:24:05 +00:00
Raimond Spekking
9fbeca5552 Follow-up r81604: Prefix new classes with 'mw-' per [[Manual:Coding conventions]] 2011-02-09 17:06:41 +00:00
Ilmari Karonen
6eb0ed9207 (bug 23315) Add new body classes to allow easier styling of special pages.
Also eliminate some duplicate code introduced into SpecialPage::headElement() in r61071 by calling Skin::getPageClasses() instead, and use $sk parameter instead of $wgUser->getSkin() to get skin name.
2011-02-06 21:08:48 +00:00
Daniel Friesen
3d220be8d6 Completely remove support for legacy style skins. All legacy skinning options are now part of a SkinLegacy/LegacySkinTemplate pair that inherits from the normal SkinTemplate setup. Also ported our three built in skins to use the new legacy classes. ( ;) if you want to kill legacy skins now, you only have to svn rm 4 files) 2011-02-04 04:18:05 +00:00
Daniel Friesen
8c9a20833e Commit some fixes for comments on r77741 2011-02-03 00:00:58 +00:00
Chad Horohoe
90fdb46ae5 Last $wgArticle junk in Skin(Template). Just pass the article on hand to lastModified(). Nothing outside of here calls it anyway 2011-01-26 17:06:18 +00:00
Chad Horohoe
8ac435b072 Followup r81034, remove the global statements 2011-01-26 16:56:46 +00:00
Chad Horohoe
c1a29795b4 First round of $wgArticle removals 2011-01-26 16:54:58 +00:00
Derk-Jan Hartman
e5bb119085 Port the remaining Skin.php skins standard(classic), Cologneblue and Nostalgia
* Converted Nostalgia's use of inline table alignment to CSS
* common_rtl.css is not in use now

Refs bug 26649
2011-01-23 01:41:13 +00:00
Niklas Laxström
0e181e122a Use same wording as in skintemplate 2011-01-11 14:27:15 +00:00
Alexandre Emsenhuber
28cdedf7c2 Seems there was a logic error in r80001 :) 2011-01-11 13:08:28 +00:00
Alexandre Emsenhuber
83a2f95f8b Simplify a bit:
* replaced calls to Article::getLatest() by Title::getLatestRevID()
* introduced Skin::isRevisionCurrent()
* made checks on Skin::pageStats() more coherent
2011-01-11 13:04:55 +00:00
Platonides
a52488c925 Remove unused global $wgRestrictionTypes, changed into Title::getRestrictionTypes() in r79655 2011-01-06 18:15:50 +00:00
Bryan Tong Minh
718ff89310 (bug 26574) Added 'upload' to $wgRestrictionTypes, allowing upload protected pages to be queried via the API and Special:ProtectedPages, and allowing disabling upload protection by removing it from $wgRestrictionTypes. 2011-01-05 19:17:36 +00:00
Alexandre Emsenhuber
bcb833d939 Use $this->mTitle instead of $wgArticle->getTitle() 2011-01-04 15:02:54 +00:00
Tim Starling
ccfe5ad97b Fix for bug 26561: clickjacking attacks. See the bug report for full documentation. 2011-01-04 06:12:33 +00:00
Daniel Friesen
5de2e40379 Implement "relevant" title and user in the skin system and update undelete, log, contributions, blockip, and movepage to use it.
A "Relevant" is used by the skin to determine what title to display tabs for. This setting allows pages like Special:MovePage (which is linked to from the tabs themselves) to retain the tabs specific to the page relevant to it when switching to the special page.
Similaly a "Relevant" user is used by the skin to display things in the toolbox which would usually only be displayed on the user's userpage and talkpage, pages like Special:Contributions which are linked to by the toolbox can use this to retain the toolbox links when switching between the user pages and these special pages.
2011-01-01 01:03:02 +00:00
Platonides
ed74c1549c When running phpunit with globals backup, $skinsInitialised will be kept to true, but $wgValidSkinNames reset to an empty array. Workarounding. 2010-12-26 22:24:55 +00:00
Daniel Friesen
442359e489 Changing the skin loader to load classes using the pattern "Skin{$skinName}" instead of "Skin" . ucfirst($key) as the current behavior has been causing bugs with extension based skins attempting to use the autoloader to load their skins.
Under current behavior for "MonoBook" the skin loader will load "SkinMonobook" instead of "SkinMonoBook". Because the skin system loads from skins/ when it can't find a skin and php's class system is case insensitive by a fluke MonoBook has been fine despite the skin loader trying to load SkinMonobook despite the class being named SkinMonoBook.
However our autoloader is case-sensitive, and as a result if you try to name your extension based skin class something like SkinStereoBook the skin will break with a cryptic error message because the skin loader attempts to load SkinStereobook, doesn't find it in the autoloader, then throws a php error when it tries to load skins/StereoBook.php and can't find the file.
We have also been using the $skinName to generate the name of the file to load from skins/ so this value is already expected to be safe for use in this way.
2010-12-26 14:15:27 +00:00
Happy-melon
8e57be2831 Follow-up r77762 per CR, and an unrelated one-character whitespace fix which doesn't deserve its own revision id... :D 2010-12-16 18:30:15 +00:00