Commit graph

147 commits

Author SHA1 Message Date
Shinjiman
6dc2f67fff * Re-implement the message caches for r35821
* Tweaked the message fetching on the MediaWiki:Conversiontable/xx-xx by changes of the message caching
  patch by Nikerabbit
2008-07-05 15:39:10 +00:00
Brion Vibber
918ec72c43 Revert the rest of r36804 -- ExtendJSGlobalVars and wfMessageCacheReplace hooks.
ExtendJSGlobalVars is probably ok in function, though I don't really like its name.

wfMessageCacheReplace seems really unclear as to what it's trying to accomplish.
2008-07-02 22:56:15 +00:00
Jack Phoenix
599b5a42d0 Two new hooks and one new global function from Wikia codebase 2008-06-30 08:42:09 +00:00
Shinjiman
4c2546b551 Revert r35821, the change brokes the message cache what the MediaWiki:Conversiontable/xx-xx are using, also this would lose the effects what have been set in the MediaWiki:Conversiontable/xx-xx. 2008-06-30 03:02:06 +00:00
Niklas Laxström
e648c5fe13 * Second try of split message caches with changes suggested by Tim Starling and other small fixes
* removed use of umask, wfMkdirParents works now
 * splitting of messages per language is now unconditional
 * storing cached messages in 2-d array of code => messages
 * fixed a bug in replace(), now deletion works properly
 * clear() should actually do something now
 * try to delay parser creation in transform()
 * removed the use of $memcPrefix and wfMemcKeyLang() in favour of wfMemcKey()
 * escape $code in loadFromDb()
 * use member variable instead of static variable for tracking loaded languages
2008-06-03 20:41:57 +00:00
Tim Starling
f3bffd7ca9 Revert r35478, r35264, r35262: $wgPerLanguageCaching feature. Bug found with $wgPerLanguageCaching=false. Nikerabbit, please see me for a detailed code review. 2008-06-01 03:27:48 +00:00
Alexandre Emsenhuber
87afc79d3b E_NOTICE: undefined variable $code in MessageCache::saveToCaches() 2008-05-28 12:17:03 +00:00
Niklas Laxström
0f5e68b417 * New option $wgPerLanguageCaching, for wikies with many translated system messages in MediaWiki namespace.
* Sidebar is now cached for all languages
2008-05-23 22:14:32 +00:00
Alexandre Emsenhuber
087a9f70c5 WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>

Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage

One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
Robert Leverington
32494abdb1 * $name instead of $file.
* Remove unnecessary if.
2008-05-05 15:03:42 +00:00
Robert Leverington
fd880384c4 * Use wfLoadExtensionMessages() in MessageCache::loadAllMessages() instead of MessageCache::loadMessagesFile(). 2008-05-05 15:00:16 +00:00
Robert Leverington
deca107b90 * wfLoadExtensionMessages() now accepts a language code as its second argument, rather than a boolean indicating whether or not to load all messages. This allows extension developers to be more discriminate with regards to which languages they load, avoiding the problem of loading lots of message localisations and fall backs not being merged in. 2008-05-05 13:29:51 +00:00
Robert Leverington
225c34df76 Revert r33918, no longer works given new fallback caching and there are alternate methods for determining message fallback. 2008-04-27 14:50:55 +00:00
Robert Leverington
8e3967d0a9 * Add parameter to MessageCache::get() to allow prevention of using a fallback language (default: false).
* Add option to wfMsgExt() 'nofallback' as an interface to the new parameter added to MessageCache::get().
2008-04-26 18:05:43 +00:00
Alexandre Emsenhuber
6a6482ab0c * Simplify a bit MessageCache::get(), don't load all valid languages name if the value passed is boolean
* do the same in wfMsgGetKey()
2008-04-24 13:02:32 +00:00
Robert Leverington
932aa091c7 * MessageCache::get $forContent parameter replaced with $langcode parameter so
that messages can be retreieved for any language.
* wfLoadExtensionMessages() now has the option to load messages for all the
  languages it contains.
* 'language' option added to wfMsgExt() so that a message can be retreieved from
  a specific language.
