Commit graph

155 commits

Author SHA1 Message Date
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
Aryeh Gregor
258740c2df Revert last commit for a moment, committed lots of stuff I didn't mean to. 2008-07-23 19:27:13 +00:00
Aryeh Gregor
0e7fa5b28b Follow-up to r37968: forgot to commit the change setRobotpolicy -> setRobotPolicy in extensions. 2008-07-23 19:25:48 +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
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
Brion Vibber
3725c751a0 * (6943) Added PAGESINCATEGORY: magic word
Patch by Mr.Z-man, https://bugzilla.wikimedia.org/attachment.cgi?id=4793
Moves some of the 'expensive parser function' tracking to core.
2008-04-07 22:11:31 +00:00
Alexandre Emsenhuber
539581f873 Link to docs/magicword.txt 2008-03-12 17:37:03 +00:00
Tim Starling
269a91037b * Added __HIDDENCAT__ feature, to hide categories from the box at the bottom of the member pages depending on special text on the category page.
* Added page_props backend, generic parser-driven page properties which, when changed, invalidate the cache of backlinked pages on any links table. Could be used to add overlays to images depending on their deletion status, or to add icons to articles based on category membership. 
* Refactored double-underscore handling in the parser. 
* Moved CoreParserFunctions registration to CoreParserFunctions.
2008-02-20 08:53:12 +00:00
Brion Vibber
cf9cd9dad3 Reverting r30413 for now.
'parentpagename' seems to duplicate 'basepagename'; why?
2008-02-04 19:53:21 +00:00
Misza13
b002ea6e2c Adding {{ROOTPAGENAME}} (and {{ROOTPAGENAMEE}}) variables for accessing the page's root name (i.e. everything up to the first "/").
Also adding {{PARENTPAGENAME}} as an alias for {{BASEPAGENAME}}.
2008-02-02 00:56:41 +00:00
Victor Vasiliev
df51a7691c Add profiling to MagicWord.php
30000 GET!
2008-01-20 18:46:50 +00:00
Domas Mituzas
74ea08c85b set OutputPage::mContainsOldMagic only for specific listed magic words
For now the suggested times are ignored and base 3600 is used for all dynamic ones
This makes templates more friendly parser-cache wise.
2008-01-09 20:47:46 +00:00
Nick Jenkins
786e93fb37 Static code analysis housekeeping time... things that could be double-checked are marked with "[Note: some-comment]" :
if-if-else without curly braces [api/ApiQuerySiteinfo.php] --> adding
Unused global declaration:  $wgGroupPermissions --> removing 
Unused global declaration:  $wgEmailConfirmToEdit (line 301) --> removing 
Variable $id appears only once (line 1021)  --> removing 
Variable $m was used before it was defined (line 805) --> defining.
Variable $retval was used before it was defined (line 2346) --> renaming to $result
Variable $rcid appears only once (line 244 of RecentChange.php)  --> using this instead of $change [Note: was left over from r24607 refactoring, revert if wrong please]
Unused global declaration:  $wgCommandLineMode (line 11) --> removing
Variable $k appears only once (line 132 of ImagePage.php) --> removing.
Variable $info appears only once (line 311 of ImagePage.php)  --> removing.
Unused global declaration:  $wgTitle (line 569 of ImagePage.php) -> removing.
Variable $handlerParams was used before it was defined (line 616 of Linker.php) --> resolved by Raymond in r24966
Variable $match was used before it was defined (line 1031 of Linker.php) --> defining.
Unused global declaration:  $wgEnotifWatchlist (line 253 of UserMailer.php) --> removing 
Unused global declaration:  $wgShowUpdatedMarker (line 253 of UserMailer.php) --> removing 
Variable $img appears only once (line 446 of SpecialUpload.php) --> added definition, defined as null, flagged with @todo  [Note: should $img be defined in this context, or is it intended to be null? And should the return value after the hook be checked in some way?]
Unused global declaration:  $wgEnableAPI (line 739 of SpecialUpload.php) --> removing.
Unused global declaration:  $wgNamespaceProtection (line 1030 of OutputPage.php) --> removing.
Unused global declaration:  $wgContLang (line 18 of SpecialWatchlist.php) --> removing.
Unused global declaration:  $wgRawHtml (line 269 of SpecialMovepage.php) --> removing.
The value of variable $page was never used (line 331 of SpecialUndelete.php) --> removing line, as $page gets redefined a few lines down.
Variable $synIndex appears only once (line 521 of MagicWord.php) --> commenting out.
Variable $case appears only once (line 539 of MagicWord.php) --> removing from foreach index key usage.
Variable $wgUser appears only once (line 1039 of Title.php) --> adding line to declare as a global, would be null otherwise.
Variable $m was used before it was defined (line 285 of Title.php) --> defining.
Variable $id appears only once (line 1150 of Title.php) --> removing from foreach index key usage.
Variable $subpage appears only once (line 1297 of Title.php) --> commenting out.
Variable $restrictions appears only once (line 1399 of Title.php) --> commenting out.
Variable $mime appears only once (line 210 of filerepo/OldLocalFile.php) --> removing.
Variable $deprefixedName appears only once (line 213 of filerepo/LocalFile.php) --> removing.
Variable $m appears only once (line 541 of filerepo/LocalFile.php) --> removing.
Variable $where appears only once (line 1245 of filerepo/LocalFile.php) --> removing.
Variable $info appears only once (line 1427 of filerepo/LocalFile.php) --> removing.
Variable $rel appears only once (line 138 of filerepo/RepoGroup.php) --> commenting out.
Variable $zone appears only once (line 138 of filerepo/RepoGroup.php) --> commenting out.
Variable $nbytes appears only once (line 208 of media/Generic.php) --> added a return line that uses $nbytes. [Note: I'm assuming that this was the intent]
Variable $offset appears only once (line 201 of SpecialListusers.php) --> removing.
Variable $limit appears only once (line 201 of SpecialListusers.php) --> removing.
Variable $groupTarget appears only once (line 203 of SpecialListusers.php) --> removing.
Unused global declaration:  $wgLang (line 74 of SpecialWantedpages.php) --> removing.
Variable $block appears only once (line 244 of SpecialProtectedpages.php) --> removing.
Variable $offset appears only once (line 281 of SpecialProtectedpages.php) --> removing.
Variable $limit appears only once (line 281 of SpecialProtectedpages.php) --> removing.
Unused global declaration:  $wgLang (line 30 of FileDeleteForm.php) --> removing.
Unused global declaration:  $wgServer (line 30 of FileDeleteForm.php) --> removing.
2007-08-21 03:57:54 +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
Rob Church
153487bc6b (bug 6965) Cannot include "Template:R" with {{R}} (magic word conflict) 2007-07-10 14:57:00 +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
Brion Vibber
5dd20241ab Reverting r21560 as discussed; there are severe problems with relying on a user-language variable, which is why it has not been added. 2007-04-27 15:12:22 +00:00