Commit graph

1167 commits

Author SHA1 Message Date
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
Siebrand Mazeland
9b7889b84b Use American English spelling for behavior
Spotted in ipbreason-dropdown by Shirayuki.

Change-Id: I576ed4bc0abe5ab980aaee3fb9f9e4b43087311f
2013-03-04 10:24:57 +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
IAlex
3f92a5672e Merge "remove space before semicolon" 2013-02-10 12:51:02 +00:00
IAlex
0cce298226 Merge "fix some spacing" 2013-02-10 12:47:01 +00:00
umherirrender
ca31ebad3f fix some spacing
Added/removed spaces after opening/before closing parentheses

Added a space after a comma

Removed unneeded parentheses in condition

Change-Id: I306091347ccaaf11dee0cdfda3019cb0c12be51b
2013-02-09 23:03:53 +01:00
umherirrender
f3cf109e62 remove space before semicolon
Change-Id: Ic0d890f5e27cec017c7f7910a67d53b2edf82079
2013-02-09 22:44:24 +01:00
umherirrender
c16e1a4490 TRUE, FALSE and NULL must be lowercase
From phpcs

Change-Id: I09672012be28ae3985702e314442db00d154de24
2013-02-09 21:10:44 +01:00
jenkins-bot
bd671983ee Merge "Remove Preprocessor_HipHop" 2013-02-06 20:07:44 +00: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
Tim Starling
53cd876eb4 Remove Preprocessor_HipHop
To reduce the maintenance burden for changes such as Id7ec4e69. The
project to optimise the preprocessor for hiphop is incomplete and is not
especially useful given the present state of hiphop support.

Change-Id: Iebcfe4d40f74520e29e7feb522251892fab2f652
2013-02-06 14:44:10 +11:00
Dan Collins
9846e2558c (bug 27936) Improve parser handling of nested braces.
Parser tests also included, test case and original patch supplied by
Bergi on bugzilla. Tested against the current version.

Change-Id: Id7ec4e694783dd0f682f65f39d8b9e59f82e58aa
2013-02-06 03:39:07 +00:00
umherirrender
570dda0455 fix some spacing
Change-Id: I88e73d47a552918880514d88a876296a6cb80d88
2013-02-04 20:09:18 +00:00
Antoine Musso
f6b92231fd style: normalize end of files
By PSR2 PHP Standard, the files should ends with exactly one newline.
Some of our files have 2 or more and some other were missing a newline.

Fix almost all occurences of CodeSniffer sniff:
PSR2.Files.EndFileNewline.TooMany

I have not fixed the selenium files, I believe we will drop them.

Change-Id: I89fca8c1786fee94855b7b77bb0f364001ee84b6
2013-02-03 15:04:39 +01:00
jenkins-bot
5a09e9a15e Merge "Fix self link issues about titles in different or mixed variants" 2013-01-31 20:46:49 +00:00
daniel
40cb62d558 Better way for extensions to add to ParserOutput.
Extensions sometimes need to stash information in the ParserOutput
for later use. This change provides a clean way to do that.

Change-Id: I8bc571d13c9a70bb71430862c2ab679ff1947126
2013-01-30 12:45:47 +01:00
jenkins-bot
7fbc18e1ba Merge "fix some spacing" 2013-01-27 13:14:56 +00:00
umherirrender
2e8da558ba fix some spacing
Change-Id: Id7eda67a43f9040117edd79fdbeb678f1c3a6da2
2013-01-26 22:11:09 +01:00
umherirrender
9d6575af15 The static declaration must come after the visibility declaration
From phpcs

Change-Id: Ieab0207f965630eda113abdc0259aa2eddcf5ca7
2013-01-26 21:03:52 +01:00
jeroendedauw
5157242009 Added typehint
Change-Id: Ic71419e72f8cf0a12d9ea1be84fd0fcd838337d9
2013-01-25 20:29:10 +00:00
jeroendedauw
c19ec2d8f9 Simplified code. Removed not needed if-else
Change-Id: I9660f543deefb5154a03535b668ee68eb3394e75
2013-01-25 20:07:27 +00:00
Liangent
bca8b8ad7d Fix self link issues about titles in different or mixed variants
Change-Id: I64a1b25a45cb8df9fea6fbbfd92cac2e6d53ff98
2013-01-25 18:07:11 +08:00
jenkins-bot
a8d72e1faa Merge "(bug 43964) Invalid value of "link" parameter in <gallery> no longer produces a fatal error" 2013-01-24 19:32:59 +00:00
jenkins-bot
cb4b29fd96 Merge "Further tweaks to pipe trick documentation (follow-up Iaf365e31)" 2013-01-24 15:48:24 +00:00
Alexandre Emsenhuber
6f74a93d1b (bug 43964) Invalid value of "link" parameter in <gallery> no longer produces a fatal error
Also added a test for this just in case someone wants to break this :)

Change-Id: I2782cf1a45b574eb5fd69b1c1be561e7bdaef59e
2013-01-23 07:40:27 +01: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
Platonides
5d064a7433 Reorganise the functions doing wfProfileOut and returning on all if branches.
Makes life easier for static analysis, since they don't need to
handle if the end of a function where a wfProfileOut was not called
was reachable or not.

It is recommended to review this change ignoring whitespaces
(specially for includes/parser/Tidy.php)

Also documented the rationale for the elseif chain in UploadBase::detectVirus()

Change-Id: Ic4f65937fa9e6f926d8fcfd670e3b0e99e06eefc
2013-01-13 17:53:05 +01:00
Reedy
a3fbdaaa2c Remove $wgBug34832TransitionalRollback
Per "@todo This variable should be removed (implicitly false) in 1.20 or earlier."

Change-Id: Ibd6d0199848ef4631d13e1a27044c793ef15ec02
2013-01-11 15:49:33 +00:00
Platonides
fb0966908b Miscellaneous profiling fixes
Change-Id: I8d8ce0bc0383e4feb4ed38fd96b2dd516dcb742e
2013-01-06 22:35:11 +01:00
Liangent
d266580c5b (bug 33210) Don't convert blue categorylinks to another variant.
By the way the check $oldkey != $vardbk is unnecessary because
there's already $variant != $category check.

