Commit graph

113 commits

Author SHA1 Message Date
Amir E. Aharoni
bd30ccd795 Make lines shorter to pass phpcs in some files under includes/parser
This doesn't fix all the files under includes/parser -
some of them deserve their own patches.

Bug: T102614
Change-Id: I2fcbc19ee337e1b7db4635b5e5f324c651b4d144
2015-09-26 18:19:11 +00:00
daniel
a86ad78b55 ParserOptions: added comment regarding editsections usage.
// @note: as of Feb 2015, core never sets the editsection flag, since it uses
// <mw:editsection> tags to inject editsections on the fly. However, extensions
// may be using it by calling ParserOption::optionUsed resp. ParserOutput::registerOption
// directly. At least Wikibase does at this point in time.

Change-Id: Ief95ecb3ae1f5699b788dd3dad0eaf1aa6cc163c
2015-09-03 11:58:27 +00:00
daniel
053e968f3c Add comments clarifying how calling getters on ParserOutput affects the parser cache.
Change-Id: Ie6a4a8989df218f88cfc7c1cf1d4b68cf871abbb
2015-08-28 07:59:33 +00:00
Brad Jorsch
877c3db396 Make ParserOptions fields private
Now that Ib58e8020 and Ie644854 are merged, there are no direct accesses
to these fields left in core or extensions in Gerrit. So let's make them
private to make sure no more get added before we decide whether we're
going to eliminate them entirely.

Bug: T110269
Change-Id: I82041b88dd0f194716f54d3207649388328805ca
2015-08-27 23:20:45 +00:00
aude
37e30d27a3 Add comments for ParserOptions::getUserLang regarding cache split
Add details in comments for ParserOptions::getUserLang, more
explicitly warning about cache fragmentation and mention that
in some cases (e.g. multilingual wiki) this might be desired.

Change-Id: I3fe0799ade488eca32d8c89150179710309650c3
2015-08-21 10:46:26 +02:00
Timo Tijhof
d06855ecbe Parser: Say tildes instead of ~~~ in comment to fix Doxygen fatal
Doxygen was unable to parse the file past validateSig().

> Parser.php:6397: warning: reached end of file while inside a ~~~ block!
> The command that should end the block seems to be missing!

Change-Id: I3d1b547968302611d2bd78a7c11dd0738b40d23a
2015-04-06 12:32:25 +00:00
Max Semenik
08762b02de Minor cleanups
* Declare undeclared variables
* Kill unused variables
* Fix comments including PHPDoc

Change-Id: I60015f6b6740aa9088bda3745f4dc4e65e29fcb1
2015-04-02 16:22:42 +00:00
Arlo Breault
78c3f2f4b1 Tidy up tidy usage
* There's a branch path in the sanitizer that depends on $wgUseTidy,
   which means the test output differs from on wiki.

 * In general, we should set these variables to match the wiki behaviour
   in tests.

 * Exposes T92892, Sanitizer removes empty tags when tidy is disabled.

 * Tweaked tests for T19663 to use an extension tag to show that
   HTML5 tags with non-word characters make it through the parser
   intact (before being ultimately sanitized).

Change-Id: I09c72fd739e11a8b757f37dc4c790758d782ad73
2015-03-16 16:33:50 -04:00
Ricordisamoa
2ae155da52 Fix phpcs errors in includes/
Mostly Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines

Change-Id: I678b2f0902f11cd1dfa1611b9da24e7237df9122
2015-01-08 20:15:07 +01:00
Chad Horohoe
aa21e125a3 Remove obvious function-level profiling
Xhprof generates this data now. Custom profiling of various
sub-function units are kept.

Calls to profiler represented about 3% of page execution
time on Special:BlankPage (1.5% in/out); after this change
it's down to about 0.98% of page execution time.

Change-Id: Id9a1dc9d8f80bbd52e42226b724a1e1213d07af7
2015-01-07 11:14:24 -08:00
Jackmcbarn
779f1024c1 Use preview content when it transcludes itself
When a page transcludes itself, such as <noinclude>foo
{{:{{FULLPAGENAME}}}}</noinclude><includeonly>bar</includeonly>, use the
preview content in its own transclusions. This code was basically ripped
straight from Extension:TemplateSandbox.

Bug: T85408
Bug: T7278
Change-Id: I1aa091a395a4f7b7b744e09e0bed59bc2e1176d0
2014-12-30 12:59:16 -05:00
Aaron Schulz
e369f66d00 Replace wfRunHooks calls with direct Hooks::run calls
* This avoids the overhead of an extra function call

