Commit graph

853 commits

Author SHA1 Message Date
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