Commit graph

207 commits

Author SHA1 Message Date
Philip Tzou
ea02974cb6 revert r77452, r80492 and r82246. 2011-02-16 16:07:58 +00:00
Philip Tzou
9babe5aa4f Follow r77452, r80492. Avoid to find sub-languages when load css/js messages. 2011-02-16 14:18:43 +00:00
Platonides
57e0786ec3 More wfProfileOut()ing 2011-02-10 16:04:19 +00:00
Alexandre Emsenhuber
195eafd6ef * Add a amtitle param to meta=allmessages
Only used used when amenableparser is passed; the user can now define the page used for {{PAGENAME}} and related stuff instead of being hardcoded to "API"
2011-02-09 15:19:45 +00:00
Jack Phoenix
292cb800d5 MessageCache.php: fixed a typo, tweaked spacing, added braces where needed, etc. 2011-01-26 17:41:18 +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
Philip Tzou
928181ad67 Follow up r77452. Follow mark's suggest to remove getCodeForMessage() and explain why use getPreferredVariant() instead of getCode(). 2011-01-18 07:59:53 +00:00
Niklas Laxström
2a66100694 Fix regression in r70657. Misplaced else condition was causing cache misses
to try to load the message text and cache the result individually. However
in the default configuration cache miss always means that the message doesn't
exists in the database.
2010-12-10 13:18:11 +00:00
Sam Reed
c5295ae06a Assignment to $messages ($message = $this->escapeForScript($message);) seemed wrong 2010-11-30 18:37:56 +00:00
Philip Tzou
881214d130 Select a friendly sub-language while acquiring system messages if the uselang has multiple variants available for use. 2010-11-30 03:04:47 +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
6b3b915353 Big attack on unused variables... 2010-10-14 20:53:04 +00:00
Siebrand Mazeland
603442acc4 Fix broken r74177 because it needs a constant and address CR comment on r71412 properly. Documented that 604800 is 7*24*3600 2010-10-02 23:34:58 +00:00
Siebrand Mazeland
91ff51a791 Use 7*24*3600 instead of 604800.
Addressing style nitpick by Simetrical on r71412.
2010-10-02 23:23:10 +00:00
Platonides
4730fdce27 Follow up r73951 2010-09-29 20:24:38 +00:00
Platonides
adf45bb4e1 Tiny changes, fix comment, remove unused globals and throw and exception instead of a fatal if given a wrong langcode. 2010-09-29 15:54:43 +00:00
Platonides
537826a674 Remove $wgContLanguageCode usage in core.
sed -i 's/$wgContLanguageCode/$wgLanguageCode/g'
These are now the same, always. Per and since r15827.

$wgLanguageCode wins due to being the one set by LocalSettings.

$wgContLanguageCode definition at includes/Setup.php kept for now.
2010-09-07 22:37:55 +00:00
Ryan Kaldari
d7b4975b49 fix for Bug 25031, hopefully this doesn't break other things. 2010-09-07 21:59:38 +00:00
Platonides
0c52065dac Follow-up r72349.
Remove unused globals $wgStylePath, $wgStyleVersion, $wgUser and the no longer used $wgJQueryOnEveryPage.
2010-09-04 13:27:12 +00:00
Roan Kattouw
32377424b9 Merging resourceloader branch into trunk. Full documentation is at http://www.mediawiki.org/wiki/ResourceLoader and a general overview has been posted on wikitech-li <http://lists.wikimedia.org/pipermail/wikitech-l/2010-September/049253.html>. One important change is that all JS is now loaded at the bottom, so any scripts assuming things from wikibits or whatever are present will fail. 2010-09-04 04:00:09 +00:00
Platonides
94a7962a5f Follow up r71412. $wgContLang is not used. 2010-08-21 20:47:15 +00:00
Niklas Laxström
7c5ac43dc4 Added $wgAdaptiveMessageCache to avoid caching huge pile of never used messages at twn. 2010-08-21 16:41:53 +00:00
Niklas Laxström
b7ab76d6a3 Allow negative caching in process cache and use it, return early in replace() if cannot use db 2010-08-08 00:28:17 +00:00
Niklas Laxström
9de31b0ad0 Use for loops for iterating query results 2010-08-07 23:43:28 +00:00
Niklas Laxström
7097563847 Spelling fixes in documentation 2010-08-07 23:41:03 +00:00
Niklas Laxström
6ccc20379e Further cleanup by removing unused member variables, adding protected access and documentation
Found no direct access to member variables in the repo.
2010-08-05 18:38:42 +00:00
Niklas Laxström
ed774b174d Remove unused fourth parameter for message cache constructor 2010-08-05 18:26:13 +00:00
Niklas Laxström
4f991374c4 Simplify MessageCache by removing mUseCache
Instead, make sure mMemc is always valid
2010-08-05 18:19:34 +00:00
Niklas Laxström
6d4b5a79f5 Fail fast if given invalid input. We've had some of these in the past and they were hard to track down. 2010-08-05 16:40:50 +00:00
Siebrand Mazeland
322d0e7873 Update calling function name for MessageCache::loadFromDB() queries 2010-07-30 08:00:29 +00:00
Aryeh Gregor
74a21f3bd1 Remove most named character references from output
Recommit of r66254 to trunk.  This was just