Change-Id: I8ee996f237fd111873ab51965bded3d91e61e4dd
2014-12-10 12:26:59 -08:00
Aaron Schulz
17431af154 Reuse page preview parses by using the edit stash system
* This also changes previews to render section edit tokens but
  remove them on output, avoiding cache fragmentation.
* Also shortened the resulting getStashKey() value.

Change-Id: Ic8fa87669106b960c76912b864788b781f6ee2e6
2014-12-09 22:43:01 +00:00
jenkins-bot
0755177e64 Merge "Add parser callback to get a page's current revision" 2014-09-25 22:52:10 +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
Brad Jorsch
bba2bc6ca0 Record redirect target in ParserOptions
Since Id44d566a, the text passed to the parser when parsing a
&redirect=no page no longer contains the #REDIRECT directive. For the
benefit of extensions that want to know the redirect target from various
parser hooks, record the target on the ParserOptions object associated
with the parse.

Bug: 62856
Change-Id: Icd1da9911a43eabacbd9e9a369a8326f67f270ff
2014-09-18 06:19:31 +00:00
umherirrender
3b2b6a2773 Add missing @param to function docs
Change-Id: I47fa96a976f55a1a93cb75397285edb8c7f4cd8a
2014-08-14 20:22:52 +02: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
umherirrender
dd8921c9d9 Cleanup some docs (includes/[m-r])
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I8ebfbcea0e2ae2670553822acedde49c1aa7e98d
2014-07-24 19:43:25 +02:00
umherirrender
675de2ab2d Remove ParserOptions::setSkin() (deprecated since 1.19)
Change-Id: I779ee51961ddf1fadba060babdaa18bd08cf4299
2014-07-09 18:24:31 +02:00
jenkins-bot
19a38526f3 Merge "Fix typo" 2014-05-30 16:20:43 +00:00
Ori.livneh
df983f6642 Revert "Declare visibility on class properties of includes/parser/"
See https://bugzilla.wikimedia.org/65375#c4

This reverts commit f359cdf614.

Bug: 65375
Change-Id: I12a60b5cc52a07a6deabcbf47c7c99cd2faac3c3
2014-05-16 00:52:24 +00: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
Siebrand Mazeland
f359cdf614 Declare visibility on class properties of includes/parser/
Change-Id: If03a9bd5eb83be4d15f54e73f49f42540fb7d5fc
2014-05-11 02:25:00 +02:00
Niklas Laxström
d1e3c987c9 Fix typo
Change-Id: I724ee18b8413352da8c86e50a9550e62c9531c48
2014-04-23 14:20:40 +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
Bartosz Dziewoński
59002d8935 Consistently use '@deprecated since <version>'
Variants included 'in <version>', 'as of <version>' and just the
version number.

Some @deprecated annotations do not have the version number at all,
I want to hunt them down separately.

Change-Id: I8208c6097098f4735d4f51bc42254675f1f27f6d
2014-04-15 22:18:19 +02:00
umherirrender
725d9d125d Removed unneeded spaces and colons in @param and friends
Also 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.

Change-Id: Ic36c8c7820a6c2d603f1138130670c6bf6a1ca59
2014-04-08 16:02:49 +00:00
physikerwelt
dca260fb30 Remove math specific code from ParserOptions
There is some math specific code in ParserOptions.
To allow extensions like math to change the cache key in a reasonable matter,
they need to get access to the information which options were used. Therefore,
optionUsed is public now and the additional argument $forOptions was added to
the PageRenderingHash hook.

Bug: 60234
Change-Id: Ieecb27216c39b7e6e354b4a1904fbff06506307d
2014-01-25 21:41:29 +00:00
Siebrand Mazeland
090049a63e Remove deprecated ParserOptions::getSkin()
Has been deprecated since 1.18. One remaining use in a Gerrit extension
replaced.

Change-Id: I7eba24593368047ca48a5e1cb60378319c1e51b2
2014-01-22 15:40:24 -08:00
physikerwelt
ce2b03fb0b Add reference to the current user to the PageRenderingHash hook
To generate a user-dependent cache key it makes sense to pass
a reference to the user object, since $wgUser is deprecated.

Change-Id: I32a1df52912292230852c31d69968eeb312a4a97
2014-01-06 15:04:54 +00:00
aude
3aa33b62ee Remove User::getPageRenderingHash, deprecated since 1.17
The function is not used in core or in any extension in git,
and the PageRenderingHash hook in User::getPageRenderingHash
is not used in any extension. (note the hook still exists
in ParserOptions).