Change-Id: I963be065723059073c9cb83c6ef636af8d023faf
2013-01-04 11:48:56 +00:00
Siebrand Mazeland
2575b8cf2b Update docs
Change-Id: I96c04c4ce9384816e120baef3572dfc4fd216b9a
2012-12-17 11:23:02 +01:00
Reedy
dd16606d7a Fixup a couple of uses of return values of functions that return void
Change-Id: I7c8f08c5b436cb3209fd98b9479a50abe223cccc
2012-12-09 03:16:14 +00:00
Waldir Pimenta
546322662b Further tweaks to pipe trick documentation (follow-up Iaf365e31)
- call them pipe tricks (plural) as there's more than one
- mention double-width comma as well
- use one tab character for alignment due to double-width chars
- document reverse pipe trick

Change-Id: I27a1d04362eb3988fc1318fa1f73f69877019439
2012-12-06 06:19:13 +00:00
Nikerabbit
d5f42a2077 Merge "Improve documentation for "pipe trick"" 2012-12-05 09:56:56 +00:00
Nikerabbit
0a32a34775 Merge "Implement static public Parser::getExternalLinkRel" 2012-11-30 20:29:54 +00:00
Marius Hoch
d067e090ea Implement static public Parser::getExternalLinkRel
I've implemented the function Parser::getExternalLinkRel which
gives the 'rel' attribute for a given link in a given NS. Per Tim's
suggestion, as it's currently impossible to invoke the logic in
Parser::getExternalLinkAttribs externally.

Change-Id: Id0bfed81e2afd6730d820b6c9a4a09155a557f37
2012-11-30 21:20:38 +01:00
Stephan Gambke
a7c837a086 Allow null for title in preprocess
Additionally remove creation of bogus title in transformMsg.

The only place preprocess uses the title is in startParse. And that explicitly allows null.

Change-Id: I33d090bf250092fc541e284eb19dbd4053f40ae5
2012-11-24 10:40:06 +01:00
Nikerabbit
bb7d20b87a Merge "Clean up Language::markNoConversion()." 2012-11-23 13:01:08 +00:00
Daniel Friesen
e185d4a2a4 support for HTML5/Microdata elements
Patch let us handle the <data>, <time>, <meta>, and <link> elements.

* handles one part of bug 32545 requesting us to support the <time>
  element in WikiText.
* Partially fix bug 28776 about whitelisting global HTML5 semantic
  attributes and inline meta element.
* <meta> and <link> are only permitted when Microdata is enabled using
* the global $wgAllowMicrodataAttributes. For for security reason, the
  links are only allowed to be actual elements when they have a
  strict set of attributes set.

Change-Id: Ica11be186bd62eb154e1ebc400acb515c10fb65f
2012-11-19 09:00:50 +01:00
Liangent
e01adbfc0b Clean up Language::markNoConversion().
* IRIs are getting more and more widely used these days so Chinese
  characters are also needed to be prevented from being converted
  in text of external links.
* So now all markNoConversion() functions in languages with variants
  do the same thing. Merge them into a single function in the
  Language class and drop implementations in individual languages.
* By the way rephrase phpdoc of that function, and (bug 24798) fix
  the link detection regex to use wfUrlProtocolsWithoutProtRel().
  Protocol-relative regex is excluded to avoid false positives.
* Add parser test for it.

Change-Id: I2ec0ac2b9b11221584adb72555168498de209d57
2012-11-18 03:46:53 +08:00
Brad Jorsch
7c9d6c0d10 (bug 32368) Add ParserCloned hook
We store various bits of data as "expando" properties on the Parser
object, to pass information from one stage of the parser to another. If
the parser is cloned, however, we can run into trouble because two
different Parser objects are now manipulating the same extension data
structure; this often shows up when ParserClearState is called on one
clone and clears the state of the other as well.

Since a deep clone might be too expensive and still might be wrong in
some cases, it seems most useful to simply provide a ParserCloned hook
so extensions can just do The Right Thing.

Change-Id: Ieec65c908d71e89b9a66f83b9a626f842aadacbb
2012-11-16 11:27:13 -05:00
daniel
c2172d45e4 Beware that getContent() may return null
Before the introduction of the content handler, missing content was
signified by getText() returning null instead of a string. null will
work much like an empty string in most contexts, so in many places,
it was not checked explcitely whether the conent was null.

Now, when getContent() returns null, this often caused a fatal error,
because the code would access whatever getContent() returned as an object,
without checking whether it was null (because no such check was performed
previously, when the content was represented as a string).

This check introduces explicite checks for getContent() returning null
in the most essential core classes.

Change-Id: I551a90b0b67b8edc7570ca5d252ecc1de903f097
2012-11-09 19:45:12 +01:00
Waldir Pimenta
600ecaf7be Improve documentation for "pipe trick"
- Actually mention "pipe trick" so the code is searchable
- Use spaces rather than tabs for vertical alignment
- Clarify comment for double-width brackets and mention revision it was added

Change-Id: Iaf365e313144e378133fb16c64efa5b7e47d4a6a
2012-11-07 12:54:24 +00:00
Hashar
fbe10c4b3d Merge "Document what ParserOutput::setProperty() is for" 2012-11-02 15:37:35 +00:00
Tim Starling
7474d1388a Document what ParserOutput::setProperty() is for
Change-Id: I88735b1ebc9b8423b4fbe7b196dfc914f95818fd
2012-11-02 15:39:53 +01:00
Nikerabbit
b85839a549 Merge "Fix tabs inside/between statements/text" 2012-10-26 18:57:25 +00:00
umherirrender
82375631c2 Fix tabs inside/between statements/text
This tabs are strange and a space there is better

Change-Id: I0885dff575ee2fcd0668d08fef3226e132c5b319
2012-10-26 18:18:59 +02:00
umherirrender
e5f5e95137 Fix indentation whitespace errors
Change-Id: Ie268bee2098c589c050e1b5b0e93fe1b3feca86f
2012-10-26 17:42:13 +02:00
Gabriel Wicke
31625b54a0 Bug 11748: Handle optionally-closed HTML tags
* Fixes bug 11748 (Parser issue for HTML definition list) and similar
  issues for nested unordered / ordered lists

