Commit graph

875 commits

Author SHA1 Message Date
Amir E. Aharoni
0ffe674912 (bug 35167) Allow <span dir="ltr|rtl"> in toc items
Added parser tests accordingly.

Change-Id: Ia77f24f53e77b0b9d6112218c93ea15fdefac5de
2012-09-26 06:50:46 +00:00
Tim Starling
ade7daae2c Log page titles that are more than 10% of the node count limit
Change-Id: I6824d305efd73de95ad15c65d3421886c2f86aa9
2012-09-20 14:39:32 +10: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
Fran McCrory
d6028a1811 (bug 34939) Handle mixed-case URL protocols in wikitext
This patch marks the regex matching url protocol as being case
insensitive. We will from now render links like [HTTP://ww].

Tests added.

Change-Id: I706acb7a0ae194b50d2318763beae4e5e83671f3
2012-09-04 16:26:46 +02:00
Siebrand
2c88837c1e Merge "Make functions match definitions in Preprocessor interface" 2012-09-01 22:44:48 +00:00
Alexandre Emsenhuber
d3e0168c67 Added missing GPLv2 headers in new files.
Also improved file documentation.

Change-Id: Ia5a383110769cf51603305dc639616d904ebbab2
2012-09-01 21:56:38 +02:00
Reedy
042bafe363 Make functions match definitions in Preprocessor interface
Change-Id: I0bc1f5540bb7aabcd7e54edc180439446af979f4
2012-08-30 22:03:19 +01:00
Catrope
cddcb353fb Merge "Reduced some master queries via Revision::READ_NORMAL." 2012-08-28 23:53:26 +00:00
Aaron
d1ea6352e6 Reduced some master queries via Revision::READ_NORMAL.
* Also normalized 0 => false for the rev ID parameter in some places.
* Broke some long lines and shorted a variable name in Skin.php.

Change-Id: I6645315699ec7670ae22aa1dbf787d75d6e6b7ec
2012-08-27 16:20:56 -07:00
Niklas Laxström
a42bd6d4bb Validate number input for {{PLURAL}}
The new plural parser is pickier about input.

Change-Id: I1d033d30fdad61db2f661f603d9866923245137a
2012-08-27 08:55:37 +00:00
Tim Starling
c39ba9706a Fix exception on parse due wfMsgExt() -> wfMessage()
Replacing wfMsgExt() with wfMessage() in 4e1ccf0 causes an exception on
parse when the defaults are used for $current and $max. I don't know if
there are other similar fatal errors caused by that set of commits.

Change-Id: I84cfdede844bb2dd3c106721b972ed1cd8bfe480
2012-08-27 10:40:27 +10:00
Brian Wolff
5a6f82c47f (bug 38249) No PCRE unicode causes installer to spew giberish
If PHP's PCRE is not compiled with unicode property support, this causes
the regexes used by the parser to not compile, causing the parser to
output giberish. Its been reported that the default PHP package for
cent os has PCRE in such a config.

As a result the installer will output total giberish. The user has
no idea what went wrong because there is no meaningful output.

To counter that, cause Parser to throw an exception in that case.
It seemed easier than figuring out how to convince the installer
not to parse the environment check. For completeness sake though
I fixed the PCRE environment check to adequetely check for PCRE
not having unicode support.

This should be backported to 1.19 since there are quite a few
complaints about the issue on project:Support_desk. /me has
no idea what the procedure for that is in our new git world

Change-Id: Idb1658be4ee6203a55740450e335f570a616671c
2012-08-21 18:35:17 -07:00
tpt
2b9c22deb3 (bug 23226) Add |class= parameter to image links in order to add class(es) to HTML img tag.
Change-Id: If58802ad2c513c1db7bc3488daf4e078b8694b02
2012-08-21 17:25:42 -07:00
Siebrand Mazeland
4e1ccf0267 Replace deprecated wfMsg* calls with Message class calls.
Doing this in steps of roughly 100 changes per commit, so that it remains reviewable.

Change-Id: I4950fdf8be669b52446290768ece0b8df8399d5d
2012-08-20 22:52:17 +02:00
Aaron Schulz
5f5ba94b06 Merge "store text length in local var in Preprocess::processToObj/Xml" 2012-08-15 00:22:10 +00:00
jeroendedauw
025f03ec88 Added missing @since and @return tags so other people dont have to waste their time figuring it out as well
Change-Id: I84e75da7bdbf30b57368eca0051b1aa664afc798
2012-08-09 14:29:46 +02:00
Aaron Schulz
eb183bac87 Revision and WikiPage cleanup with IDBAccessObject interface.
* Replaced WikiPage::DATA_FROM_* constants with IDBAccessObject ones.
* Renamed IDBAccessObject constants a bit for visual consistency.
* Removed AVOID_MASTER parameter and replaced calling instances with READ_NORMAL.
  Instead of getting page_latest from the master and the revision from a
  slave, just get it all from the master in one RTT. Most callers used
  AVOID_MASTER (and now READ_NORMAL), so this case is barely hit anymore.

Change-Id: Ifbefdcd4490094b38e49bbb46c95fdb71b5c9e1a
2012-08-08 16:34:08 +00:00
Reedy
e3f2a90bf0 Remove unused variables/function values returned
Fix trailing whitespace

Change-Id: I53abf75e142f0166032b98e4adb3dabe06643017
2012-08-08 00:47:25 +01:00
Aaron Schulz
bfe2fde968 Merge "Added some docs, fixed some docs and made implicit checks explicit" 2012-08-07 19:45:40 +00:00
Tim Starling
e021f2faf6 Merge "Fix wrong return value in Preprocessor::getChildrenOfType" 2012-08-07 00:37:53 +00:00
Aaron Schulz
76b3629ce8 RefreshLinksJob performance tweaks.
* Made refreshLinksJob2 always spawn smaller jobs. This can reduce
  the problem of all runners doing the same refresh jobs by increasing the
  granularity of the work to single pages parses per job.
* Avoid master queries when fetching the latest revision for refresh links jobs.
  Also avoid the master for template fetching on parse. A LoadBalancer waitFor()
  call is used instead. The main reason for hitting the master to fetch templates
  was this job itself.
* Fixed bug in refreshLinksJob2 where one missing page would cause all the
  remaining updates for pages to be aborted.
* Factored out some code duplication between the two refresh links job classes.

Change-Id: Ieca51567a888f50a6f15b6c2606323da80d6584b
2012-08-07 00:35:38 +00:00
jeroendedauw
df8245ba25 Split CacheTime into its own file
Change-Id: Iaa546fc5a30dad4bc0a0dbd0dc18dd2e05bf9d7f
2012-08-06 16:18:02 +02:00
jeroendedauw
8f940b57ff Added some docs, fixed some docs and made implicit checks explicit
Change-Id: Ib8ed516bc1114c58bec6e6213b52658fb34f5c98
2012-08-06 15:56:23 +02:00
umherirrender
80cc857fc1 store text length in local var in Preprocess::processToObj/Xml
The $text is constant and that means, the length of $text is also
constant, store it in a local var is easy than.

Change-Id: I9631b862f40eef7f8b18559ffd474a0037077d18
2012-08-06 13:41:28 +02:00
umherirrender
91c3d5c6c5 Fix wrong return value in Preprocessor::getChildrenOfType
I am not sure, but this looks wrong, because it adds the type to the
array and not the child.
This method is unused in core and wmf extensions, maybe
removing/deprecating is a better idea, but I am not sure, if that is
possible.
I have only see this possible error, while looking through the
preprocessor.

Change-Id: I5b7492d455989a8a3e71b5db6d31091b986c502a
2012-08-05 22:14:45 +02:00
robin
e4b4bfdf9b (bug 38351) Image alignment should follow the page content language
The alignment of image thumbs should follow the page content language instead of the wiki content language.
For this it needs the parser context, and because it makes sense to have it as first parameter, I renamed makeImageLink2() to makeImageLink(), the 2 seemed to be redundant anyway.
The old function name keeps the old behaviour, but can be removed quite soon since almost no extension is using it.

Change-Id: I0c35b06a85528dcc43fdd0578dc9b327c495cf4a
2012-08-03 00:48:06 +02:00
Nikerabbit
d2bac57f54 Merge "Make DateFormatter work in any language, by default in the page content language" 2012-07-27 11:02:29 +00:00
Catrope
a1815e3196 Merge "(bug 14237) Allow PAGESINCATEGORY to distinguish between 'all', 'pages', 'files' and 'subcats'" 2012-07-26 02:11:05 +00:00
Catrope
d266f40a2f Merge "allow combined width/height param in {{filepath:}}" 2012-07-26 02:08:57 +00:00
umherirrender
110c9f979d (bug 14237) Allow PAGESINCATEGORY to distinguish between 'all', 'pages',
'files' and 'subcats'

Change-Id: I6dc90c6701c857256343f3c8f874dc20c6cc098a
2012-07-25 17:57:18 +02:00
umherirrender
49a4839c13 allow combined width/height param in {{filepath:}}
Using the same regex like [[File:|]]
With heigth, the width inside the thumb link can be calculated, if the
height not fit in the width.

Change-Id: If188d923d6cd25ea6a5118098f3a513ca5135d43
2012-07-25 17:31:47 +02:00
robin
e16c4c9ed8 Make DateFormatter work in any language, by default in the page content language
Add a lang parameter to DateFormatter so it can work in any language instead of only the site content language.
(The memcached key is now per language code.)
Use by default parser->getTargetLanguage() so it is parsed in the page content language by default.
Also add some documentation and remove unneeded whitespace.

If needed, a parameter to {{#dateformatter}} can now be easily added, to specify the language to format in.

Change-Id: If61854920065f7c3b4170ab89e9aa66b299f9dd8
2012-07-21 00:27:04 +02:00
Aaron Schulz
5446238520 Merge "In LinkHolderArray::doVariants(), redlinks need to be checked as well." 2012-07-15 20:15:50 +00:00
Antoine Musso
4a69fceb79 prettify documentation
Change-Id: Icfd267a94ac981b4c15e51add18c6d8ceb68454e
2012-07-10 17:18:20 +02:00
Antoine Musso
d5737f8f17 update @param @return doc in several files
Change-Id: I0e23227330f90dc4121fd2a313d2e9a33c3c97a7
2012-07-10 17:08:52 +02:00
Antoine Musso
aab43dd495 escape tags and entity in doxygen comments
When inserting XML elements inline <such as this one>, doxygen chokes
about it not being known. Simply enclosing the tag in double quotes
prevents doxygen from emitting a warning.

Also enclosed a few invalid functions calls such as \. and double quoted
the HTML entities such as &foobar;

Change-Id: I4019637145e683c2bec3d17b2fd98b0c50a932f1
2012-07-10 17:08:32 +02:00
Daniel Werner
3921515104 hook InternalParseBeforeSanitize
This patch add the hook 'InternalParseBeforeSanitize' which gets called
during Parser's internalParse method just before the parser removes
unwanted/dangerous HTML tags.

Change-Id: If32053f9304088d7943aa0c9e78716a644c34fe1
2012-07-04 23:32:14 +01:00
Brad Jorsch
3d474cae60 (bug 17865) Add a "ParserAfterParse" hook
In order to correctly output an error message that might contain
wikilinks, Cite.php needs a hook that is called after the page is parsed
but before the call to replaceLinkHolders().

Change-Id: Iaa2755f994edb081eb1d176f632f7add41640dbf
2012-07-04 22:33:19 +01:00
Liangent
d80ebf9c91 In LinkHolderArray::doVariants(), redlinks need to be checked as well.
Currently a simple Title::exists() or Title::getArticleId() call on a
non-existent title can cause the title marked as redlinks in LinkCache,
even if a title in another variant exists. A visible appearance is that
the function refuses to try other variants of a link if the link has
already been checked by {{#ifexist:}}, which internally calls
$lang->findVariantLink() then $title->exists() is invoked.

$titlesToBeConverted is also tweaked to avoid the trailing "\0".

Change-Id: I741e2938eb364ed29f10f058da260848a6774f9f
2012-07-02 19:51:55 +08:00
Waldir Pimenta
0a7cf03e75 (bug 23427) PAGEID magic word
Please note on preview of a new page, this magic word will return 0 so
we have to set the vary-revision flag.

Change-Id: I11d42ca773ad84b73cc84f2c7dd2d09f1982d97a
2012-06-22 10:56:01 +02:00
GWicke
bb52be9f3d Merge "Wrap auto-numbering for section heading in a classed span (bug 33450)" 2012-06-17 16:39:28 +00:00
GWicke
dee9dbb538 Merge "(bug 21660) "Pipe trick" full width commas (with test!)" 2012-06-17 12:26:45 +00:00
umherirrender
590f05ea13 do not output numberofviews, if $wgDisableCounters = true
Change-Id: I9975dceedeffafadf560ed71238c51b94eb8c3ad
2012-06-06 19:29:16 +02:00
Waldir Pimenta
55f4eb263b Wrap auto-numbering for section heading in a classed span (bug 33450)
Change-Id: Ibea90c096b1b757c277819fc403eef45209fc94c
2012-06-03 15:44:46 +01:00
Dan Collins
b41981d392 (bug 21660) "Pipe trick" full width commas (with test!)
Pre-save transform now accepts full width commas, and a parser test is added,
which passes. Originally done by Conrad Irwin, branched out by Tim in r62689
along with a bunch of other stuff, and then it sat in bugzilla for a few months.

Change-Id: I3302e43bab423835cdaee6bdcfc0252a206490fc
2012-05-23 15:40:25 -04:00
Tim Starling
7fc5234cbe Scribunto parser support
Add $indexOffset parameter to PPFrame::newChild(). This makes it
possible to use newChild() for interpreting named parameters to
invoke in Scribunto -- otherwise I would have had to duplicate its
functionality, which would have been tricky given that I wanted to
make a real frame with an expand() method. Setting $indexOffset allows
newChild() to start counting numbered parameters from somewhere other
than the first pipe character, leaving room for the Scribunto function
name.

Fixed PPCustomFrame_*::getArguments(), was missing for no apparent
reason. I didn't end up using it in Scribunto, but there's no harm in
adding it anyway.

Change-Id: I0c761aab8a7f1ae74e8d151a1346febb5c466e18
2012-05-22 13:53:41 +10:00
Tim Starling
78d0b3cfa8 Merge "Remove extra unneeded whitespace" 2012-05-18 04:57:44 +00:00
Aaron Schulz
a0aa7557fe Merge "Add/update function level parameter documentation" 2012-05-15 01:09:37 +00:00
Reedy
2df7fae395 Add/update function level parameter documentation
Change-Id: I148b84e3b81c29c63585f3bf524fc445fd7683a7
2012-05-15 00:44:25 +01:00