2008-04-24 11:59:32 +00:00
Siebrand Mazeland
bfc3734308 Remove getKeys(). Unused in core and extensions in SVN. 2008-04-20 18:52:24 +00:00
Siebrand Mazeland
79d5225c0e * remove end of line whitespace
* remove empty lines at end of file
* remove "?>" where still present
2008-04-14 07:45:50 +00:00
Alexandre Emsenhuber
e594cb011a * (bug 13431) Show true message source in Special:Allmessages&ot=php / xml
* Use Xml::* functions instead of wf* ones
* Call wfDeprecated() in MessageCache::disableTransform(), MessageCache::enableTransform(), MessageCache::setTransform() and MessageCache::getTransform()
2008-04-02 11:49:55 +00:00
Alexandre Emsenhuber
0d69ec9920 per r32027, use wfDeprecated() instead of trigger_error() 2008-03-16 18:26:10 +00:00
Tim Starling
870e2c7e32 * Fix bug 13002
* Fix excessive memory usage in MessageCache::loadFromLocal()
2008-02-13 05:46:43 +00:00
Tim Starling
5999d65b60 Fixed total breakage of the local message cache since r30437 2008-02-10 14:29:17 +00:00
Tim Starling
97522367b2 Reset the message cache on action=purge of a MediaWiki namespace page. Delete the sidebar cache *after* the message cache is updated, not before. If you delete it before then the same version might get cached again. 2008-02-09 10:01:35 +00:00
Niklas Laxström
186eb4ba30 * (bug 12880) wfLoadExtensionMessages does not use $fallback from MessagesXx.php 2008-02-02 20:33:25 +00:00
Niklas Laxström
0d1fc50c69 * Refactor a little to reduce code duplication
* Check language code validity
2008-02-02 18:15:57 +00:00
Brion Vibber
8b84dcd187 Apply a live hack from Wikimedia codebase: throw exception on invalid input to MessageCache::addMessages() 2008-01-29 01:04:29 +00:00
Tim Starling
6bfc746e83 * Eliminated message mode (OT_MSG), using OT_PREPROCESS instead. As proposed on wikitech-l.
* Fixed #tag behaviour in preprocess()
* Fixed #tag quote stripping regex
* Made MessageCache::getMessage() never transform its result, that is now left up to the caller. 
* A few other minor changes
2008-01-19 09:03:45 +00:00
Niklas Laxström
b20844540e * (bug 11452) wfMsgExt uses sometimes wrong language object for parsing magic words when called with options ''parsemag'' or ''content''. 2007-10-22 19:33:46 +00:00
Rotem Liss
44215dc542 If no messages are specified in the extension file, don't load them. 2007-09-10 22:53:17 +00:00
Tim Starling
5cb6ceee73 Allow extensions to define magic words by simply including a $magicWords variable in their registered i18n file. 2007-09-04 02:48:34 +00:00
Tim Starling
164bb322f2 Basic integrated audio/video support, with Ogg implementation.
* JavaScript video player based loosely on Greg Maxwell's player
* Image page text snippet customisation
* Abstraction of transform parameters in the parser. Introduced Linker::makeImageLink2().
* Made canRender(), mustRender() depend on file, not just on handler. Moved width=0, height=0 checking to ImageHandler::canRender(), since audio streams have width=height=0 but should be rendered.

Also:
* Automatic upgrade for oldimage rows on image page view, allows media handler selection based on oi_*_mime
* oi_*_mime unconditionally referenced, REQUIRES SCHEMA UPGRADE
* Don't destroy file info for missing files on upgrade
* Simple, centralised extension message file handling
* Made MessageCache::loadAllMessages non-static, optimised for repeated-call case due to abuse in User.php
* Support for lightweight parser output hooks, with callback whitelist for security
* Moved Linker::formatSize() to Language, to join the new formatTimePeriod() and formatBitrate()
* Introduced MagicWordArray, regex capture trick requires that magic word IDs DO NOT CONTAIN HYPHENS.
2007-08-15 10:50:09 +00:00
Rotem Liss
c2663cae7e This function is now not completely new, thus new extensions which don't have to be backwards-compatible can use it. 2007-07-11 15:24:33 +00:00
Aryeh Gregor
a15c419b3d Remove ?>'s from files. They're pointless, and just asking for people to mess with the files and add trailing whitespace. (Yes, I looked over every one and reverted those that were bogus. Slash-enter a million times in less worked well enough, although it was a bit mind-numbing.) 2007-06-29 01:19:14 +00:00
Tim Starling
234929d3ba 2nd attempt 2007-04-27 16:39:21 +00:00
Tim Starling
2461522f1c Fix MessageCache issue which caused the MediaWiki namespace to be ignored on the second call to wfMsg() for the same key. 2007-04-27 16:36:34 +00:00
Nick Jenkins
f88c771756 The war on redundant ampersand usage!
* Convert "$dbw =& wfGetDB( DB_MASTER );" --> "$dbw = wfGetDB( DB_MASTER );"
* convert "$skin =& $wgUser->getSkin();" --> "$skin = $wgUser->getSkin();"