find extensions phase3 -iname '*.php' \! -iname '*.i18n.php' \! -iname 'Messages*.php' \! -iname '*_Messages.php' -exec sed -i 's/&nbsp;/\&#160;/g;s/&mdash;/―/g;s/&bull;/•/g;s/&aacute;/á/g;s/&acute;/´/g;s/&agrave;/à/g;s/&alpha;/α/g;s/&auml;/ä/g;s/&ccedil;/ç/g;s/&copy;/©/g;s/&darr;/↓/g;s/&deg;/°/g;s/&eacute;/é/g;s/&ecirc;/ê/g;s/&euml;/ë/g;s/&egrave;/è/g;s/&euro;/€/g;s/&harr;//g;s/&hellip;/…/g;s/&iacute;/í/g;s/&igrave;/ì/g;s/&larr;/←/g;s/&ldquo;/“/g;s/&middot;/·/g;s/&minus;/−/g;s/&ndash;/–/g;s/&oacute;/ó/g;s/&ocirc;/ô/g;s/&oelig;/œ/g;s/&ograve;/ò/g;s/&otilde;/õ/g;s/&ouml;/ö/g;s/&pound;/£/g;s/&prime;/′/g;s/&Prime;/″/g;s/&raquo;/»/g;s/&rarr;/→/g;s/&rdquo;/”/g;s/&Sigma;/Σ/g;s/&times;/×/g;s/&uacute;/ú/g;s/&uarr;/↑/g;s/&uuml;/ü/g;s/&yen;/¥/g' {} +

followed by reading over every single line of the resulting diff and
fixing a whole bunch of false positives.  The reason for this change is
given in <http://lists.wikimedia.org/pipermail/wikitech-l/2010-April/047617.html>.
I cleared it with Tim and Brion on IRC before committing.  It might
cause a few problems, but I tried to be careful; please report any
issues.

I skipped all messages files.  I plan to make a follow-up commit that
alters wfMsgExt() with 'escapenoentities' to sanitize all the entities.
That way, the only messages that will be problems will be ones that
output raw HTML, and we want to get rid of those anyway.

This should get rid of all named entities everywhere except messages.  I
skipped a few things like &nbsp that I noticed in manual inspection,
because they weren't well-formed XML anyway.

