Commit graph

187 commits

Author SHA1 Message Date
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/ /\ /g;s/—/―/g;s/•/•/g;s/á/á/g;s/´/´/g;s/à/à/g;s/α/α/g;s/ä/ä/g;s/ç/ç/g;s/©/©/g;s/↓/↓/g;s/°/°/g;s/é/é/g;s/ê/ê/g;s/ë/ë/g;s/è/è/g;s/€/€/g;s/↔//g;s/…/…/g;s/í/í/g;s/ì/ì/g;s/←/←/g;s/“/“/g;s/·/·/g;s/−/−/g;s/–/–/g;s/ó/ó/g;s/ô/ô/g;s/œ/œ/g;s/ò/ò/g;s/õ/õ/g;s/ö/ö/g;s/£/£/g;s/′/′/g;s/″/″/g;s/»/»/g;s/→/→/g;s/”/”/g;s/Σ/Σ/g;s/×/×/g;s/ú/ú/g;s/↑/↑/g;s/ü/ü/g;s/¥/¥/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
Tim Starling
ed529ce860 Added some profiling sections for expensive functions 2009-02-17 03:26:39 +00:00
Brion Vibber
76f9b0b973 Run parsemag stuff through the proper language when wfMsgExt() asks for a specific one.
Previously we only passed on if we were interface or content, but if we're rendering for some third alternative it didn't get used.
Note that parse and parseinline are probably still wrong.... some better model may be required here.
Also it may be wrong in the case of fallbacks ... if you get an English message, is it right to use the Czech magic word parsing?
Hmm.
Might back it out if there's a better way. :)
2008-11-13 01:02:17 +00:00
Tim Starling
5f2680289f Fixed regression from r35821: the status key is meant to prevent DB overload, not memcached overload. 2008-10-10 13:02:57 +00:00
Alexandre Emsenhuber
02c8f58aa3 * Display default extensions messages for language subpages when the page being edited doesn't exist
* Fix MessageCache::figureMessage() to allow slashes in message name
2008-10-07 18:10:08 +00:00
Tim Starling
350b498b9f * Revert back to my parser pseudo-branch again. Note: if you feel like reverting this, reverting Parser.php alone to r40010 will work just fine.
* Merged replaceFreeExternalLinks() with doMagicLinks(). Makes a lot of sense, very similar operations, doesn't break any parser tests. Stops free links from interacting with other parser stages, the same way ISBN links don't. 
* The pass order change fixes Brion's complaint in r39980. Early link expansion, triggered by having more than 1000 links in the page, was outputting URLs which were destroyed by RFEL. Added parser test.
* Fixed an unrelated bug in LinkHolderArray::replace(): if a link to a redirect appears in two separate RLH calls, the second and subsequent calls do not add the mw-redirect class. Caused by an unmigrated LinkCache fetch.
* Added a parser test for a pass interaction bug that the pass order change fixes.
* The fuzzer told me to tell you that free external links in non-caption image parameters, which are and have always been invisible, are now not registered either.
* Miscellaneous supporting updates to the test infrastructure.
2008-08-26 14:37:15 +00:00
Fran Rogers
3ad5bfb749 Fix for problems with r39414; LinkHolderArray::replaceInterwiki() was badly broken 2008-08-16 10:13:35 +00:00
Siebrand Mazeland
2dedbbdfa1 Revert r39414. Breaks processing links like [[:wikipedia:nl:User:Siebrand|Dutch language Wikipedia]]. It will add a comment like "<!--IWLINK 0-->" in the HTML output. Happens even if there is one such link on a page. 2008-08-16 09:33:11 +00:00
Tim Starling
c45292ac40 * In the parser: do link existence tests in batches of 1000. Avoids using excessive memory to store Title objects.
* Split link placeholder/replacement handling into a separate object, LinkHolderArray.
* Remove Title objects from LinkCache, they apparently weren't being used at all. Same unconstrained memory usage as the former $parser->mLinkHolders.
* Introduced ExplodeIterator -- a workalike for explode() which doesn't use a significant amount of memory
* Introduced StringUtils::explode() -- select whether to use the simulated or native explode() depending on how many items there are
* Migrated most instances of explode() in Parser.php to StringUtils::explode()
* Renamed some variables in Parser::doBlockLevels()
* In Parser.php: $fname => __METHOD__, Parser => self/__CLASS__, to support Parser_DiffTest more easily
* Doc update in includes/MessageCache.php for r39412
* MW_TITLECACHE_MAX => Title::CACHE_MAX, nicer name, easier to access from another module
2008-08-15 16:35:03 +00:00
Chad Horohoe
d3116f845d Should be the last of the 0777's :)
* Use wfMkdirParents() instead of mkdir() with a recursive argument. 
* Also, allow $wgDirectoryMode take over, instead of hardcoding 0777.
* +formatting
2008-08-08 14:24:05 +00:00
Alexandre Emsenhuber
a4cfa79ea8 * factorize common code
* allow to pass directly a Language object
2008-07-26 20:41:52 +00:00
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