* Stops wrapping HTML-syntax definition lists into paragraphs
  for consistency with their wikitext variants

* Enables one previously disabled test and adds another for nested
  definition lists with HTML syntax

Change-Id: If75ed54e11452dbcf5e6213cc20923064f811715
2012-10-25 19:31:29 +02:00
umherirrender
85d8ee1f87 Remove a bunch of trailing spaces and unneeded newlines
Change-Id: I00f369641320acd7f087427ef031f3ee7efa0997
2012-10-10 20:14:40 +02:00
IAlex
408a3df1dc Merge "Remove unused variables." 2012-10-09 10:23:38 +00:00
Siebrand Mazeland
632ce2a8fd Remove unused variables.
Change-Id: I4b76cbbca22555eacb8ef4de58993b485f7cdd18
2012-10-09 09:43:14 +00:00
Siebrand Mazeland
d4b046a893 Update docs for return and exception info
* Removed some inline tabs in the process.
* IDE fixed some incorrect leading spaces, too.

Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
2012-10-09 09:41:58 +00:00
daniel
c546fae8ed merge latest master into Wikidata branch
Change-Id: Id4e0f40c03679c13d8934a6add99b5cd86d0437d
2012-10-08 13:58:54 +02:00
MaxSem
95166fa0b4 Merge "Don't display multiple language links to the same language" 2012-10-05 19:15:44 +00:00
Tim Starling
d5a0ddcca4 Don't display multiple language links to the same language
(bug 24502) Resolve the various issues with this accidental feature
by removing it. I think it could be done properly, along the lines of
my comment #5, but I don't think just changing the DB schema to make
langlinks non-unique is a good direction to take. A comment on
I4e1e08a3 from Daniel Kinzler indicates that duplicate language links
won't be possible with Wikidata anyway, so there's not much value in
I4e1e08a3 for WMF wikis.

Change-Id: Iba5f3f29e20f5119d4414b1e87ce5eee674701a8
2012-10-05 23:14:07 +04:00
Reedy
f6cbdfb5e2 Merge "Show HTTP error (if any) when scary transclusion fails" 2012-10-04 15:11:25 +00:00
umherirrender
a2e470ee68 (bug 32951) Do not register absolute internal externals
Setting $wgRegisterInternalExternals = false for proto server should not
store the http/https links in externallinks table

Also fix detection of own links for links with query or anchor or
nothing

new also detected:
//localhost
//localhost?query
//localhost#anchor

already detected:
//localhost/path

Change-Id: Idd03d309cc3b71728a8cbea460efa12b10348d64
2012-10-03 23:15:38 +00:00
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
daniel
b6b686c13b merged master
Change-Id: I0ef7c7f33a5dc5855f38b20c03ddc5306f38ec66
2012-09-19 12:34:10 +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
daniel
b6fe213226 merge latest master.
some tests fail due to logical changes, will fix that in a follow-up

Change-Id: I8a5e4087ecf674fbcf6327c5d168cd401be12400
2012-09-05 17:50:13 +02: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
daniel
72952a082c merged master some more
Change-Id: I53f349e42336ce0426ea1aff939853b3cd728aeb
2012-08-29 15:37:17 +02:00
daniel
9994968774 merged master
Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
2012-08-29 15:20:15 +02:00
Daniel Kinzler
392af46809 Revert "merged master"
This reverts commit 67bfdc7a68
2012-08-29 13:14:49 +00:00
daniel
67bfdc7a68 merged master
Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
2012-08-29 12:06:38 +02: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
Alex Monk
780a9ee2db Show HTTP error (if any) when scary transclusion fails
Also document all the scary transclusion messages.

Change-Id: I5ff473ed4bfccedbb5feb3f2ef469eec6eb2e57c
2012-08-27 18:45:24 +02: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
daniel
0139923580 fixing long lines
Change-Id: Iebcd40a1a37a3a93cc571fa2c2b0a87f53dc97a4
2012-08-20 21:33:07 +02:00
daniel
29719f846b merging latest master
Change-Id: I36b7f2f63ab8c08f8412d521dc68ea45c8b67711
2012-08-20 16:55:28 +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
859db6a6df Added fixme for incorrect assumption being made
Change-Id: I40b83428019b32c39c529577bf3f55677a407693
2012-08-06 19:28:57 +02: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
daniel
c0b50eb47d merged master
Change-Id: I6afafe971afb3f38fc8f1e66ba409283b8a698f8
2012-08-02 11:01:22 +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
daniel
d87135d706 merged master
Change-Id: Iad12ee382d6aeb1fab6fefb611d290b74865ea4b
2012-07-23 22:07:18 +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
daniel
b0fd13578e merged master
Change-Id: I0028e0ae01c7d025e60691cb4ad9d04869b9778c
2012-06-25 13:39:29 +02: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
daniel
b801fa8b3b merged master
Change-Id: I6cf08c09c7d9b38ecce0b2bbed61431939edd7d4
2012-06-20 19:13:16 +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
daniel
2eb4b6e2b3 use Message::content() to get message content 2012-06-12 17:31:01 +02:00
daniel
3d58f903d8 Merge branch 'master' of ssh://gerrit.wikimedia.org:29418/mediawiki/core into Wikidata 2012-06-11 17:45:59 +02:00
daniel
6de4180d0c Moved redirect extraction from Title to WikitextContent.
All code that wants to know redirects should use the methods
from the Content interface, the newFromRedirect methods in
Title are deprecated.
2012-06-11 12:35:46 +02:00
daniel
e259164d15 use Content::getWikitextForTransclusion() when fetching template text 2012-06-08 09:04:24 +02:00
daniel
48d0bedd78 cleanup and fixes for secondary data updates 2012-06-07 14:57:43 +02: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
daniel
250da851d1 merged master 2012-05-29 17:01:13 +02: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
daniel
d6d9d901fd sync comments to master 2012-05-15 14:47:15 +02:00
daniel
181641792a merged master after 1.20wmf3 2012-05-15 08:46:34 +02: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
Aaron Schulz
060ba3cb68 Merge "Generalizing LinksUpdate to allow extensions to add arbitrary update handlers." 2012-05-14 22:20:04 +00:00
daniel
01f36b721f merged latest master 2012-05-14 23:24:18 +02:00
daniel
a12ce17c6e Generalizing LinksUpdate to allow extensions to add arbitrary update handlers.
This supercedes I6d03bf2a, using better names for the new classes and
incorporating the changes requested by Aaron.

