Commit graph

171 commits

Author SHA1 Message Date
Sam Reed
78f05f39e1 Partial revert to r101244 due to next() weirdness 2011-11-05 14:10:50 +00:00
Sam Reed
2f23e71490 arrray -> array
Whitespace

Other documentation improvements

Comment out some unused code (which has a fixme left with it already)
2011-11-01 23:48:09 +00:00
Sam Reed
c8e89896f7 Remove more assignments in conditionals (while each to foreach) 2011-10-29 02:04:27 +00:00
Sam Reed
ad39f2da86 Trim trailing whitespace
Add/tweak/update documentation

Simplify some boolean returns
2011-09-04 21:40:17 +00:00
Tim Starling
67099169ad * Use Preprocessor_Hash by default in compiled mode, it is faster
* Don't profile MagicWord::get(), it is very fast and the profiling overhead was excessive. Profile MagicWord::load() instead.
2011-05-31 06:10:23 +00:00
Sam Reed
ebef5e723b More documentation tweaks/additions 2011-05-26 19:52:56 +00:00
Sam Reed
8d1f5525e3 Lots more documentation lines to MagicWord 2011-05-21 19:55:05 +00:00
Leo Koppelkamm
a4296effc7 Add |alt= option for galleries ( Bug 18682 ). Recommit of r86749, with nested |alt= now fixed. Patch by Jan Paul Posma 2011-04-25 13:51:54 +00:00
Chad Horohoe
783d4e0862 Remove @static from all over the place. That's what the static keyword is for, this being PHP5 and all 2011-04-21 00:07:09 +00:00
Alexandre Emsenhuber
e364a689bc Moved constant initialisation to class definition instead of constructor 2011-04-01 09:35:39 +00:00
Alexandre Emsenhuber
4d8e5e0ec9 Changes default value so that it's not converted to array( 0 => '' ) by the (array) cast a few lines below.
This was breaking the check whether the magic word was found by Language::getMagic() or not.
2011-03-25 11:07:59 +00:00
Tim Starling
3bc410efa7 * Fix for r81960: List the local magic word synonyms first, so that they will be returned by $magic->getSynonym( 0 ). Apply array_values() to fix up the keys, potentially corrupted by array_unique().
* In MagicWord::initRegex(), put the longest synonyms first in the alternation. This means that when one synonym is an initial substring of another, the longest one will match in precedence, which is generally in line with user expectations.
2011-02-16 07:24:36 +00:00
Sam Reed
da3b3fbae4 More return type documentation 2011-02-08 23:18:13 +00:00
Sam Reed
e76775e06f More unused variables 2010-11-30 18:44:50 +00:00
Sam Reed
8a01281913 Remove some unreachable code (usually returns after throwing exceptions)
Fixup call of method after return in DatabaseMssql by using a temp
2010-08-24 22:03:18 +00:00
Alexandre Emsenhuber
5be509b0c1 * Standardised file description headers
* Added some descriptions
* Added @file where needed
2010-08-08 14:23:14 +00:00
Sam Reed
5582aca1ed * (bug 23848) Add {{ARTICLEPATH}} Magic Word
Apply my patch, as it seems to be working when I tried it this time
2010-08-05 15:21:15 +00:00
Sam Reed
04f68827d0 Removal of unused globals
Removal of one setting of a variable to '', then not using further
2010-07-24 19:11:52 +00:00
Matěj Grabovský
449b936efd (bug 23426) The {{REVISIONMONTH}} variable is now zero-padded and added new variable {{REVISIONMONTH1}} when unpadded version is needed. 2010-05-11 16:24:14 +00:00
Tim Starling
c166e49bca Fixes for r62505:
* In MagicWordArray::matchStartAndRemove(), fixed the case where the length of localised synonym is not precisely the length of the magic word ID plus one
* Fixed the case where matchStartAndRemove() removes the entire string, send empty string not false
* Fix brace style
2010-02-22 07:02:12 +00:00
Tim Starling
f5b882aadc Moving Conrad's recent parser work out to a branch. Reverted r62434, r62416, r62150, r62111, r62085, r62081, r62080, r62077, r62076, r62069, r62049, r62035. 2010-02-19 05:19:32 +00:00
Conrad Irwin
8b23dcc084 clean r61713 (and r61710) per code review 2010-02-15 09:34:51 +00:00
Conrad Irwin
7a1fc37382 partial revert for r62081. Make {{PIPETRICK}} like {{PAGENAME}}, add {{PIPETRICKE}}. fix r62077 better. 2010-02-08 02:07:15 +00:00
Conrad Irwin
7dee03cbdf Fix for r61710. Changing subst: to subst:$1 would cause huge problems with localisation
instead add some proper functions to MagicWord.php to deal with the situation.
2010-01-30 12:46:16 +00:00
Conrad Irwin
13eb1fe98e bug 22297 - "syntax for substitution that doesn't break transclusion"
Adds "safesubst:$1" that works similarly to "subst:$1"
(relevant to bug 5453, bug 16714, bug 4484)
2010-01-30 11:58:19 +00:00
Sam Reed
14919d7760 Reversion/followup to r59300 as per Tims comment 2010-01-12 07:24:25 +00:00
Mark A. Hershberger
c568220e61 Refactor LanguageConversion so that title conversion isn't so flimsy. Pull MagicWord detection into Parser->doDoubleUnderscore() && remove ParserConvert. 2010-01-07 04:13:14 +00:00
Chad Horohoe
a4e5e935b6 Mass convert NULL -> null. Left strings and comments alone, obviously. 2009-12-11 21:07:27 +00:00
Sam Reed
27160794d0 bug 21583 MagicWord::match function documentation is wrong
+Similar change to matchStart
2009-11-20 22:28:37 +00:00
Roan Kattouw
62de3d1478 Add a {{STYLEPATH}} magic word; necessary for upcoming EditToolbar fix 2009-09-26 11:51:37 +00:00
Alexandre Emsenhuber
4de1c6751d Added parser test for r55601, has to clear MagicWord's object caching so that parser function aliases are also available when using a different language that English 2009-08-26 16:57:53 +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
6cc78e5d4b Revert r51200, r51253, r51254, addition of {{NUMBEROFCONTRIBS:...}} parser function. See CodeReview r51200. Not very well implemented and probably a bad idea anyway. 2009-06-06 02:49:32 +00:00
X!
784dc5cc9a (bug 19012) Added {{NUMBEROFCONTRIBS}} variable 2009-05-30 17:27:16 +00:00
Shinjiman
21c11b8f40 * (bug 5755) Introduce {{CURRENTMONTH1}} and {{LOCALMONTH1}} to display the month number without the leading zero
* added {{CURRENTMONTH2}} and {{LOCALMONTH2}} as alias of {{CURRENTMONTH}} and {{LOCALMONTH}} for consistency with other magic words
2009-05-20 07:14:03 +00:00
Alexandre Emsenhuber
9c8e5796c8 Cleanup in MagicWord::$mVariableIDs, removed IDs that aren't handled in Parser::getVariableValue().
Side effect: Removed "Pages in namespace (Magic word disabled currently)" parser test added in r17687 by nickj (was passing; I know). The problem is that the expected result is an empty string, but since it's disabled by default with $wgAllowSlowParserFunctions = false (i.e. not added to parser's list of magic words IDs) it should return a red link to [[Template:PAGESINNAMESPACE:]] (the empty string is produced because "{{PAGESINNAMESPACE:}}" is handled as variable and not as parser function).
2009-05-03 12:38:13 +00:00
Nathaniel Herman
df7ba5f52c (bug 10336) Added new magic word {{REVISIONUSER}}, which displays the user name of the last user to edit the page 2009-03-07 23:01:59 +00:00
Brion Vibber
92079d3b1c * (bug 16335) __NONEWSECTIONLINK__ magic word to suppress new section link.
Patch by Carlin: https://bugzilla.wikimedia.org/attachment.cgi?id=5680
With slight whitespace tweaks.
2009-02-19 22:14:59 +00:00
Aaron Schulz
7a5ca259be Rename new ACTIVEUSERS word to NUMBEROFACTIVEUSERS 2009-02-17 23:05:04 +00:00
Andrew Garrett
802c88e188 Add ACTIVEUSERS magic-word, complement to NUMBEROFUSERS. 2009-02-04 22:16:35 +00:00
Brion Vibber
5eb0d9dfef Roll back r46196, 46202 for now "__IGNOREUNUSED__ excludes cats from UnusedCategories (bug 17145)"
The name is very unclear; would prefer to nail that down before rolling it out.
2009-01-27 22:54:01 +00:00
Aryeh Gregor
9ee6ef5cc5 __IGNOREUNUSED__ excludes cats from UnusedCategories
An extra left join and filter condition added to the query.  Should
cause no significant performance issues.  Patch by Ahmad Sherif (bug
17145).
2009-01-25 12:43:55 +00:00
Alex Z
8ce41bf5f5 rm protectionlevel from mVariableIDs per iAlex on codereview 2009-01-09 18:28:55 +00:00
Alex Z
a445dd5e11 (bug 9947) Add PROTECTIONLEVEL parser function to return the protection level for a given action (e.g. edit, move) for the current page. 2009-01-08 23:21:06 +00:00
Nicolas Dumazet
6198592553 (bug 13701) {{NUMBEROFVIEWS}} magic word to show number of total views. 2008-10-19 04:11:02 +00:00
Tim Starling
c50668c0e8 Reverted r41655. Causes a text load on parser cache hit. Reduces parser cache hit performance especially for ES clusters. Messages not reverted on the assumption that this revert is temporary. 2008-10-12 13:28:04 +00:00
X!
6429096574 Implement a configurable per-namespace and per-page header, similar to the editnotice.
*MediaWiki:Pageheader-# for whole namespace
 *MediaWiki:Pagenumber-#-PAGENAME for one page.
 *Can be disabled using __NOHEADER__
2008-10-04 15:27:39 +00:00
Roan Kattouw
406dbbb47e (bug 13471) Added NUMBERINGROUP magic word. Patch by Soxred93 2008-08-28 00:04:57 +00:00
Tim Starling
a9415c3278 Magic word __STATICREDIRECT__ to suppress the redirect fixer. For periodically-archived pages like [[WP:GO]]. 2008-07-27 21:49:58 +00:00
Aryeh Gregor
9bf022910a (bug 8068) New __INDEX__ and __NOINDEX__ magic words allow control of search engine indexing on a per-article basis. Remarks:
* Currently __INDEX__ will override __NOINDEX__ regardless of their relative positions, due to the way things are written.  Instead, the last one on the page should win.  This should be pretty easy to fix.
* __INDEX__ and __NOINDEX__ override $wgArticleRobotPolicies.  This is almost certainly incorrect, but it's not totally obvious how to fix it, because of the way the code is structured.  Probably not a big deal, but should probably be fixed at some point.
* Anyone can add and remove the magic words, and there's no config option to disable them.  It's not obvious whether this is okay or not.  It would be a one-line change to OutputPage.php to have a config option to ignore the magic words, maybe per-namespace or who knows what.
2008-07-23 19:49:46 +00:00