Commit graph

990 commits

Author SHA1 Message Date
Chad Horohoe
b91ace27d9 Clean up the mess that is wfDie (resolves r85918). wfDie() doesn't exist anymore, so don't use it.
The only two usages left since r91590 are php version checks for index/load/api.php, and $wgAPIEnabled check in api.php. Consolidate all of the "bailing for invalid version" into PHPVersionError.php. Leaving $wgAPIEnabled as the only user was silly, so just echo and die like wfDie() would've done
2011-07-06 21:01:12 +00:00
Brion Vibber
0572c46e6d Partial revert of r91106: followup to r91127.
Suppressing all warning output from unserialize() in ExifBitmap::formatMetadata will hide actual errors; we're now checking explicitly for the bad-metadata and no-metadata markers so the case this was added for should not happen.
2011-07-06 18:47:35 +00:00
Chad Horohoe
46ef4b3961 Move wfShowingResultsNum() back into SpecialSearch where it belongs. No need for a global function for something thats only used once in core or extensions 2011-07-06 18:13:06 +00:00
Robin Pepermans
7c624542f0 (bug 6100; follow-up to r91315) Being bold and removing $wgBetterDirectionality (and dependent wfUILang) in core, as most or all work is finished.
Also:
* Introduce classes mw-float-end, mw-float-start so we don't have to use inline css depending on wfUILang()/$wgLang (see HistoryPage and SpecialFileDuplicateSearch)
* Add direction mark to protection log
* Remove specialpageattributes as it is obsoleted by this commit (also fixes bug 28572)
* Add two direction marks in wfSpecialList, which makes ltr links on rtl wiki (and vice versa) display nicely as well (only on those special pages however)
* Revert r91340 partially: use mw-content-ltr/rtl class anyway in shared.css. Both ways have their [dis]advantages...
* Set the direction of input fields by default to the content language direction (except buttons etc.) in shared.css
2011-07-06 02:26:06 +00:00
Sam Reed
6102b8fab8 More return documentation and trimming trailing whitespace 2011-06-30 02:59:43 +00:00
Bryan Tong Minh
c87574b7b4 Add wfUnserialize() wrapper around unserialize to prevent E_NOTICE and use it in ExifBitmap.php. There are probably many more places that could use this. This should fix Platonides' problem at r90421, but also added a check for $wgShowExif to prevent the test from failing. 2011-06-29 20:24:53 +00:00
Chad Horohoe
92ba47064b * Remove Exception.php's reliance on wfDie(), as well as the awful constant MEDIAWIKI_INSTALL (holdover from old installer)
* Rm checking for MEDIAWIKI_INSTALL in wfOut(), no codepath leads here from the installer anymore
2011-06-28 19:46:23 +00:00
Matěj Grabovský
09da27efa2 wfArrayToCGI() and wfCgiToArray() now handle nested and associative arrays almost correctly
The only problem is that all the indexes have to be set, thus "key[]=value" won't get parsed correctly and array( 'key' => array( 'value' ) ) will transform to "key[0]=value".

Related bug 28928 and bug 22989.
2011-06-23 15:25:07 +00:00
Robin Pepermans
15f3df018f * Improvements as part of bug 6100: Use wfUILang() instead of $wgContLang where appropriate
* Remove $wgContLang in SpecialVersion per r90302
2011-06-21 10:14:34 +00:00
Alexandre Emsenhuber
c92b3ee4a9 * Made $useDB parameter of wfMsgGetKey() optional as in wfMsgReal() and removed it where possible
* Removed it from the call to wfMsgReal() in wfMsg() too
2011-06-21 07:43:27 +00:00
Alexandre Emsenhuber
750b3928d6 Removed deprecated functions wfMsgNoDB(), wfMsgNoDBForContent() and wfMsgWeirdKey(); no remaining use in core or extensions. 2011-06-20 07:26:14 +00:00
Platonides
6be5bc3b63 Follow up r90361 2011-06-18 20:15:48 +00:00
Platonides
1f71f306a3 There is a nice $limit parameter in PHP 5.4, but calling debug_backtrace on earlier versions with too much parameters, it errors returning null, so we need a PHP_VERSION comparison. 2011-06-18 20:11:45 +00:00
Alexandre Emsenhuber
54a246f1e0 In wfBacktrcae(): print "->" or "::" whether the function was called dynamically or statically instead of always "::" 2011-06-17 17:13:43 +00:00
Sam Reed
3d3d027ce9 Minor doc fix to r84741
Remove unreachable code from WatchAction

Documentation added to Init.php
2011-06-16 23:40:13 +00:00
Alexandre Emsenhuber
658492e596 Groupped URL-related functions 2011-06-16 19:09:03 +00:00
Alexandre Emsenhuber
9027c35dca Removed usage of error suppression operator 2011-06-16 17:38:26 +00:00
Tim Starling
9420ff446e Removed $wgProto. Previously, setting this undocumented global variable to anything other than the part of $wgServer before the first colon would cause various things to subtly screw up. Similarly, forgetting to set it when you override $wgServer in LocalSettings.php would break things too.
Exposing it in the default LocalSettings.php as I did in r90105 was not a good solution, really the only way to avoid breakage is to just get the protocol from $wgServer whenever you need the protocol.

