Commit graph

193 commits

Author SHA1 Message Date
umherirrender
91f26d50ee Use Parser::SFH_NO_HASH/SFH_OBJECT_ARGS class const
Instead of the global const
Add hint to Defines, that they should not be used.

Change-Id: I3e1dcf46fe18a97a05e3406c209815adb7e0e083
2014-11-18 21:19:22 +01:00
jenkins-bot
cf93d76c03 Merge "Remove hitcounters and associated code" 2014-10-20 21:12:54 +00:00
Chad Horohoe
90d90dad6e Remove hitcounters and associated code
The hitcounter implementation in MediaWiki is flawed
and needs removal. For proper metrics, it is suggested to use
something like Piwik or Google Analytics.

RFC: https://www.mediawiki.org/wiki/Requests_for_comment/Removing_hit_counters_from_MediaWiki_core
Change-Id: I0e5006a7e8a09c800f8fa4effa9399e8afdd7a57
2014-10-20 13:01:55 -07:00
Kevin Israel
74cba12de3 CoreParserFunctions::displaytitle(): Use Parser::killMarkers()
... instead of doing something similar to an old version of it.

Change-Id: I78db194291236208843a13b80d322d403774796c
2014-10-20 15:59:51 +00:00
Jackmcbarn
edc9f2acd9 Add parser callback to get a page's current revision
Add Parser::fetchCurrentRevisionOfTitle(). By default, this just calls
Revision::newFromTitle, but a callback can be set in ParserOptions that
will override it. Anything that runs as part of a parse should use this
wherever possible.

Bug: 70495
Change-Id: I521f1f68ad819cf0f37e63240806f10c1cceef9c
2014-09-19 11:59:58 -04:00
Aaron Schulz
1e78807f0d Tweaked cache size in getCachedRevisionObject()
Change-Id: I3b01011f21bf3218f3b5c74430b5d5f9ceaec83e
2014-09-03 23:23:43 +00:00
Aaron Schulz
b728d6920b Made getCachedRevisionObject() use MapCacheLRU
* Previously the cache size was unbounded and leaky
* Also made MapCacheLRU handle null values properly

Change-Id: Ia02258cf051e1ccf11457c758741b8c7922afe89
2014-08-22 18:12:29 +00:00
addshore
61c989cfc0 Fix phpcs issues in parser
This fixes all issues except for:
 - class names
 - line length

Change-Id: Ie91b010d5b3eec49d3b80b6e93b125a901ef43c6
2014-08-12 01:00:15 +00:00
Niklas Laxström
457d732dbf Fix bad reference in method doc
Change-Id: Ic721a869cc25792f2fb3a66803efe48d36c4939c
2014-08-04 11:43:03 +02:00
Jackmcbarn
af66fecb2d Warn when DISPLAYTITLE is used more than once
Implement the same duplicate-warning logic for DISPLAYTITLE that
DEFAULTSORT currently uses, to catch cases where a newer call overrides an
older one.

Bug: 50449
Change-Id: Ibce776d019aab07fb88fbb89afc5340300735405
2014-07-08 23:34:50 -04:00
C. Scott Ananian
fb125de072 Allow HTML5 <rtc> tag (ruby support for East Asian typography).
We currently allow <ruby>, <rt>, <rb>, and <rp> but not the W3C HTML5
<rtc> element.  Fix that.

(Note that <rb> and <rtc> are new additions to HTML5 which currently
appear in the W3C but not the WHATWG version of the HTML5 spec.
Support for these has already been merged in gecko and webkit and
the editor plans to update the WHATWG spec.)

Bug: 67042
Change-Id: I8c0e65d782b6d23057a9723b87323b28e8bf8852
2014-07-02 18:45:14 -04:00
umherirrender
4634b57243 Replace deprecated Title::escapeCanonicalURL call
Change-Id: Icd3e2304d6188babe2d887aa32fc0c398352b7b6
2014-06-27 17:12:37 +02:00
Siebrand Mazeland
dfc7416fbe Various documentation updates for includes/parser/
Change-Id: I16dd3a792cc83f8c80b3652d42c055730f6d177a
2014-05-11 18:18:26 +02:00
Siebrand Mazeland
2527cca6de Fix most CodeSniffer issues in includes/parser/
Remaining are the classes containing underscores and possibly a few other
issues that will be addressed soonish.