This change introduces the base class SecondaryDataUpdate to be used for any
updates that need to be applied when a page is changed or deleted. Until now,
this was done by the LinksUpdate class for updates and WikiPage::doDeletionUpdates
upon deletion. This patch uses a list of SecondaryDataUpdates in both cases.

This allows extensions (e.g. via the ContentHandler facility, once that is in) to
easily specify what needs to be done when a page is updated or deleted in order to
keep any secondary data stores (such as link tables) in sync.

Note that limited transactional logic is also introduced, so SecondaryDataUpdate
can be implemented to only commit their changes if all updates were performed
sucessfully.

Patch Set 2: fixing some coding style issues mentioned by Nikerabbit.

Patch Set 4: some stuff I kept from the old LinksUpdate class needs cleanup,
             but might break extensions when changed. Marking as todo for now.

Patch Set 5: fixed misnamed member in LinksDeletionUpdate (thanks Aaron).

Change-Id: Ibe3e88fadd8c1d4063cf13bb6972f2a23569a73f
2012-05-13 20:53:37 +02:00
robin
84b8ca9801 Remove extra unneeded whitespace
This whitespaces causes an extra empty paragraph between text and transcluding a special page.
When a heading precedes a transcluded special page, there is no difference and it's fine with or without this whitespace.

See for example http://incubator.wikimedia.org/w/index.php?title=Incubator:Sandbox&oldid=822299

Change-Id: I6b06006d921368619d3969660c244176344e8aff
2012-05-12 23:37:50 +02:00
umherirrender
e9fa97f76e Add unit test for MWNamespace::isNonincludable
rename MWNamespace::isNonincludableNamespace
to MWNamespace::isNonincludable, because "Namespace" is already in the
class name

Change-Id: Ie982835c7dc84cb10c823996e5360cc1b342f704
2012-05-11 19:52:34 +02:00
jeroendedauw
6948cfe072 nicify field declerations
Change-Id: I0f683d421080788ba731c9b52413f532cd9d9e7c
2012-05-10 21:25:40 +02:00
jeroendedauw
98fab462b6 add since tags
Change-Id: I613fe006351c885420ff03a93cf2a239ca88831d
2012-05-10 21:22:11 +02:00
jeroendedauw
b0065ef84e fix null check and compacted/calrified code
Change-Id: I38c7075016f5be0192d85e2a0db273fb100de64b
2012-05-10 21:06:45 +02:00
Tim Starling
3905be18fb (bug 35315) Detect circular references in strip tags
Explicitly detect circular references in strip tags and break the loop,
similar to how we deal with circular references in templates. This is
necessary to support Scribunto since we imagine we will provide an API
that allows strip markers to be forged.

The recursion depth limit is a consequence of changing the algorithm
from iterative to recursive, it's required to protect the stack against
deeply nested #tag invocations.

Change-Id: Icc8dc4aedbced55ad75b3b5a5429a376d06d9b31
2012-05-08 14:36:32 +10:00
Aaron Schulz
820ed8667f Merge "Use $wgExpensiveParserFunctionLimit over ParserOptions" 2012-05-05 09:32:28 +00:00
Aaron Schulz
3791cc86c9 Merge "Show Highest expansion depth in limit report" 2012-05-05 08:51:12 +00:00
Aaron Schulz
4f7584686e Merge "Add MWNamespace::isNonincludableNamespace" 2012-05-05 08:41:29 +00:00
umherirrender
cd40d0040c Add MWNamespace::isNonincludableNamespace
Method is a wrapper around $wgNonincludableNamespaces,
replaced the one place in parser and
add it as info to api's meta=siteinfo

Change-Id: I501b811137c39f5c2d9ea35c78fef8ae22d21bfe
2012-05-05 10:22:28 +02:00
awjrichards
4b891e27bd Merge "Use Title::legalChars()" 2012-05-05 00:01:24 +00:00
Aaron
691318d0eb Only use per-template profiling for one-time profiling output.
Change-Id: Ib89ce14310ccac529684f0ada71f60744319eb3e
2012-05-05 00:34:50 +01:00
umherirrender
e5614cea2c Show Highest expansion depth in limit report
With 1.20wmf2 we get a tracking category with all the problem pages,
seeing the limit for a page is a helpful information than

Change-Id: I1916e5fa6de06b923a01cf1f0ca9362287a9fd70
2012-05-04 22:44:14 +02:00
umherirrender
fafd3e0b26 Use Title::legalChars()
Change-Id: I6b29f29875fa54196b5899042a8f576c82a8943f
2012-05-04 21:47:00 +02: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
daniel
af28c6f55a merged from master 2012-04-29 21:41:03 +02:00
umherirrender
069a4b2280 (bug 22887) Add warning and tracking category for preprocessor errors
I have only add things and not change the current error strings to
messages, because bug 21521 is WONTFIX

Change of Preprocessor_HipHop.php is not tested

Change-Id: I7a7243b8ba010dbb395bdbbb3e00e3217088038e
2012-04-27 16:16:35 +01:00
daniel
a990fd78ff merged from master 2012-04-25 19:49:09 +02:00
Demon
bc89933210 Merge "(bug 34956) Parser should use mUrlProtocol instead of wfUrlProtocols()" 2012-04-25 15:00:00 +00:00
daniel
c536e3db65 use ParserOutput::getSecondaryDataUpdates() as the primary method of getting pending updates 2012-04-17 17:54:00 +02:00
Kim Eik
0a52782667 (bug 34852) new optional 'link' parameter to <gallery>
The patch adds an optional parameter |link= to the <gallery>
tag. This will allow for images to link to other pages and
externals urls instead of being hardlinked to the image file
that is displayed in the gallery.