Fixed $wgCookieSecure so that it will be enabled automatically if the user sets $wgServer to an https URL in LocalSettings.php. Added documentation for other cookie-related globals.

Grep indicates that $wgProto is not used by any extensions. $wgCookieSecure is used, hence the need for the Setup.php patch.
2011-06-16 05:13:29 +00:00
Alexandre Emsenhuber
d9bceab097 Per Brion, follow-up r86784: doucment that wfMsg() and related also accept message parameters as an array in the second parameter 2011-06-15 16:33:13 +00:00
Platonides
41f3cb897b Revert r86897 in wfMakeUrlIndex() and solve the issue in wfParseUrl() 2011-06-14 20:57:42 +00:00
Sam Reed
202f4d7443 Fixup error message
Remove {} (documentation tweaks)

Remove whitespace
2011-06-05 23:44:37 +00:00
Chad Horohoe
5cca2119e3 rvv: r89398. Tim wants me to wait 2011-06-03 05:44:28 +00:00
Chad Horohoe
3465e3f083 Kill off action=raw from index.php
* One less entry point to worry about
* Completely obsolete by load.php and api.php
* Left $wgDebugRawPage in place, also affects load.php requests (docs already reflect)
* Affects dumpHTML (probably broken anyway, has anyone RL-ified this?), and two abandoned/obsolete extensions
2011-06-03 05:39:32 +00:00
Tim Starling
c00d63dda3 Make $wgDebugRawPage=false also ignore load.php, so that debug logs can be readable again. 2011-05-31 05:55:06 +00:00
Sam Reed
4065e65d03 Even more documentation in various files 2011-05-29 14:24:27 +00:00
Sam Reed
296f3d3f4f And even more documentation 2011-05-28 18:59:42 +00:00
Alexandre Emsenhuber
6494121882 Now that Hooks.php contains a class, moved wfRunHooks() definition to GlobalFunctions.php and removed its inclusion from Setup.php 2011-05-28 16:11:40 +00:00
Brion Vibber
87b966a789 * (bug 29140) FirePHP debugging assist extension
FirePHP is an extension to Firebug, an awesome debugging extension to Firefox.
It allows pulling debug log data in from your PHP script via HTTP headers, which then get displayed in Firebug's console along with errors, warnings, and AJAX hits from the web page.

Added 'Debug' hook which gets called from wfDebug() and wfDebugLog() to take this; note that a few lines of output won't make it to FirePHP as they are output either before we've done all plugin initialization, or after we've flushed output and can no longer add HTTP headers.

BSD-licensed FirePHPCore library from firephp-libs commit aff25803a3ff460b2797:
https://github.com/cadorn/firephp-libs/blob/aff25803a3ff460b2797/packages/core/lib/FirePHPCore/FirePHP.class.php

