Commit graph

182 commits

Author SHA1 Message Date
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
umherirrender
6c38a5eb72 Fixed spacing in logging/parser/profiler/rl/revdel/search folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I11bbcfa351e945b7bde10c2105d61a3cf5622205
2013-04-20 17:38:24 +02:00
Brad Jorsch
5b17f233cd CoreParserFunctions::anchorencode should return a string
CoreParserFunctions::anchorencode incorrectly returns false rather than
the empty string when passed an empty string.

A simple cast fixes it; this likely wasn't noticed before since PHP was
automatically doing the cast anyway when the return value was merged
into wikitext.

Bug: 46608
Change-Id: I97556dbc4dcc1f102f6fed499d43dada388cdc5d
2013-03-27 17:08:24 +00:00
Alexandre Emsenhuber
15833dafdf Fix case of some Title methods
Change-Id: I1a37ffb0e8cde4deac027721b0e463585b58d634
2013-03-26 10:54:15 +01:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
umherirrender
d63121016d fix some spacing
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments

Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
2013-03-07 17:53:21 +01:00
jenkins-bot
3fca4cbe5d Merge "(bug 35753) Allow {{FORMATNUM}} to only do digit transform" 2013-02-26 08:40:00 +00:00
Pavel Selitskas
eadd393a81 (bug 35753) Allow {{FORMATNUM}} to only do digit transform
{{formatnum:1234567.89|NOSEP}} will perform only digit transformations.

Change-Id: Ic882d5ba087665030144e85248680acece8aa901
2013-02-26 08:30:16 +00:00
umherirrender
570dda0455 fix some spacing
Change-Id: I88e73d47a552918880514d88a876296a6cb80d88
2013-02-04 20:09:18 +00:00
Alexandre Emsenhuber
782ea7acae Use better variable name in CoreParserFunctions::pagesize()
Also moved the retrieval of the revision ID near the one of the
page ID so that the call of ParserOutput::addTemplate() is much
clearer than the actual one.

Change-Id: Ie71ee76e90cc131eac25c0f339d5250d5163ce2e
2013-01-22 02:06:25 +00:00
Pavel Selitskas
0ed9be373b (Bug 17970) {{PROTECTIONLEVEL}} should be able to return the status for pages besides the one it's on
Change-Id: I4c60a5f25c739583eb087024c5e949ebcd2def72
2013-01-18 22:03:01 +03:00
Catrope
cddcb353fb Merge "Reduced some master queries via Revision::READ_NORMAL." 2012-08-28 23:53:26 +00:00