Here are a couple of examples.

Link as WikiLink:
<gallery>
File:20120106_001.jpg|link=Main_Page
</gallery>

Link as absolute URI:
<gallery>
File:20120106_001.jpg|my caption|alt=my alt
text|link=http://bugzilla.wikimedia.org
</gallery>

this would cause the link on the thumbnails rendered by the gallery tag to link
to a custom page/url instead of the actual media/image.

a link should be an internal wiki link or an absolute uri as shown in the examples.

Change-Id: I21b276ad5c7a8df13b3a716957d23fd53c37d29e
2012-04-16 10:09:31 +02:00
Alex Monk
7ecaa98da9 (bug 34956) Parser should use mUrlProtocol instead of wfUrlProtocols()
Change-Id: I069f21f86bbca55cf05f9a44b2ff3ea960c8af12
2012-04-14 19:12:23 +01:00
Jens Ohlig
10e91851b2 Merge branch 'master' into Wikidata
Conflicts:
	.gitreview
	includes/Article.php
	includes/AutoLoader.php
	includes/EditPage.php
	includes/LinksUpdate.php
	includes/WikiPage.php
	includes/installer/Ibm_db2Updater.php
	includes/installer/MysqlUpdater.php
	includes/installer/OracleUpdater.php
	includes/installer/SqliteUpdater.php
	maintenance/refreshLinks.php
2012-04-11 14:24:29 +02:00
umherirrender
dfe61f64af GENDER should use the GenderCache
This reused the gender state of a user on a page. This is helpful for
special pages which shows the group name, because the each group name
used gender, which result in often use.

Change-Id: I8e816f54aaa100c3333e84e19299fd194323341d
2012-04-07 22:45:31 +02:00
umherirrender
bf2a9989b2 (bug 23006) create #speciale parser function
Also add explicit Title::getPrefixedText() in
CoreParserFunctions::special, so that method does not rely on
Title::toString.