Change-Id: Ica27ce3828dd6551e21671ff723427d09c2dcadb
2013-11-22 08:43:32 +00:00
physikerwelt (Moritz Schubotz)
545b712ed4 Mark Math-specific functions in core as deprecated
The math specific functions in core are not needed
anymore and should be removed in future versions.
Math can access these settings in the same way as
all other extensions do.

Since Math 2.0 the rendered element has the property
"markerType" => 'nowiki'

Change-Id: I20d3714bed9da864146f133a08cf4ca90eda42ab
2013-11-06 17:41:31 +01:00
Timo Tijhof
06cfd63442 doc: Clarify documentation for ParserOptions::getUserLangObj
It no longer produces inconsistent link tables, that was fixed
in r89706 by setting the parser to the default language when
saving, and then when viewing it might reparse for a different
uselang if needed (without saving link updates).

Of course, that isn't pretty and it should still be discouraged.

Change-Id: I599a7162fed458713ffa3a754086c6a2ffdebe07
2013-08-02 03:07:53 +00:00
Alexandre Emsenhuber
7053baca03 Remove "will be removed in ..." comments
All of them are wrong, since 1.20 is out for a while now, and
these methods are still here.

Change-Id: I3b59b61490c9aea5252e25623b0b282295dcc3f6
2013-05-11 22:04:21 +02:00
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
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
umherirrender
f3cf109e62 remove space before semicolon
Change-Id: Ic0d890f5e27cec017c7f7910a67d53b2edf82079
2013-02-09 22:44:24 +01:00
MatmaRex
1b71bc5256 (bug 29472) kill $wgUseDynamicDates
Remove $wgUseDynamicDates and everything related to it.

I left DateFormatter::reformat() alone, since it might possibly be
used elsewhere, and to be honest I'm afraid to touch it.

Change-Id: I609db8471c14e5e5946916f085d2ee5b96204d81
2013-02-06 17:38:05 +01:00
umherirrender
85d8ee1f87 Remove a bunch of trailing spaces and unneeded newlines
Change-Id: I00f369641320acd7f087427ef031f3ee7efa0997
2012-10-10 20:14:40 +02:00
Liangent
9573209efc (bug 37453) Move $wgDisable(Lang|Title)Conversion to ParserOptions
This allows easier fix of bug 37453, and patch to fix it is
included in this changeset.

Change-Id: I9096534639394755d0a296dea7380e7b938befef
2012-09-16 20:20:36 +02:00
Tim Starling
2caa7829fc Generated node count limit
To prevent large template DOM caches from sending servers into swap,
throw an exception when more than some number of DOM elements are
parsed. Unfortunately, it wasn't possible to return a normal error
message, because it broke PST and extractSections and corrupted the
article text. It's safer to refuse to save the edit, and we don't
have decent ways to do that short of throwing an exception.

Ideally we would like to have an upstream patch that hooks libxml to
allocate memory from PHP's request pool, then a fatal error would be
raised instead of swapping.

Change-Id: I4cb4f6fd313e1e0940b56cc5e586afd1bea9267a
2012-09-15 14:51:58 -07:00
umherirrender
3dd5c97e85 Use $wgExpensiveParserFunctionLimit over ParserOptions
This allows extensions to set the value

Change-Id: I4a935a00fe02a2bb88a14942e5e3ec6f4e5e833e
2012-05-04 20:56:28 +02:00
Alexandre Emsenhuber
0fc8c8e14e Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I10c077f27a2077a266a64048fa137f7b1f8e226c
2012-05-01 09:05:48 +02:00
Antoine Musso
d5d1585900 revert r111234 (deprecated methods removal)
Reasons invoked by Rob Lanphier are:
* ongoing code slush
* backwards compatilibility issues
2012-02-12 19:25:28 +00:00
Alexandre Emsenhuber
435c7eb616 Remove some methods marked for removal in 1.20 and update FakeTitle accordingly.
No more callers in core or extensions.
2012-02-11 14:36:36 +00:00
Sam Reed
2ec09c5165 More return documentation 2012-02-09 21:35:05 +00:00
mrbluesky
9320b8bed5 Comments only 2012-01-27 22:07:09 +00:00
Jeroen De Dauw
49cdca93be add missing deprecation notices and added deprecation version to existing ones 2011-12-13 05:19:05 +00:00
John Du Hart
216d661d3b Bug 29524 - Rename RequestContext::getLang to getLanguage
I'll be amazed if this doens't break any tests.
2011-11-21 16:13:21 +00:00