Change-Id: Icf56374c71afc134420ebbcfecf12dcb29dc9564
2014-05-11 08:44:52 +00:00
umherirrender
7f9fd63901 Fixed some @params documentation (includes/parser)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I49f8f48b521878de7abd9cc40efdeff6cf9a37e0
2014-04-22 01:38:39 +02:00
Thiemo Mättig
2aa67db39d Fix "@param null $param" documentations
... and very few other documentation details that are closely connected
to these mistakes.

Change-Id: I5b2691948e196124c77f0cc04d0ed5a7167cac25
2014-04-09 12:33:55 +02:00
umherirrender
23fab68274 Fix spacing after @param and friends in comments
Searched for:
\@(param|return|throws|since|deprecated|access|todo|var)[ \t]{2,}

Change-Id: Icce22ba9fe0635455691ca58d9872d618151f346
2014-04-05 20:02:29 +00:00
umherirrender
2000672ac3 Fixed spacing
- Added spaces after if/foreach/catch
- Added new line before end of file
- Added or removed spaces before/after parenthesis, comma
- Added spaces around string concat

Change-Id: I0590070f1b3542108e242730e8d9a3ba9831e94f
2014-03-20 20:37:30 +00:00
tonythomas01
2f8772135b Check for CoreParserFunction::urlFunction from array to boolean
and return values accordingly to htmlspecialchars()

PHP Warning: htmlspecialchars() expects parameter 1 to be string,
array given in CoreParserFunctions.php on line 212
Checked for the return value of urlFunction in localurle() and fullurle()
function

Bug: 59881
Change-Id: I7ae092f89b9cfbbe91d1883c2182ca5907825ba4
2014-01-30 23:43:38 +05:30
umherirrender
c0d3e85b06 Add Title::hasFragment and use it
Makes checks against the fragment easier to read and all the same.
At the moment some using strval, some use type safe comparsion.

Change-Id: I27d9c3e40e6de6800f4488de167cf06e83c88ce6
2014-01-24 15:42:13 +00:00
umherirrender
d810be838d Remove outdated fixme/todo in CoreParserFunctions.php
Title::getLength is not used and documentation of parameter is there

Change-Id: I50679ff19695a3afedd556e242f27e4172a9774a
2014-01-19 11:13:44 +01:00
Jackmcbarn
b2e20f5d57 Don't always count CASCADINGSOURCES as expensive
When a page's cascading protection sources have already been loaded, don't
count CASCADINGSOURCES as expensive.

Change-Id: Ia9d25790c534414f637f85d6a3fc4f2c1c0de790
2014-01-15 16:13:13 -05:00
jenkins-bot
7c5acbe3f7 Merge "Make PROTECTIONLEVEL count as expensive" 2014-01-15 16:28:11 +00:00
Brad Jorsch
6131a214aa pageid parser function is expensive, make it so
The pageid parser function (not to be confused with the pageid magic
word) hits the database for every title passed, which meets the criteria
for being considered an expensive parser function.

To mitigate this new expensiveness, check for special namespaces,
interwiki titles, and titles in LinkCache before hitting the DB.

Also, record potentially-valid titles in pagelinks so that the page can
be properly purged if the target is created/deleted.

Change-Id: I4fbfc265543f0a64c14dc8a44e1c89cd928a1adb
2014-01-14 15:44:08 -05:00
Jackmcbarn
a87e109e67 Make PROTECTIONLEVEL count as expensive
When protection levels for a page have not previously loaded, make calls
to PROTECTIONLEVEL for that page count as expensive. Also, add new
accessors for the protection information.

Change-Id: Ic088a9f482154d5353ccf580bbe5c359371a8cdd
2014-01-13 15:01:17 -05:00
umherirrender
cf5cb9b79a Raw option of parser functions should match complete word
The MagicWord raw was not matched against the whole given string, which
result in a raw output, when this was not intented.
Fixing this by adding a new regex, which matches the string from start
to end.

Bug: 56199
Change-Id: I7781c415bd61447dd91872575877dd21f36fae9f
2014-01-12 22:25:33 +00:00
Jackmcbarn
d0610c0370 Include namespaces in {{CASCADINGSOURCES}} output
Include the namespace of pages in the output of the CASCADINGSOURCES
parser function.

Change-Id: Ie39ecfb52965c36349e601bee092590a147b5a03
2014-01-06 16:53:43 -05:00
Jackmcbarn
073c4bf16f Add CASCADINGSOURCES parser function
Add {{CASCADINGSOURCES}}, which gives a list of cascading-protected pages
that cause a given page to be protected. This is an expensive parser
function.