Change-Id: I1d041b11386bff15811e19de47a662e5ed7a2b07
2012-04-06 09:14:47 +02:00
daniel
cc365c3552 Added an array of SecondaryDataUpdate objects to ParserOutput
Change-Id: I329be83a0899b3f16c99119f2f802233a157ee42
2012-04-05 17:21:07 +02:00
Daniel Kinzler
8ede0ad20e integration with Title and Revision (work in progress) 2012-04-04 19:41:52 +02:00
umherirrender
b5511c68c3 (bug 34355) add a variable and parser function for the namespace number
Change-Id: Ie162cfda7ddd38d4278ceee5fd23f5a4e579cb96
2012-04-03 13:25:06 -07:00
Alexandre Emsenhuber
e6812a869a * (bug 35446) Using "{{nse:}}" with an invalid namespace name no longer throws a PHP warning
Change-Id: I8e7611cdb03558af13ec5b96e02857ff5b16b571
2012-03-26 20:27:18 +02:00
Daniel Friesen
e2ee009e5c Commit the cryptrand project worked on in git:
- MWCryptRand: A new api for generating cryptographic randomness for security tokens. Uses whatever cryptographic source is available and if not falls back to using random state and clock drift.
- wfRandomString - A simple non-cryptographic pesudo-random string generation function to replace wfGenerateToken which was written pretending to be secure when it's really not.
- Core updates to use MWCryptRand in various places:
-- user_token generation (to do this we stop generating user_token implicitly and only generate it when needed to avoid depleting the system's entropy pool by reading random data we'll never use)
-- email confirmation token generation
-- password salt generation
-- temporary password generation
-- Generation of the automatic watchlist token
-- login and create user tokens
-- session ids when php's entropy sources are not set
-- the installer when generating wgSecretKey and the upgrade key
2012-03-20 05:17:40 +00:00
Tim Starling
13b514edae Fixed a few "strip tag exposed" bugs.
* Introduced Parser::killMarkers() based on the concept from StringFunctions. Used it in cases where markerStripCallback() doesn't make sense semantically, namely grammar, padleft, padright and anchorencode. Used markerStripCallback() in other cases.
* Changed headline unstrip order as suggested by P.Copp on bug 18295
* In CPF::lc() and CPF::uc(), removed the is_callable(). This was a temporary testing hack committed by me in r30109, which allowed me to do differential testing against a copy of the parser from before that revision.
2012-03-20 04:39:09 +00:00
Christian Aistleitner
42c88dc137 Follow up to r114126: Being more conservative for HipHop compiler 2012-03-19 23:36:48 +00:00
Sam Reed
daa4e524b7 More occurrence typos 2012-03-19 21:40:39 +00:00
Christian Aistleitner
0954fc366f Sanitizing already existing use of PHP's assert 2012-03-19 11:14:43 +00:00
Tim Starling
f15a91f293 In the $clearState=true case, remove strip marker prefixes from the Parser::parse() input. It's only possible for strip markers to be present in this case if the caller manages to guess the output of Parser::getRandomString() in advance. Even if that is possible, it's not recommended as a robust calling procedure.
Also cleaned up some old commented-out code in this area.
2012-03-16 00:29:26 +00:00
Max Semenik
083d47cc73 (bug 23795) Add parser itself to ParserMakeImageParams hook. 2012-03-09 18:32:03 +00:00
Robin Pepermans
b539f7a98e Follow-up r112479
* Add @since, fix indentation.
* Change default from 'all' to 'mw' as it's the most used (so default fetchLanguageNames() is equivalent to default getLanguageNames()).
* Add the include parameter also to fetchLanguageName() as it's needed in Parser: interlanguage links should only take into account mediawiki names. (Doesn't make a difference with how the functions are now, but could have been later.)
2012-03-08 19:30:30 +00:00
Tim Starling
561424c266 Transitional patch for bug 34832: introduce a CI-style option to allow deployment of 1.19 to converter wikis without disruption. The bug fix can be rolled out later by setting $wgBug34832TransitionalRollback = false. This is meant as a temporary measure, while we figure out a way to properly support Chinese wikis for inclusion in the 1.19 tarball.
Introduce a global variable which causes language conversion to not be disabled in interface messages (as before r94279). Use $wgContLang for conversion (as before r97849) since $wgContLang is set to the base language (e.g. zh) on converter wikis, whereas a typical user language (e.g. zh-tw) only has a FakeConverter.
2012-03-05 12:14:53 +00:00
Tim Starling
7df3473cfe * Fix for r41340, r96405, r97849: introduce a function which gets the current content language, called Parser::getTargetLanguage() following the ParserOptions terminology, and added doc comments, to improve the chances of a human being able to work out what is going on. Just because a function happens to do the thing you want doesn't mean you should call it.
* The language object used for lc() in Parser::braceSubstitution() must match the one used in setFunctionHook() during firstCallInit(). It can't change depending on what message you are parsing. Use $wgContLang like before r97849.
2012-03-05 05:53:12 +00:00
Robin Pepermans
b13e9ad861 fix typo in r112479 2012-03-01 17:57:15 +00:00
Robin Pepermans
44d2c73bf5 Combine getLanguageNames and getTranslatedLanguageNames into one function which is much easier and more logical to use. Does not contain any actual changes yet in what the function does.
* Reduces the overly long code in r107002, and reduces code for {{#language:}}
* Fixes the language list in Special:Translate which contained languages that gave "invalid code" when selecting
2012-02-27 11:59:24 +00:00
Daniel Friesen
73482615dd Revert Microdata improvements in r111891, r111898, r111899, r111901, r111903, and r111906 till after the git migration. 2012-02-20 22:32:18 +00:00
Daniel Friesen
a76e8f10c4 Followup r111903; Introduce a new Tidy hack to prevent tidy from stripping the <link> and <meta> elements from the body which are used in Microdata.
We do this by replacing every <link> and <meta> with a <html-link> or <html-meta> element and adding html-link and html-meta to tidy's new-empty-tags config so that Tidy doesn't strip it, and then restoring the <html-*> elements back to normal.
2012-02-20 02:12:48 +00:00
Sam Reed
9990b77058 Add missing wfProfileOut( __METHOD__ ); 2012-02-16 02:01:00 +00:00
Antoine Musso
73247df204 Remove backslash from @return types
Ping r111103
2012-02-13 16:35:59 +00: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
c052fc3b7b Documentation followups from lastnight 2012-02-10 15:37:33 +00:00
Sam Reed
2ec09c5165 More return documentation 2012-02-09 21:35:05 +00:00
Sam Reed
0a626db6e1 Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 19:29:36 +00:00
Sam Reed
85bbb0b080 Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 18:01:10 +00:00
Sam Reed
f3cc77aaee Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 17:41:50 +00:00
Tim Starling
a444986c45 * Optimise {{GENDER}} so that it doesn't need to load the user options if only one form is given. For some reason (presumably some detail of how translatewiki.net works) such {{GENDER}} invocations are extremely common.
* Updated Language::gender() documentation accordingly
2012-02-08 06:09:58 +00:00
Antoine Musso
fc6bc233be Fix doxygen docs before REL1_19 branching 2012-02-01 20:53:38 +00:00
mrbluesky
9320b8bed5 Comments only 2012-01-27 22:07:09 +00:00
Alexandre Emsenhuber
f5b75f1e98 Cleanup to statistics:
* Removed 'pcache_miss_invalid' from stats.php and clear_stats.php, no longer used
* Added missing 'job-insert' and 'job-pop' to clear_stats.php
* Added missing call to wfIncrStats( 'pcache_miss_absent' ) when there's no key in ParserCacge::get()
* Removed useless 'pcache_not_possible' stat from OutputPage::addWikiTextTitle() since that function is mostly used for interface messages
2012-01-23 16:27:13 +00:00
Platonides
49e6e233ec Bug 33845: Headings become cursive in TOC when they contain an image
Fixes the problems with r102179 and r102179, as there are
valid tags which begin the same, which meant they were not removed from
the TOC (the second regex, intended to remove tag parameters, then converted
<img or <blockquote> into <i> / <b>).
The same problem existed in the original regex, but as there are no valid 
tags which begin with sup or sub, it never happened).

Added comment explaining the tocline regex, and added a bunch of parser tests.
2012-01-21 16:27:27 +00:00
Aaron Schulz
5a6559d8b1 Reverted r108743 per CR comment. This should at least be discussed first. 2012-01-12 19:41:18 +00:00
Sam Reed
a5c200a25b Kill "* @return void" 2012-01-12 19:12:24 +00:00
Max Semenik
b7e7a6c76e Made Parser::addTrackingCategory() public to benefit tag hooks/parser functions developers 2012-01-11 15:42:29 +00:00
Sam Reed
3f704bbe0b Fix whitespace
Fix/improve documentation
2012-01-10 18:42:59 +00:00
Niklas Laxström
0865348cd4 Missing @since tags have a yet another victim 2012-01-09 19:11:55 +00:00
Sam Reed
7632e4a26f * (bug 33525) clearTagHooks doesn't clear function hooks.
* (bug 33523) Function tag hooks don't appear on Special:Version.

Patches by Nikola Kovacs
2012-01-04 21:30:06 +00:00
Antoine Musso
f6df3e972d revert r107006
(bug 23427) Introduced {{PAGEID}} variable to expose page.page_id
[patch by Waldir]
2012-01-04 09:08:16 +00:00
Brion Vibber
344319f428 Revert r107773 - increases parsercache fragmentation without clear benefit 2012-01-03 21:20:35 +00:00
Alexandre Emsenhuber
9dbf69692c * (bug 32686) Tooltip on links to non-existing pages are now always in user's language
Fixed this by "abusing" of the $options parameter of Linker::link() to pass the Language object (as we did for wfMsgExt()), has the two following advantages:
* The tooltip is displayed in the requested language instead of depending on $wgLang
* The usage of the Language object is detected in the ParserOptions, thus the parser cache key will not have "*" for the language
2012-01-01 14:01:49 +00:00
Brian Wolff
770cd71b51 (bug 31469) Make sure tracking category messages expand variables like
{{NAMESPACE}} relative to the Title of the currently being parsed page.

Basically wfMsgForContent expands messages with wrong title while doing linksupdate stuff via job queue. For the broken file tracking category (r86534),Wikipedia folk want to sort the page into different categories based on namespace, and for some namespaces not categorize them at all (After all, a broken file link in a talk namespace is often not a bad thing).

Anyhow, explicitly set the title object for the message using wfMessage. There's probably deeper issues here in regards to why wfMsg et al is using wrong title, but this should fix the immediate issue.
2011-12-30 06:44:38 +00:00
Danny B
ff2ef8285a * (bug 23427) Introduced {{PAGEID}} variable to expose page.page_id [patch by Waldir] 2011-12-21 23:19:24 +00:00
Brion Vibber
c1906d53de Provisional revert r106573, r106559: may be the wrong thing to do, and should probably come with regression tests if added. 2011-12-20 21:24:06 +00:00
Robin Pepermans
e9033cbf82 Follow-up r106559: it's better to set the preference for own MediaWiki names in Language::getTranslatedLanguageNames. More consistent and saves some code :)
Also update Babel to use that function.
2011-12-18 17:58:47 +00:00
Robin Pepermans
8cae5ee72d Make the output consistent when no second parameter is given and second parameter equals first parameter. This gives preference to names defined in MediaWiki, but when it is not in MediaWiki, it also sees whether there is one defined in the translated language names. 2011-12-18 12:17:12 +00:00
Brian Wolff
4df8e9d595 Throw an exception if Parser::disableCache is called before mOutput initialized (Aka when not parsing something).
So far I've encountered 2 extensions that give fatal errors from calling $wgParser->disableOutput() from hooks that are called at points where parsing is not taking place! Exception with a backtrace is much nicer than "Fatal error: Call to a member function disableCache() on a non-object..."
2011-12-15 07:17:29 +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
Jeroen De Dauw
4544a78316 rem use of escapeLocalURL 2011-12-13 04:58:48 +00:00
Alexandre Emsenhuber
2629c3649f * Added revision's timestamp to OutputPage along with revision ID; avoid a DB hit in Skin::lastModified() when showing parser cache's content. This changed with the removal of $wgArticle in Skin since now it's a different WikiPage object and thus WikiPage::setTimetstamp() call is useless (but still kept).
* Added ParserOutput::(get|set)Timestamp() and the $mTimestamp member; avoid messing with isset()
2011-12-10 16:30:40 +00:00
Tim Starling
71e27e22de * Revert r103476, r105161 and implement the fix for bug 32858 (a.k.a. bug 32450) in WikiPage instead. See comment 14 for further rationale.
* Clarified release notes. Please write what the new code does, not the bug description.
2011-12-09 10:32:55 +00:00
Chad Horohoe
a1f5c6ce73 Minor tweaks to cleanSig(inSig)
* Make cleanSig public, since it's a declared entry point per class docs
* Make cleanSigInSig public static, added 2 more test cases for it
2011-12-06 23:07:13 +00:00
Antoine Musso
144ffcc01a allow bold in TOC lines
just like r102179 allowed italics in TOC lines for bug 26375, this
patch allow bold text as well.
2011-12-06 10:50:47 +00:00
Antoine Musso
7fc6a7aae0 Skip replaceInternalLinks2 for js/css pages
Just skip the whole replaceInternalLinks2 parser function whenever we hit
js/css pages. Previous patch r103476 only handled Category links which was
not enough.
2011-12-05 10:14:40 +00:00
John Du Hart
51a6eadec1 Followup r103817, updating setLang usages 2011-11-23 10:28:21 +00:00
Brion Vibber
d60063eac2 Revert r103795 -- adds <dws> pseudotag which modifies preprocessor behavior in some way to eat whitespace
Not sure whether this is something we want, but it should probably be talked over first.
2011-11-23 00:30:13 +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
Mark A. Hershberger
5bd4f88169 Fixes Bug 31865 - Tag <dws> for discarding whitespaces.
Patch with parser tests from Van de Bugger
2011-11-21 01:45:23 +00:00
Antoine Musso
78562bd14c (bug 32450) MediaWiki: .js|.css pages parsed [[Category:#]] links
This patch skip the [[Category:#]] parsing logic when the Title is in
NS_MEDIAWIKI and ends with .js or .css. This way the code is kept as is
and pages are no more categorized.

How to reproduce the issue:

	$ echo 'var foo = "[[Category:bug32450]]"' \
	| php maintenance/parse.php --title MediaWiki:Foobar.js
	<p>var foo = ""
	</p>
	$

Note how the text got stripped.

After this patch:

	$ echo 'var foo = "[[Category:bug32450]]"' \
	| php maintenance/parse.php --title MediaWiki:Foobar.js
	<p>var foo = "[[Category:bug32450]]"
	</p>
	$

TEST PLAN:
==========

$ php parserTests.php --quiet
This is MediaWiki version 1.19alpha (r103473).

Reading tests from "tests/parser/parserTests.txt"...
Reading tests from "tests/parser/extraParserTests.txt"...
Passed 654 of 654 tests (100%)... ALL TESTS PASSED!
$
2011-11-17 16:46:45 +00:00
Sam Reed
62491fef13 Comments, braces, explicit member variables
Remove a couple of unused variables
2011-11-16 13:22:03 +00:00
Sam Reed
2849f384d4 Bug 31995 - Addition of PPFrame::getTitle
Applied patch by Van de Bugger

Added documentation to go with

Added code to Preprocess_HipHop too
2011-11-09 20:52:24 +00:00
Platonides
528a450f68 Attempt to fix translatewiki bug 32057
The different Preprocessor::newChild expect false (with strict comparison) if there's no title passed to them.
2011-11-08 20:58:57 +00:00
Antoine Musso
30fc9f2913 update ParserCache debug message
"Found." was not very helpfull when indicating we found a cached
ParserOutput object.
2011-11-08 09:08:15 +00:00
Platonides
c77380f9c2 Bug 26375 - Italics should be passed to TOC
http://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_%28technical%29&oldid=403630551#Italics_in_ToC
2011-11-06 15:07:34 +00:00
Aaron Schulz
6c4360c951 Make use of Title::isSpecialPage() in various places 2011-11-02 20:55:08 +00:00
Platonides
dc38ecd003 Bug 31098: Template loop through MediaWiki: messages (int: function) not being detected.
The trick is not to replaceVariables() ourselves, but to leave that to the preprocessor,
which is then correctly detecting the loop.
2011-10-29 22:22:51 +00:00
Sam Reed
9d41b95053 Kill various unused variables
Comment some out also

Add some bits of documentation
2011-10-29 01:17:26 +00:00
Aaron Schulz
7377d6c080 Added pfunc profiling to braceSubstitution() 2011-10-27 21:53:37 +00:00
Platonides
d581e9dd5a Removal of unused globals 2011-10-27 20:48:09 +00:00
Aaron Schulz
9a932c4bc8 Fixed braceSubstitution() to only profile templates rather than all kinds of possibly long strings of text to parse. It was dumping the whole text as the name of the profiling entry. 2011-10-27 01:19:34 +00:00
Platonides
8d0c01d751 If the page contains __NOEDITSECTION__, it will never have edit sections, so don't create markers. Follow-up r99250.
Fix for bug 31647: Regression: __NOEDITSECTION__ is ignored when the page is read from the parser cache
2011-10-25 22:18:33 +00:00
Alexandre Emsenhuber
f05d7ee8ee Unstub $wgLang if still stubbed before storing it; avoid storing a StubUserLang instance in ParserOptions and errors when getting the object (per report of Lockal on IRC) 2011-10-25 18:14:30 +00:00
Alexandre Emsenhuber
0ba7a5f510 * (bug 31921) Fix for r78201: magic words REVISIONDAY, REVISIONMONTH and REVISIONYEAR now give current values on preview 2011-10-24 16:14:49 +00:00
Mark A. Hershberger
4bd08afcb7 Revert r100262 — wasn't the right place for it and other problems,
like broken parser tests.

Please read [[Manual:Pre-commit checklist]] before committing.
2011-10-19 20:01:50 +00:00
Mark A. Hershberger
fdb4ccd5d2 Give a clear error message instead of un-intelligible UNIQ.*QINU
markers.

Not sure the preg_match() is actually needed.  Or it may be
appropriate to use MARKER_SUFFIX for the match.

The error message may also need to be rewritten to be more
user-friendly, but I'm pretty sure *an* error message is friendlier
than UNIQ garbage.  And making them visible error messages makes them
easier to be found.
2011-10-19 19:34:56 +00:00
Alexandre Emsenhuber
d491ae56a7 Follow-up r100227:
* Missed one call to ParserOptions::getUserLang() in Parser
* Also convert RefreshLinksJob and RefreshLinksJob2 to use ParserOptions::newFromUserAndLang() and pass $wgContLang instead of whatever $wgLang could be
2011-10-19 15:30:02 +00:00
Alexandre Emsenhuber
bd548f36e9 * Changed ParserOptions to store a Language object instead of only a string, avoids object -> string -> object conversion
* ParserOptions::getUserLang() will still return a string for compatibility, added ParserOptions::getUserLangObj() to get the object
* Added ParserOptions::newFromUserAndLang() and ParserOptions::newFromContext() to easily get a ParserOptions object when a context is available or when someone wants to force the language
* Updated OutputPage and Preferences to use newFromContext() and WikiPage to use newFromUserAndLang()
* ParserOptions::setUserLang() still accepts either a string or a Language object, but changed the calls to pass an object instead of a string
* Changed Parser::getFunctionLang() to return the Language object from ParserOptions when parsing interface messages rather than $wgLang directly and updated the documentation to say that $wgLang should not be used directly (as $wgUser, $wgTitle and $wgRequest)
2011-10-19 14:16:01 +00:00
Sam Reed
27665d27ae Update some deprecated code
Documentation

Fix "/*" comments to "/**"

Flesh out some missing returns, change some return types
2011-10-14 21:18:38 +00:00
Platonides
924d12407e We don't need anything from the marker. The title is outside. 2011-10-07 21:05:22 +00:00
Platonides
570b984533 Forgot to commit this file in r99250. 2011-10-07 21:00:06 +00:00
Platonides
4d065bb19f Bug 31445: "Section edit links do not show"
Always generate the mw:editsection placeholders.
Remove them if not used.
Update the ParserOutput if fetching from ParserCache
2011-10-07 20:50:10 +00:00
Tim Starling
d6bae9f79c Fix for bug 31374: reintroduce recursive unstrip as in r27667, somehow omitted during the refactor in r82645. StripState::merge() is still wrong, but it's currently unused on Wikimedia, so this will do as a temporary patch. 2011-10-06 00:07:45 +00:00
Sam Reed
937fc3bcfd Back out r95396 and friends 2011-09-29 22:08:00 +00:00
Aaron Schulz
87c7cf57f8 FU r98412: added version to wfDeprecated call 2011-09-29 21:30:00 +00:00
Alexandre Emsenhuber
1e94b1be89 Per Aaron, follow-up r96859: add @deprecated comment, a wfDeprecated() and mark it for removal in next version since it's not used anywhere 2011-09-29 15:21:54 +00:00
Alexandre Emsenhuber
0a45e7dc76 Per Aaron, follow-up r93758: add coments and fix typos 2011-09-29 15:14:34 +00:00
Chad Horohoe
c7e950e474 Also add $wgRequest to the forbidden globals...thought it was common sense. 2011-09-27 18:56:44 +00:00
Roan Kattouw
dc4ab75a51 Fix stupid typo in r98193, thanks Dantman 2011-09-26 23:16:32 +00:00
Roan Kattouw
95e857198b (bug 31176) {{SERVERNAME}} doesn't play nice with protocol-relative URLs 2011-09-26 23:14:20 +00:00