There's not a lot of fancy integration; everything's just output as a 'log' line.
You can use $wgFirePHP global (or call FirePHP::getInstance() yourself) to get direct access to FirePHP's fancier features in test code.
2011-05-25 22:01:08 +00:00
Alexandre Emsenhuber
8ad6638af8 Moved wfGetCaller(), wfGetAllCallers() and wfFormatStackFrame() near other related functions 2011-05-25 18:32:04 +00:00
Max Semenik
c79a16167a Introduced Maintenance::getDB() and corresponding setDB() to control externally what database object should be used by maintenance script. Currently used by updater to avoid DatabaseSqliteTest from running stuff like Populate* on the live database instead of the one used for testing. 2011-05-24 17:48:22 +00:00
Alexandre Emsenhuber
7ba005d503 Moved wfEmptyMsg() near other message functions 2011-05-23 19:42:00 +00:00
Chad Horohoe
7b03a38d4d wfDeprecated() plus doc update 2011-05-21 17:20:12 +00:00
Alexandre Emsenhuber
cf8a8cd575 Groupped array manipulation functions at the top of GlobalFunctions.php 2011-05-20 10:55:34 +00:00
Sam Reed
33ad682ab0 Add/remove/tweak method documentation 2011-05-19 00:03:31 +00:00
Siebrand Mazeland
75c6696aa8 Use consistent notation for "@todo FIXME". Should update http://svn.wikimedia.org/doc/todo.html nicely. 2011-05-17 22:03:20 +00:00
Krinkle
167325a56a Fixing typo from r55396 + code styl/whitespace 2011-05-17 21:54:12 +00:00
Siebrand Mazeland
e065a453f8 Make @deprecated documentation more consistent (see: http://svn.wikimedia.org/doc/deprecated.html). 2011-05-17 08:46:29 +00:00
Tim Starling
69f2c2edee Fix for HipHop breakage in r87748 etc. Please do not use require_once(dirname(__FILE__)...) to fetch class, function or define() dependencies anymore. You do not need to have HipHop to know that doing so will break it. 2011-05-15 13:36:59 +00:00
Tim Starling
6fec4e3fde Revert r87635, r87637, r87639, r87643 (MW_MIN_PHP_VERSION etc.): breaks HipHop support. 2011-05-15 13:21:16 +00:00
Alexandre Emsenhuber
fe22bc1543 $wgOut can no longer be a stub since r85278, so there's no need to check this with StubObject::isRealObject() 2011-05-08 08:50:11 +00:00
Happy-melon
fd34d0354b * Implement MW_VERSION constant in Defines.php and use it in preference to $wgVersion. Defines.php will have been loaded anywhere that DefaultSettings.php has been loaded.
* Move the declaration of $wgFeedClasses from Defines.php to WebStart.php
2011-05-07 14:53:08 +00:00
Sam Reed
f985524076 More versions added to @deprecated tags
Couple of inbound calls fixed up

Some ancient code removed as it's been marked deprecated
2011-05-06 21:50:18 +00:00
Sam Reed
5203c8dabc Couple more deprecated things removed 2011-05-06 20:50:16 +00:00
Sam Reed
3999f73a1f More __ for r87572 2011-05-06 20:46:13 +00:00
Sam Reed
f16b028b11 Add wfDeprecated( __METHOD ); to one method marked for 1.19 2011-05-06 20:43:32 +00:00
Alexandre Emsenhuber
b2a2494fa3 Remove functions marked for removal in 1.19 2011-05-06 18:10:53 +00:00
Alexandre Emsenhuber
8109f7bbf0 Moved wfTimestampNow() near other wfTimestamp() functions 2011-05-05 17:42:14 +00:00
Chad Horohoe
4f8dca8044 (bug 28641) Doc fix for wfEmptyMsg() 2011-05-05 05:26:27 +00:00
Alexandre Emsenhuber
ca7bcb1fac Recommit r87129 and follow-ups but with a fix for the bug Brion found (sorry) 2011-04-30 14:08:12 +00:00
Brion Vibber
85d99c4c52 Revert r87129 "(bug 21196) Article::getContributors() no longer fail on PostgreSQL" -- breaks stuff under MySQL like this:
SkinTemplate::makeTalkUrlDetails given invalid pagename User:

Backtrace:

#0 /var/www/trunk/includes/SkinTemplate.php(691): SkinTemplate->makeTalkUrlDetails('User:')
#1 /var/www/trunk/includes/SkinTemplate.php(495): SkinTemplate->buildPersonalUrls(Object(OutputPage))
#2 /var/www/trunk/includes/OutputPage.php(1906): SkinTemplate->outputPage(Object(OutputPage))
#3 /var/www/trunk/includes/Wiki.php(402): OutputPage->output()
#4 /var/www/trunk/index.php(146): MediaWiki->finalCleanup()
#5 {main}


Seen trivially by going to login page while not logged in; some user check is failing and ending up with an improperly initialized object.
2011-04-29 23:57:28 +00:00
Alexandre Emsenhuber
4fdddc9292 * (bug 21196) Article::getContributors() no longer fail on PostgreSQL
Changed User::loadFromRow() to allow partial row (user_id, user_name, user_real_name can be set independently from other fields) userand removed User::$mDataLoaded, replaced by User::$mLoadedItems (marked as private) that can be an array with already loaded items or true when all data has been loaded. Changed GlobalFunctions.php and Database.php accordingly, no use of User::$mDataLoaded in extensions.
2011-04-29 18:27:44 +00:00
Sam Reed
392cf33b57 Followup r86905, after saving GlobalFunctions.php 2011-04-25 21:41:02 +00:00
Brion Vibber
6fff535d08 * (bug 28627) External link normalization now handles file: URL cases without throwing notice warnings.
Added some test cases for wfMakeUrlIndex() to GlobalTests (tweaks $wgUrlProtocols to toss in file:// support so it can test them).
Needs more cases for other URL styles probably; some of the more pathological file: URL cases still won't normalize really cleanly but will go through the function without exploding. The most-needed variants will be the Windows/IE-compatible ones I think -- so file:///c:/foo or file://server/foo.
2011-04-25 21:00:49 +00:00
Alexandre Emsenhuber
b30f230809 Fix comment, language is handled correctly with parse and parseinline since r79642 2011-04-24 18:47:36 +00:00
Happy-melon
545d854a39 Documentation and type hinting. 2011-04-23 13:55:27 +00:00
Sam Reed
42b9b27823 Followup to r86312
<ialex> Reedy: that rev is breaking usage of {{PAGENAME}} in messages, such as in MediaWiki:Noarticles

Allowing optional passing in of a Title object (like it may be set in Message), but if it's not set, or not a title object, fall back and use $wgTitle (I'm sorry!)
2011-04-22 20:17:21 +00:00
Alexandre Emsenhuber
6922017164 Follow-up r86732: really mark it as deprecated ;) 2011-04-22 19:54:01 +00:00
Niklas Laxström
64163f0506 Add docs 2011-04-22 11:20:28 +00:00
Alexandre Emsenhuber
f495fe8639 Removed false comment introduced in r86633 2011-04-21 16:33:10 +00:00
Alexandre Emsenhuber
21e53d3590 * Added Profiler::isStub() to check if we are using a stub profiler, instead of checking whether $wgProfiler is set
* Replaced wfProfileClose() and wfGetProfilingOutput() by direct calls to the Profiler instance and removed them, no uses in extensions
* Also removed useless params from Profiler::getOutput() call in wfLogProfilingData()
* Only generate profiling output if it'll be used; introduced Profiler::logData() that saves profiling data (database, udp, ...) to separate it from output generation
* Removed unused Profiler::getCaller(), not used at all, and we have wfGetCaller() that does the same thing
2011-04-21 16:31:02 +00:00
Chad Horohoe
d748f8b7f1 Tweak wfDl() so it actually works properly in 5.3.x
Also add $fileName parameter in case the extension doesn't match the filename
Minor tweak for windows, its files begin php_
2011-04-20 23:33:28 +00:00
Platonides
1d4e17a91c Follow up r86447. Support the $wiki parameter 2011-04-20 15:32:10 +00:00
Platonides
62053ac8fd Merge r86398 into the old wfWaitForSlaves. Update core calls.
maintenance/waitForSlave.php still calls the old prototype.
Most instances were replaced with 
sed -i 's/wfWaitForSlaves( [0-9]* );/wfWaitForSlaves();/' ./maintenance/initEditCount.php ./maintenance/updateRestrictions.php ./maintenance/updateSpecialPages.php ./maintenance/importDump.php ./maintenance/moveBatch.php ./maintenance/storage/resolveStubs.php ./maintenance/storage/trackBlobs.php ./maintenance/storage/fixBug20757.php ./maintenance/storage/moveToExternal.php ./maintenance/storage/compressOld.inc ./maintenance/populateSha1.php ./maintenance/deleteDefaultMessages.php ./maintenance/migrateUserGroup.php ./maintenance/importImages.php ./maintenance/runJobs.php ./maintenance/archives/upgradeLogging.php ./maintenance/deleteBatch.php ./maintenance/populateLogSearch.php ./maintenance/populateLogUsertext.php ./maintenance/gearman/gearmanWorker.php ./maintenance/populateRevisionLength.php ./maintenance/refreshLinks.php ./maintenance/deleteSelfExternals.php ./maintenance/upgrade1_5.php ./maintenance/rebuildFileCache.php ./includes/job/RefreshLinksJob.php ./includes/installer/MysqlUpdater.php ./maintenance/convertUserOptions.php ./maintenance/populateParentId.php ./maintenance/runBatchedQuery.php ./maintenance/upgrade1_5.php ./maintenance/waitForSlave.php ./maintenance/populateCategory.php ./maintenance/importImages.php
2011-04-20 00:12:06 +00:00
Roan Kattouw
cdaa91bd27 Put the code for waiting for slave lag the new-and-improved way (using master position) in wfWaitForSlaves_masterPos(). I guess I should deprecate or re-do wfWaitForSlaves() and update callers, but I'm lazy 2011-04-19 14:52:11 +00:00
Alexandre Emsenhuber
e7660a8654 * Changed wfMsgNoDBForContent() call to wfMessage(); also switched to user's language, I don't see any reason to not display this in user's language
* Marked wfMsgNoDBForContent() as deprecated and added wfDeprecated() call; the call in LoadBalancer was the only one in core and extensions
* Also added call to wfDeprecated() in wfMsgWeirdKey(); no call in core or extensions
2011-04-19 06:21:06 +00:00
Happy-melon
b0a8402560 Follow-up r86113: define E_DEPRECATED for PHP 5.2 2011-04-18 23:36:47 +00:00
Sam Reed
5622567290 Followup rr86304
We need a title object for parsing, do one against the message key