For the time being have not changed the function definitions of wfGetDB() or User::getSkin() [i.e. they are still both return-by-ref], so as to ensure the interface does not change for extensions [some of which may still be trying to run on PHP4 environments]. However presumably at some point this can be changed too.

Also includes tiny tweak to newlines in parserTests - will show 1 rather than 2 newlines between the "Reading tests from" strings when in quiet mode.
2007-01-22 23:50:42 +00:00
Antoine Musso
c771fc9c96 Use Doxygen @addtogroup instead of phpdoc @package && @subpackage 2007-01-20 15:09:52 +00:00
Nick Jenkins
784e69d028 For the "includes/" directory:
* removing unused local vars
* removing used global declarations
* adding FIXMEs against extract() calls and lines that seem to be using uninitialized variables
* adding some array() declarations.
2007-01-12 10:03:51 +00:00
Brion Vibber
28844ed5c5 Fix regression in pulling *non*-default messages with spaces. Broke sidebar on www.mediawiki.org 2007-01-09 00:21:55 +00:00
Brion Vibber
efdffb2bca Fix regression in use of messages with underscores/spaces; normalize spaces to underscores for loading 2007-01-09 00:00:56 +00:00
Tim Starling
fee5bf298f fix breakage of wfEmptyMsg 2007-01-07 15:43:23 +00:00
Tim Starling
6b914045d7 Correct behaviour for title-case key input. 2007-01-07 14:22:32 +00:00
Rotem Liss
64cdd7bf34 Adding MessageCache::addMessagesByLang for localised extensions. Please do not use it for now, for backwards compatibility. 2007-01-06 18:29:53 +00:00
Tim Starling
fbe8b94bbe * The MediaWiki namespace is no longer pre-filled with default messages on install. All default messages will be removed from the MediaWiki namespace on upgrade.
* Swapped the order of dimensions in the 2-d array $wgMessageCache->mExtensionMessages.
2007-01-05 18:08:29 +00:00
Tim Starling
b1cd1b035c Fixed inefficient use of array_keys() introduced by Nick in r17880. If this is setting off alarms, then fix the alarms. 2006-11-25 17:11:58 +00:00
Nick Jenkins
14c53b728f Code housekeeping stuff (and barring any stuff-ups on my behalf, there should be no changes in behaviour whatsoever after this) -
* removing some unused global declarations.
* removing or commenting out or adding comments for unused local vars.
* Adding one or two local var declarations.
* Declaring $matches array passed to preg_match() / preg_match_all() as array() before using [not required, just have a slight preference for the explicitness].
* remove one or two pass-by-reference function declarations where the value is not modified.
* Adding some braces to if-else blocks.
* In Parser.php, stripstrate is now an object rather than an array as per r17820, so we no longer need ask for a reference to it (as in "$x =& $this->mStripState;"), and in fact it's probably just simpler to get rid of $x altogether.
* Moving some preg regexes from "" quoting to '' quoting to stop static analyzer whinging about bad escape sequences.

... up to "LinksUpdate.php" in the includes/ directory.
2006-11-23 08:25:56 +00:00
Tim Starling
b4ccf8ae4a Removed broken redundant fallback to the Language message array. Message arrays are now merged pre-cache. It's a static call on a non-static function, it actually calls back to $wgMessageCache->load(), destroying the per-process message cache on every cache miss. 2006-11-16 16:49:23 +00:00
Tim Starling
5e60b97c3f Some message caches are over 1MB 2006-10-08 23:24:43 +00:00
Tim Starling
e174a4ddfb Abolished $wgDBname as a unique wiki identifier, it doesn't work with the new-fangled feature we call "table prefixes". Instead use wfWikiID() for an identifier containing the DB name and the prefix if there is one, and wfMemcKey() for cache key construction.
Caches for wikis with table prefixes will be lost on upgrade, caches for wikis without table prefixes will be preserved. Custom cache keys in extensions can be migrated at leisure. Extensions which write to core cache keys should be migrated ASAP, as I have done with Special:Makesysop.
2006-10-04 09:06:18 +00:00
Rotem Liss
ad8032b081 Creating the function MessageCache::getExtensionMessagesFor, to get an array of the extension messages in a specific language, and avoid the ugly hack in Special:Allmessages, which uses a private variable of wgMessageCache and uses is_array to check the array of messages, which includes both regular strings (as should be) and arrays of the languages. 2006-09-03 16:31:28 +00:00