Change-Id: I0e9556d53d9a78bc02848c775cb667294726cea1
2014-01-04 12:08:45 -05:00
Siebrand Mazeland
c9f5a5006f Replace usage of deprecated Title::escapeLocalURL()
Change-Id: I1d630ffe5e900a97e169bf3fdab55d0687a67d3b
2013-12-29 16:22:05 +01:00
Skizzerz
e035a14604 Fix error introduced in Change Ieae80c63e391cfb1af61841a6badd51b87d00cfe
The {{NAMESPACE}} magic word is broken by the above commit, since it uses
the function name "mwnamespace" in order to not conflict with the PHP 5.3
namespace keyword.

Change-Id: I807c9b89c101db289c0ec47593c18b0d1dc2260b
2013-12-27 17:55:31 -06:00
Chad Horohoe
0d7de23b3b Break some long lines
Change-Id: I8c3919c04a3fc468191750af51b8be3f952f464e
2013-12-27 16:01:17 -05:00
Chad Horohoe
8ca3b9dc0d Reduce insane amount of code duplication and long lines
Change-Id: Ieae80c63e391cfb1af61841a6badd51b87d00cfe
2013-12-27 15:57:50 -05:00
Siebrand Mazeland
8d0106d585 Remove last remainig use in core of Title::escapeFullURL()
This was deprecated in MediaWiki 1.19.

Change-Id: I21a46a35e449b81d5999420add91d7664fcf5f1d
2013-12-27 15:01:26 +01:00
umherirrender
2b980a226f The static declaration must come after the visibility declartion
Change-Id: I7f4646a5eb3acc7209b243c82a5a496daf82cf8f
2013-11-23 14:42:32 +01:00
umherirrender
1523621054 Add expensive parser functions {{REVISION*:}}
The magic words REVISIONID, REVISIONUSER and REVISIONTIMESTAMP (with
friends) now exists as parser function to fetch revision information
from another page specified as param to the parser function.

Invalid title or non-existing title will return an empty string.
Requesting revision deleted information will always return an empty
string, because this is for public audience and goes into the parser
cache.

The parser function will register a template link to get updated with
refresh jobs on edit of the remote page. This is the same way, than
the parser function pagesize is working.

When the given param is equal to the current title of the parser, the
parser function will yield the previous versions on preview and on
substitution, that includes empty strings when used on page creation,
but using the values from the current version for page view, including
viewing old revisions.

Bug: 6092
Change-Id: Ib15a4e54c65192ec3caef71fd5dcb93fb6fc444e
2013-10-29 22:02:59 +01:00
Tim Starling
d1bc243f65 Remove all instances of the word "iff"
It's elitist mathematical jargon. In all cases dealt with here, it adds
no additional meaning compared to "if", beyond what was already obvious
from context. Thus, its only purpose is to smugly demonstrate that the
author attended their second-year mathematics classes, at the expense of
causing confusion for everyone who doesn't have such a background.

If you really think you need to convey extra information beyond what
"if" gives you, the English language contains plenty of devices for doing
so, without resorting to neologisms.

Change-Id: Iae21095d02ec2935c10e94f532235c2671c115b1
2013-10-23 10:56:54 -07:00
umherirrender
35065c9db5 Added {{REVISIONSIZE}} variable to get the current size of a revision.
This avoids giving the own page name to {{PAGESIZE:}} and allows
PAGESIZE on subst: to give the size before save.

Viewing a oldid page will give the corresponding size to that revision.
(Like REVISIONUSER or REVISIONTIMESTAMP)

This partially reverts Idfac13de37d05317f65e4131534543e66cf74873
because there is no need to let PAGESIZE handle extra, when the given
title is the own page.

Change-Id: If9e608d54904c21ac6b095e91ff6e0a15da0fb4c
2013-09-21 03:49:35 +01:00
jenkins-bot
59404fb12e Merge "Call $wgContLang->findVariantLink() in {{PAGESINCATEGORY: }}" 2013-09-05 07:41:39 +00:00
Liangent
970cc1e8e6 Call $wgContLang->findVariantLink() in {{PAGESINCATEGORY: }}
Corrects inconsistent return value for number of pages in a
category when language variants are in use.