Doesn't seem to be the best way, but it's the most applicable. If I abused $wgTitle, Chad would come and beat me too ;)
2011-04-18 14:02:13 +00:00
Sam Reed
9c19cb6e38 Followup r86304
Things won't just happily accept a ParserOutput object when they were getting strings before

Add missing calling parameter
2011-04-18 13:53:24 +00:00
Sam Reed
ca01d07fdd Replace $wgMessageCache with MessageCache::singleton()
Fix some tab/space issues

Follows up r86304
2011-04-18 12:59:50 +00:00
Sam Reed
3a0ed7a044 * (bug 28532) wfMsgExt() and wfMsgWikiHtml() use $wgOut->parse()
* (bug 16129) Transcluded special pages expose strip markers when they output parsed messages

Also adding some related documentation during my travels around the code
2011-04-18 12:43:53 +00:00
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
Alexandre Emsenhuber
4207ab0c63 * (bug 28511) Use [] syntax instead of {} for string offset access 2011-04-17 07:59:58 +00:00
Happy-melon
a9038b2c26 Some more documentation and replacing static Skin calls 2011-04-16 23:23:28 +00:00
Jure Kajzer
dfe31bfd27 * added E_DEPRECATED into wfSupressWarnings
merge into 1.17 if required PHP version will be 5.3+
2011-04-15 11:19:13 +00:00
Happy-melon
938a8eb347 Improvements to handling of 'catastrophic' errors, like unsupported PHP versions, no MySQL functions, no LocalSettings, etc.
* Fix parsing of the three major entry points (index.php, api.php, load.php) back to PHP 4.4.9.  We don't care what happens if you actually try to run these files on old versions, but the entry files need to parse correctly.
* consign /includes/templates/PHP4.php and /includes/templates/NoLocalSettings.php to the fiery pit of hell where they belong.
* Prevent loading of any other files for PHP < 5.  WebStart.php was rendered unparseable in PHP 4 by the introduction of try/catch blocks in r85327.
* Die outright with a pretty error message on PHP < 5.2.3 as well as PHP 4.  All versions of PHP below that throw parse errors of various sorts.
* Reimplement wfDie() to provide an entry-point-dependent die-with-readable-error-message function (for instance, we want a pretty human-readable page in index.php, something wrapped in CSS/JS /*...*/ comment block in load.php, etc).  
* Standardise the appearance of the catastrophic errors thrown at the top of the stack with the ones lower down (exception-within-exception, etc).  There isn't really a way to do this without duplication, AFAICT.
2011-04-12 20:38:16 +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
Happy-melon
3319058b88 Expand wfShowMaxLagError() into index.php. It was only being called from here and it's pretty non-portable. Doing so reveals that it's safe to move the declaration of $mediaWiki below the maxlag test, which will fractionally improve performance in that instance (partly compensating for having to parse OutputPage as introduced in r85278). 2011-04-03 20:43:50 +00:00
Alexandre Emsenhuber
81e9b02ff5 * Drop 5.1 compat code
* Fix one more PHP version requirement
2011-04-03 09:44:50 +00:00
Alexandre Emsenhuber
bc8abfe5b1 Drop 5.1 compatibility calls to session_set_cookie_params() and setcookie() since we require 5.2.3+ now 2011-04-01 09:50:09 +00:00
Sam Reed
d3f043c53a Add/update/improve various bits of documentation 2011-03-25 11:21:53 +00:00
Sam Reed
d25b872f76 Kill off some more old version checking stuffs 2011-03-16 22:38:17 +00:00
Platonides
36781c5b4c (Bug 28069) MediaWiki fails streaming files when mod_deflate and ob_gzhandler are also set
gzipped content with header: "Content-Encoding: , gzip"
2011-03-15 22:22:57 +00:00
Tim Starling
24bf07cc86 * Add a $count argument to wfIncrStats(), to allow it to increase the count by more than one at a time.
* Added stats to job insert and pop.
* Formalised live patch for UDP stats aggregation, adding $wgAggregateStatsID.
2011-03-10 00:00:34 +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
Tim Starling
be76d86932 * Rewrote ObjectCache.php to conform to the modern coding style, and to be less convoluted about how CACHE_ANYTHING and CACHE_ACCEL are resolved. Moved most functionality to static members of a new ObjectCache class.
* Moved the global functions to GlobalFunctions.php, where they are now just convenience wrappers. Made them return non-references. Updated callers (none found in extensions). 
* Added an advanced configuration method, $wgObjectCaches, which allows a lot more detail in the object cache configuration than $wgMainCacheType. 
* Made all object cache classes derive from BagOStuff. 
* Split the MWMemcached class into a generic client class and a MediaWiki-specific wrapper class. The wrapper class presents a simple BagOStuff interface to calling code, hiding memcached client internals, and will simplify the task of supporting the PECL extension.
* Added some extra constructor parameters to MWMemcached, configurable via $wgObjectCaches.
* Removed the *_multi() methods from BagOStuff, my grepping indicates that they are not used.
* Rewrote FakeMemCachedClient as a BagOStuff subclass, called EmptyBagOStuff.
* Added an optional "server" parameter to SQLBagOStuff. This allows the server holding the objectcache table to be different from the server holding the core DB.
* Added MultiWriteBagOStuff: a cache class which writes to multiple locations, and reads from them in a defined fallback sequence. This can be used to extend the cache space by adding disk-backed storage to existing in-memory caches.
* Made MWMemcached::get() return false on failure instead of null, to match the BagOStuff documentation and the other BagOStuff subclasses. Anything that was relying on it returning null would have already been broken with SqlBagOStuff.
* Fixed a bug in the memcached client causing keys with spaces or line breaks in them to break the memcached protocol, injecting arbitrary commands or parameters. Since the PECL client apparently also has this flaw, I implemented the fix in the wrapper class.
* Renamed BagOStuff::set_debug() to setDebug(), since we aren't emulating the memcached client anymore
* Fixed spelling error in MWMemcached: persistant -> persistent
2011-03-03 09:37:37 +00:00
Sam Reed
baf83f74b8 More explicit variable definitions, function documentation 2011-02-20 13:33:42 +00:00
Brion Vibber
7d2049c7e3 * (bug 26250, bug 23817) Fix wfObjectToArray() to descend into arrays; fixes processing of JSON return values for ForeignAPIRepo when native json module not present 2011-02-13 23:04:34 +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
Tim Starling
62afaa0972 Merge r81718 from 1.17wmf1 2011-02-08 12:08:21 +00:00
Antoine Musso
0fc566e318 Ignore code coverage for compatibility and shell functions
The compatibility functions in GlobalFunctions are just wrapper for
their equivalent in the Fallback class.  We should test the implementation
and we can safely ignore those wrappers.