Also, to everyone who uses non-breaking spaces when they could use a
normal space, or nothing at all, or CSS padding: I still hate you.  Die.
2010-05-30 17:33:59 +00:00
Alexandre Emsenhuber
691f5c4795 Fixed some doxygen warnings 2010-04-09 21:27:23 +00:00
Happy-melon
ae3ced88e5 Make MessageCache::get() return false if the requested message does not exist, and handle setting the '<$key>' one layer further down in wfMsgGetKey(). Allows us to get away from that horrible string comparison in wfEmptyMsg(). 2010-03-25 20:21:31 +00:00
Emil Podlaszewski
25e273216a individual message cache entries should start with ' ', also in memcached 2010-02-11 14:17:22 +00:00
Mark A. Hershberger
5162f49f97 Random whitespace cleanup 2010-02-05 04:25:30 +00:00
Mark A. Hershberger
faac46493e follow up 61775 -- REVERT REVERT 2010-02-01 04:57:42 +00:00
Mark A. Hershberger
29ed343b4c Fix parsertests so that they work even when server-side thumbnailing isn't configured. 2010-02-01 04:55:15 +00:00
Max Semenik
ae57ab1eec (bug 20275) Fixed LIKE queries on SQLite backend
* All manually built LIKE queries in the core are replaced with a wrapper function Database::buildLike()
* This function automatically performs all escaping, so Database::escapeLike() is now almost never used
2009-10-21 19:53:03 +00:00
Tim Starling
cb2f984e0d Reverted breakage of non-ASCII message keys, Domas says that's not allowed. Optimised Language::lcfirst and Language::ucfirst() instead.
Timings in microseconds for ASCII no-change, ASCII change, non-ASCII no-change, non-ASCII change:
lcfirst: 1.8, 3.6, 21.2, 22.1
ucfirst: 1.5, 2.3, 21.1, 21.7
2009-08-28 17:58:54 +00:00
Tim Starling
84b6a177f1 * Converted BagOStuff.php from the style of memcached-client.php to the standard MediaWiki style, including camel case, using protected visibility instead of initial underscore, abstract functions instead of stubs, stylize.php.
* In SqlBagOStuff, ignore errors due to a read-only database, per my comments on CR r42796. Same for LocalisationCache. 
* Merged SqlBagOStuff and MediaWikiBagOStuff, that proved to be an awkward and unnecessary generalisation. Use the standard quoting wrapper functions instead of $db->query(). 
* Implemented atomic incr() and decr() functions for SqlBagOStuff. 
* Made incr() and decr() generally work roughly the same as it does in memcached, respecting negative steps instead of ignoring such operations. This allows decr() to be implemented in terms of incr().
* Per bug 11533, in MessageCache.php, don't retry 20 times on a cache failure, that's really memcached-specific and won't be useful for other cache types. It's not really very useful for memcached either.
* Moved MySQL-specific implementations of wasDeadlock() and wasErrorReissuable() to DatabaseMysql.
* Briefly tested page views with $wgReadOnly=read_only=1, fixed an error from Article::viewUpdates(). A CentralAuth fix will be in a subsequent commit.
2009-08-15 03:45:19 +00:00
Niklas Laxström
16bd8f0406 * Fix sidebar purging code (still unknown to me what causes it to cache bad version)
* Add language code to the load method
2009-07-31 07:12:25 +00:00
Tim Starling
f0b42f5f64 Made wfMsg('') and wfMsg(null) silently return &lt;&gt; as it did before r52503. Thanks to those who supplied backtraces. 2009-07-10 11:54:32 +00:00
Tim Starling
1f79ae389d * Re-added $wgMessageCache->addMessages(), there are still some extensions (in and out of subversion) that rely on it. Call wfDeprecated().
* Made wfDeprecated() issue a notice only once for each function name instead of every time the function is called.
* Added exceptions for malformed keys input to $wgMessageCache->get(), per CR comments on r52503
* Fixed notice from MWException::useMessageCache()
2009-07-03 06:19:39 +00:00
Tim Starling
23cfebd3d2 * Introduced a new system for localisation caching. The system is based around fast fetches of individual messages, minimising memory overhead and startup time in the typical case. It handles both core messages (formerly in Language.php) and extension messages (formerly in MessageCache.php). Profiling indicates a significant win for average throughput.
* The serialized message cache, which would have been redundant, has been removed. Similar performance characteristics can be achieved with $wgLocalisationCacheConf['manualRecache'] = true;
* Added a maintenance script rebuildLocalisationCache.php for offline rebuilding of the localisation cache.
* Extension i18n files can now contain any of the variables which can be set in Messages*.php. It is possible, and recommended, to use this feature instead of the hooks for special page aliases and magic words. 
* $wgExtensionAliasesFiles, LanguageGetMagic and LanguageGetSpecialPageAliases are retained for backwards compatibility. $wgMessageCache->addMessages() and related functions have been removed. wfLoadExtensionMessages() is a no-op and can continue to be called for b/c. 
* Introduced $wgCacheDirectory as a default location for the various local caches that have accumulated. Suggested $IP/cache as a good place for it in the default LocalSettings.php and created this directory with a deny-all .htaccess.
* Patched Exception.php to avoid using the message cache when an exception is thrown from within LocalisationCache, since this tends to fail horribly.
* Removed Language::getLocalisationArray(), Language::loadLocalisation(), Language::load()
* Fixed FileDependency::__sleep()
* In Cdb.php, fixed newlines in debug messages

In MessageCache::get(): 
* Replaced calls to $wgContLang capitalisation functions with plain PHP functions, reducing the typical case from 99us to 93us. Message cache keys are already documented as being restricted to ASCII.
* Implemented a more efficient way to filter out bogus language codes, reducing the "foo/en" case from 430us to 101us
* Optimised wfRunHooks() in the typical do-nothing case, from ~30us to ~3us. This reduced MessageCache::get() typical case time from 93us to 38us.
* Removed hook MessageNotInMwNs to save an extra 3us per cache hit. Reimplemented the only user (LocalisationUpdate) using the new hook LocalisationCacheRecache.
2009-06-28 07:11:43 +00:00
Tim Starling
79a7b5455e General fix for trailing whitespace in messages, so that we don't have to put bugfix hacks at hundreds of places in the code to preserve HTML entities in messages that are formally plain text. Based on discussion with Nikerabbit. 2009-06-04 07:26:46 +00:00
Alexandre Emsenhuber
f1199b072d * fix MessageCache::get()'s $isFullKey param: full key is "msg/lang" as in MediaWiki namespace, not "lang/msg"
* whitespaces tweaks
2009-05-16 20:12:29 +00:00
Tom Maaswinkel
c028124f8e Added a new hook to handle messages that aren't found in the Mediawiki Namespace (before checking the message files) 2009-05-14 21:38:45 +00:00
Chad Horohoe
0ea3a0c7da Add $this as a parameter to LoadAllMessages. 2009-05-07 18:49:57 +00:00
Emil Podlaszewski
f04ca60561 Added new hook 'MessageCacheReplace' into MessageCache.php. For instance
to allow extensions to update caches in similar way as MediaWiki invalidates
a cached MonoBook sidebar
2009-04-08 14:23:14 +00:00
Aaron Schulz
ed09ebcffb Tweak for bug 11852. Made handling of message cache key normalisation more consistent. 2009-02-17 15:36:15 +00:00