Change-Id: I27668ba348c45bc34b264f8771e91e58a9920552
2013-09-05 07:35:23 +00:00
Liangent
0e57adabc3 Disable language conversion for echoed sortkeys in defaultsort errors.
Change-Id: I24ac06687df126b59a3eddeb4ed00b2ca0ee22e9
2013-07-04 20:25:06 +00:00
jenkins-bot
67a63d8de7 Merge "Parse duplicate-defaultsort error message" 2013-07-04 18:56:10 +00:00
Alex Monk
f7e1570030 Parse duplicate-defaultsort error message
Bug: 49611
Change-Id: I2fd6c74597ba423378c3f08e76248c2b241098dd
2013-07-01 15:57:25 +01:00
MatmaRex
d1b64093ef displaytitle: Pass-by-reference fix for PHP 5.4
PHP 5.4 includes some pass-by-reference changes which apparently make
the '&' sigil necessary here.

Spotted by Mormegil <mormegil@centrum.cz>. Followup to Ie162535b.

Change-Id: I038fa7f8e1559c95dba7b9b498fc1d1f5eb76887
2013-06-21 00:18:36 +02:00
umherirrender
efcf646a03 Do not output numberofviews, if $wgDisableCounters = true
Follow up I9975dceedeffafadf560ed71238c51b94eb8c3ad
But now for the parser function

Change-Id: I18261b884b7f3be57a42c0b10594384fab6f9c9a
2013-06-17 21:09:06 +02:00
Mormegil
7fadd2c9f3 (bug 47449) {{#special:}} should always return a usable title
{{#special:}} should always return a usable title in NS_SPECIAL,
even when given an unknown special page title. Currently, it returns
"No such special page" text for such unknown names, which is
surprising.

Bug: 47449
Change-Id: I7f184956ec9d56c849f201f1230736fcedd0fadf
2013-06-14 06:33:08 +00:00
MatmaRex
267b582e16 displaytitle: reject some CSS if $wgRestrictDisplayTitle set
$wgRestrictDisplayTitle is intended to make it possible to simply
copy-and-paste the title text even if it requires some styling like
subscript or superscript. Using a <span style="display: none;" />
broke that expectation, as the text hidden in such way becomes
completely invisible and unselectable. This patch rejects such styles.

Also disallowed 'user-select' and 'visibility', since they both
prevent the user from selecting and/or copying the text as well.

Minor changes in Sanitizer:
* checkCss() was made to pass through values which consist of nothing
  but a single comment, to allow this rejection to display some sort
  of a notification to the user.
* encodeTagAttributes() was added as a counterpart to
  decodeTagAttributes(), pulling some code out of fixTagAttributes().

Bug: 26547
Change-Id: Ie162535b6bcbebce4ee69f6dcc1957ccccc3c672
2013-05-24 15:05:37 +02:00
umherirrender
c6894adefc Fixed spacing
Added spaces around some parenthesis

Change-Id: If1e50e2a7b0046e91c0bbce8bf6641d8b2446a1d
2013-05-09 19:48:10 +02:00
Brian Wolff
2d542d3fd5 {{PAGESIZE:{{FULLPAGENAME}}}}, {{{{FULLPAGENAME}}}} not outdated
Previously, when parsing {{PAGESIZE:{{FULLPAGENAME}}}} or
{{ {{FULLPAGENAME}} }} (a self-transclusion), we used the
version currently in the db, which is outdated because
the moment we save the page there will be a new version.

This often causes confusion when testing templates that
often have examples of template use in the doc section
which would be one version out of date.

This change causes those variables to give results for
the most recent version of the page. For self-templates
that's done by reparsing the page after save. For
self page sizes this is done by taking the size
of the input to Parser::parse.

Note that {{subst:PAGESIZE:{{subst:FULLPAGENAME}}}}
will still yield previous revision like before.

bug: 39590
Change-Id: Idfac13de37d05317f65e4131534543e66cf74873
2013-04-27 20:45:32 -03:00
umherirrender
9f14ecf829 Added space after switch/Removed spaces after unset
While at it, added/removed some other spaces in the same files

Change-Id: I84d8001aa123a008807ad5eb76f396aed7c899a4
2013-04-26 16:42:31 +02:00
blotmandroid
d197fbd349 Introducing a new variable {{ROOTPAGENAME}}
Introduced a new variable ROOTPAGENAME which has similar
content like BASEPAGENAME.
ROOTPAGENAME only contains the name of the topmost page without namespace, e.g.
for "User:Name/Article/Subarticle" it should be "Name".
BASEPAGENAME would be "Name/Article" here.

Update : fixed indentation in maintenance/fuzz-tester.php

Added to RELEASE-NOTES-1.2.2

Bug: 6747
Change-Id: I71ef0a15c95c9145462f3aa7fdb3ed11dac79265
2013-04-24 02:13:25 +05:30