Shell functions ignored make use of sleep() which is evil. They also
do some outputs to the console which is probably hard to test properly.
Given they are not critical, I just ignore their code coverage, we can
still test them though :)
2011-02-06 22:14:32 +00:00
Antoine Musso
8f45c9e03a bugfix for wfBCP47 and code coverage
Language code are case insensitive. The BCP 47 recommands nice
formatting nonetheless. This patch enhance our formatting:
- tags preceded by the private tag 'x' are now lower case
- 4 letters tags are now lower case with first letter uper cased

Please note the RFC seems to have a bug for az-Arab-x-AZE-derbend
which should be az-Arab-x-aze-derbend .  I have changed our test
to reflect this and added a comment for later reference.
2011-02-06 14:47:35 +00:00
Alexandre Emsenhuber
136f4c06fa Deprecated wfMsgWeirdKey(), use wfMessage() instead. Moved getDefaultMessageText() from Article to Title so that it can be used there instead of duplicating code. No usage in extensions. 2011-02-05 15:11:52 +00:00
Alexandre Emsenhuber
51c6afc751 * Replaced $wgMessageCache by MessageCache::singleton(); since we only use one instance of this class (as for ParserCache, LinkCache)
* MessageCache::singleton() calls wfGetMessageCacheStorage() directly instead of using $messageMemc, just in case this would be called before that variable is set
* Per TimStarling: also removed deprecated methods in MessageCache class: addMessages() and related, [get|set|enable|disable]Transform(), loadAllMessages(), loadMessageFile() and some others. Same for the legacyData stuff in LocalisationCache that was only used by MessageCache::addMessages() and related. 
* Converted remaining extensions
2011-01-26 15:42:04 +00:00
Ilmari Karonen
2fcb5285c3 bug 26781: make wfEscapeWikiText() escape "*", "#", ";" and ":" at the beginning of the output and after line feeds. Also make escaping of "{", "}" and "=" more thorough and rewrite to use strtr() instead of str_replace() and htmlspecialchars(). 2011-01-18 19:39:13 +00:00
Daniel Friesen
39ab3cfc9f Implement Message::isBlank and Message::isDisabled.
And while we're at it... update a random assortment of code using wfEmptyMsg to use the new wfMessage class and our exists/isBlank/isDisabled methods.
2011-01-14 10:51:05 +00:00
Daniel Friesen
2f933fedba Fix bug 14267 by adding support for a MediaWiki:Mainpage-nstab.
Additionally, *cough* *cough*:
* Add a Title::isMainPage helper for the fairly common $title->equals( Title::newMainPage() ); test.
* Update wfMessageFallback to also accept an array of message keys instead of requiring them listed as arguments to the function.
* Move the bulk of wfMessageFallback code into Message.php instead of leaving it in GlobalFunctions.php
* Change the wfMessageFallback implementation so that the Message class handles the fallbacks themselves eliminating any side effects caused by the fact that wfEmptyMsg always used usedb=false, language=userlang when one might actually use a different language or usedb setting in the message object that actually returned the text (this may be considered a wfEmptyMsg regression in 1.18).
* Make blank "" message contents fallback like nonexistant messages do.
* Re use the new tabAction array handling used to support mainpage-nstab in the talk and view tabs instead of making wfEmptyMsg calls directly in SkinTemplate.
2011-01-14 08:32:10 +00:00
Alexandre Emsenhuber
1e22a9dbde Allow OutputPage::parse() to parse in any langauge, modified wfMsgExt() and wfMessage() accordingly 2011-01-05 12:24:39 +00:00
X!
e1f21873d5 Fix r79494: Don't prefix functions now that they're in their own class 2011-01-04 01:44:11 +00:00
X!
1d0ac4a481 Move wfCreateObject to MWFunction::newObj. This uses the ReflectionClass to
instantiate a variable-length constructor in php 5.1.3 and up, and falls
back to the old, ugly, manual method that was in the old wfCreateObject
function. The instances in the core have been replaced.
2011-01-03 02:10:05 +00:00
X!
cbff3fe980 Followup to r79463: Move fallback functions to new Fallback class 2011-01-02 15:54:18 +00:00
X!
7d686e0164 GlobalFunction additions:
-in_string has a case-insensitive option
-wfClientAcceptsGzip has a force option to force resetting the static value, useful for unit tests

Unit tests for more global functions added
2011-01-02 04:38:04 +00:00
X!
cb424e7ad6 Fix r79463 and r79464: Syntax error 2011-01-02 01:35:24 +00:00
X!
c7341928d7 Accidental syntax error. *hides* 2011-01-02 01:34:26 +00:00
X!
373389b98f Move fallback function creation out of function_exists() conditionals.
This allows for unit testing of the fallback functions to ensure that
they work like the real functions do
2011-01-02 01:29:00 +00:00
Daniel Friesen
c510db2665 Merging Vector's navigation_urls and SkinTemplate's content_actions code into content_navigation. content_actions is now built by folding content_navigation and cleaning it up a bit.
content_actions hooks no longer work and have been dropped from the code, the hooks that affected vector before now affect all skins.
A few logic changes were made to make for a clean merge:
- vector was using vector-???-??? messages while SkinTemplate was using '???' messages. So as a side effect of merging that together all skins now support messages like '$skinname-view-history' which will fallback to the standard message if not defined.
- For MediaWiki: pages where the page does not exist but the message does in the i18n system SkinTemplate displayed "Edit" while Vector displayed "Create"; All skins now display "Edit".
- For users without undelete permissions SkinTemplate displayed an "Undelete" tab if the user had deletedhistory and deletedtext permissions. Vector would only display the tab for users with both deletedhistory and undelete permissions; The new behavior in all skins is to always display a tab if you have deletedhistory (since Special:Undelete will always have something to display) but display a "View ... deleted" instead of "Undelete" message if you do not have undelete permissions.
- Skins no longer need to hardcode tests for the &action= to decide if they should ignore the accesskey on some tabs, tabs which should not have an accesskey in the current page now have a "tooltiponly" key set to true.
2010-12-31 23:30:00 +00:00
X!
1993c83277 -Destroy the DB automatically when initting the DB
-Add $force option to wfSetVar
-More work on getting SQLite to work
2010-12-30 17:30:35 +00:00
Platonides
62f2f7b879 Fix r71751 problems with textual parameters.
Add a test for checking the problems which appeared in r71751
2010-12-30 16:10:42 +00:00
Sam Reed
50a74880a7 Followup r79229, fix varible type fail 2010-12-30 02:45:28 +00:00
Sam Reed
490367210b Add function return type hint to wfGetLBFactory
More parameter documentation to CloneDatabase
2010-12-30 02:44:26 +00:00
Roan Kattouw
341c94a05d Fix r79213: and $ts === null too, per CR 2010-12-29 22:30:07 +00:00
Roan Kattouw
093c65ec82 Followup r71751: change strict comparison to loose per CR, and add a comment explaining why 2010-12-29 22:28:26 +00:00
Mark A. Hershberger
aa08646a71 Misc whitespace changes, mostly EOL w/s and indention fixes so TAB = 4 spaces 2010-12-19 04:31:15 +00:00
Bryan Tong Minh
c71e58f76f Follow-up r75476: Windows set command treats everything until the && as part of the environment variable, resulting in a trailing whitespace which breaks stuff. 2010-12-18 15:00:11 +00:00
Chad Horohoe
9c84094cd0 * Handle output for DatabaseUpdater in the class itself, no more wfOut() usage in core :)
* Mark wfOut() deprecated
* CheckUser, OpenID and TitleKey still use wfOut :(
2010-12-17 15:31:01 +00:00
Tim Starling
84f3b30f9c Update references for wfEscapeShellArg() for r69732 etc. The very useful mailing list post that I cited has disappeared from the web! 2010-12-14 10:57:41 +00:00
Niklas Laxström
1f5ad5ffac Better debug logging which isn't misleading 2010-12-10 14:40:50 +00:00
Niklas Laxström
81791368a8 Don't unstub $wgOut just for adding debug messages 2010-12-10 12:03:39 +00:00
Siebrand Mazeland
af8b9eec6d * remove wfSeedRandom() which was marked for removal in 1.18.
* mark wfGetMimeMagic() for removal in 1.19.
* have wfLoadExtensionMessages() whine deprecated per comments and mark for removal in 1.20.
2010-12-09 11:31:09 +00:00
Platonides
a21b365848 Move wfQuotedPrintable() into UserMailer class 2010-12-08 23:09:29 +00:00
Platonides
1efb3c666a Follow up r77884. 2010-12-07 16:26:10 +00:00
Alexandre Emsenhuber
1f9be9ead2 Per Nikerabbit, follow-up to r77972: use a string instead of boolean for readability 2010-12-07 15:47:34 +00:00
Alexandre Emsenhuber
30caa2a8b9 Merged wfDoUpdates() and MediaWiki::doUpdates() in wfDoUpdates(); avoids code duplication 2010-12-07 11:49:13 +00:00
Alexandre Emsenhuber
cb6f556784 * (bug 26253) Removed $wgPostCommitUpdateList
As I said on the bug, this variable is not used since ages
2010-12-06 16:17:43 +00:00
Chad Horohoe
a13767d10f Cleanup r77883, contained unrelated debugging change 2010-12-06 15:34:28 +00:00
Chad Horohoe
0022d5ba4d Remove "checking for latest version" feature from the new installer. Originally a proof-of-concept, and I'm not satisfied with its state of completion enough to include it for 1.17. Reverts r71107, r71110, r71111, r71115, r71564, r65863, r57624, probably some others. 2010-12-06 15:32:32 +00:00
Antoine Musso
5cdd7614d5 pipe does not look nice in doxygen. fu r77499 2010-12-02 19:33:15 +00:00
Roan Kattouw
5173c6abe0 Correct typo in doc comment 2010-12-02 16:42:38 +00:00
Mark A. Hershberger
a465346c6e random w/s cleanup 2010-12-01 20:22:45 +00:00
Sam Reed
7320879184 Few braces and spaces
Fixing up documentation
2010-11-30 19:06:28 +00:00
Sam Reed
e76775e06f More unused variables 2010-11-30 18:44:50 +00:00
Platonides
ba3fd81ced Follow up r77407. Do it Right.
Fixes wfTimestamp() returning 0 instead of now.
2010-11-28 22:51:25 +00:00
Platonides
6c61f8f21c Fix bug introduced in r77171 2010-11-28 22:40:29 +00:00
Platonides
c8e8b4bfdb Follow up r77401.
Mixture of null/false.
Happens to also fix the parsertests issue.
2010-11-28 22:27:50 +00:00
Platonides
d9fce2a683 Fix bug discovered in r77171 from the user data in If-Modified-Since passed by resource loader.
Added in wfTimestamp reading support for the three http date formats.
Increased conformance reading rfc2822 dates (read support added in r71750/r71751). We may not want full compliance with rfc2822, though.
The only provider of rfc2822 dates is probably http and that uses a subset (it's rfc822 + 4-digit years from rfc1123).
Make wfTimestamp() return false in case of a wrong input, according to CR.
2010-11-28 21:59:16 +00:00
Platonides
d64ff38529 Follow up r77171 2010-11-26 15:47:51 +00:00
Platonides
46429582a1 Bug 25451: time and date calculation in 32-bit
Follow up r75761. Now calculation is right (passes all tests)
on php 32 bits when using PHP >= 5.2
without prejudice to PHP 32/64 bits < 5.2 on the 32 bit range 
(regardless of architecture)
2010-11-23 18:25:00 +00:00
Tim Starling
7dd27a858c In wfEscapeWikiText(), add "}}" to the list of things to escape, for callers that produce template invocations, as in r77128. 2010-11-23 02:39:04 +00:00
Antoine Musso
8843ebacb1 Note version and revision deprecating wfGetMimeMagic (fu r68837) 2010-11-21 12:03:17 +00:00
Tim Starling
6dcca60f65 * Some tweaks to wfMemoryLimit() to make it a bit faster.
* Fixed inappropriate use of empty(), added "break missing" comments as in zend_atol()
2010-11-19 06:49:15 +00:00
Max Semenik
269c58210a Fixed passing of parameter array to wfMessage() 2010-11-16 20:40:20 +00:00
Jack Phoenix
8145995765 follow-up to r75761: coding style tweaks 2010-10-31 23:48:26 +00:00
Platonides
bcc23d6f46 Change wfTimestamp() to an array() and add a bunch of timestamp tests hard for 32 bit php.
Intended to ease transition to DateTime. See r74778 and Bug 25451
2010-10-31 23:30:41 +00:00
Sam Reed
c40d38a5be Remove a few more unused variables
Add a couple of braces to unobvious if
2010-10-31 23:19:40 +00:00
Sam Reed
408247d80b More function parameter commenting 2010-10-27 23:56:01 +00:00
Platonides
3b30c2fa0e Provide a proper implementation for passing environment variables to wfShellExec()
The quick fix of r74821 is no longer needed.
2010-10-26 22:17:42 +00:00
Platonides
6408312bb3 Reorder to shortcut some more php_uname() calls.
Note that PHP 5.2.1 can't run on Windows 9x since it wouldn't be able to 
link with the GetBinaryType() function (added in PHP r225464)
2010-10-26 20:54:29 +00:00
Platonides
0b7e7be4cc Cache the results of wfIsWindows()
Each php_uname() call produces a uname syscall.

The cached one is three times faster (3.197545885) which is liklely to be the difference between a php var lookup and a syscall on my system.

== Test script ==
<?php

function wfIsWindows() {
	if ( substr( php_uname(), 0, 7 ) == 'Windows' ) {
		return true;
	} else {
		return false;
	}
}

function wfIsWindowsCached() {
	static $isWindows = null;
	if ( $isWindows === null ) {
		$isWindows = substr( php_uname(), 0, 7 ) == 'Windows';
	}
	return $isWindows;
}


$win = $nonwin = 0;

$time = microtime( true );
for ( $i = 1; $i < 5e8; $i++ ) {
	if ( wfIsWindowsCached() ) {
		$win++;
	} else {
		$nonwin++;
	}
}

$time = microtime( true ) - $time;
echo "Time elapsed: $time\n";
2010-10-26 15:14:56 +00:00
Platonides
ff14cd20a3 Place into an else branch in the odd case where we are in safe_mode and passthru is additionally blocked. 2010-10-26 14:31:13 +00:00
Platonides
d09f081aa2 $wgUser is never a Stub since r70970. 2010-10-17 22:47:24 +00:00