Commit graph

47 commits

Author SHA1 Message Date
Niklas Laxström
c49610741d Added LinkCache::addGoodLinkObjFromRow, since addGoodLinkObj is not going to work much longer when new parameters are added 2011-09-20 15:19:18 +00:00
Sam Reed
ba2c3a793d And even more documentation in various files 2011-05-29 14:25:20 +00:00
Siebrand Mazeland
75c6696aa8 Use consistent notation for "@todo FIXME". Should update http://svn.wikimedia.org/doc/todo.html nicely. 2011-05-17 22:03:20 +00:00
Sam Reed
5db2450c55 Documentation
Remove unused variables
2011-05-04 21:23:25 +00:00
Sam Reed
8e80b8c3c1 Tidy up some unused variables and such 2011-04-23 21:40:52 +00:00
Happy-melon
38475c650b Clean up some direct $db->query($sql) calls. Remove limit/offset parameters from Article::getContributors() as they weren't being used anywhere and probably didn't work properly anyway. 2011-04-12 12:09:11 +00:00
Daniel Friesen
e844afb09c Followup r85244; Define all methods as static, implement a DummyLinker to forward calls for passing to hooks and finish off anything in the way. 2011-04-03 12:04:04 +00:00
Alexandre Emsenhuber
f89b1e3238 Removed usage of extract() in LinkHolderArray::doVariants() 2011-03-16 09:05:32 +00:00
Alexandre Emsenhuber
b974497da8 Changed LinkHolderArray::makeHolder() to use Linker::link() instead of Linker::makeBrokenLinkObj() and Linker::makeColouredLinkObj() 2011-03-15 16:47:55 +00:00
Tim Starling
be3710c312 Fixes for r82645:
* Fixed several obvious bugs in the $wgCiteCacheReferences helper functions, missed due to inadequate testing.
* Don't save complete Title objects to memcached, they contain cached data with a short lifetime.
* Fixed a doc comment.
2011-02-23 23:42:04 +00:00
Tim Starling
a20350dd31 * Rewrote StripState to not use ReplacementArray. The memory usage of FSS was excessive when there were many (>10k) strip items. I used preg_replace_callback(), which is slower than strtr() in the simplest case, but much faster than it when the markers have different lengths, which they usually do.
* It was not necessary to preserve the $stripState->general->setPair() interface since it wasn't used by any extensions.
* Moved StripState to its own file.
* Refactored serialiseHalfParsedText() and unserialiseHalfParsedText() so that the bulk of the functionality is in the relevant modules, instead of using scary direct access to object member variables. Made it support the new StripState. It seemed like a lot of work to go to to support an "emergency optimisation" feature in Cite. Cite updates will be in a subsequent commit.
* Fixed spelling of serialiseHalfParsedText() and unserialiseHalfParsedText(), there is unavoidable interface breakage anyway, due to cache object versioning. 
* Moved transparent tags to their own function, as requested in a fixme comment.
* Added documentation for markerSkipCallback().
* Removed OnlyIncludeReplacer, unused since MW 1.12.
2011-02-23 06:58:15 +00:00
Alexandre Emsenhuber
19f1eccc53 Per Platonides; follow-up r78201: add "stubthreshold" to ParserOptions; also provides a proper fix to r81765 2011-02-20 15:03:25 +00:00
Sam Reed
7d98280f3e More function and variable documentation 2011-02-19 01:02:56 +00:00
Mark A. Hershberger
b4cee86beb w/s fixups 2011-02-12 04:06:22 +00:00
Sam Reed
da3b3fbae4 More return type documentation 2011-02-08 23:18:13 +00:00
Sam Reed
13c42dc573 Couple more raw SQL to query arrays 2011-01-24 23:15:10 +00:00
Alexandre Emsenhuber
510309e4ab * (bug 19006) {{REVISIONUSER}} no longer acts like {{CURRENTUSER}} in some cases
* Removed other usages of $wgUser in Parser stuff, as stated in doc
* Added mechanism to get an User object in Parser, based either on the object given in Paser::preSaveTransform() or the ParserOptions otherwise
2010-12-10 18:17:20 +00:00
Sam Reed
50b04942e4 Remove some unused variables and globals 2010-11-28 16:13:13 +00:00
Sam Reed
cadc951d15 More reversion of r77297, 1 of 2 commits to keep it readable in CR (hopefully) 2010-11-25 22:24:11 +00:00
Antoine Musso
6fe29c9c30 revert r76464
* mixed style changes and variable removing
* logic changes
* useful comments removed
2010-11-25 20:01:34 +00:00
Sam Reed
10ecfeb03b Various unused variables, add some braces
Explicitally define some variables used in hook type calls
2010-11-10 19:49:04 +00:00
Sam Reed
a2589ff8c6 Assignment in loop conditions suck
while ( $row = $dbw->fetchObject( $res ) ) { to foreach ( $res as $row ) in includes

Add some braces
2010-10-13 23:11:40 +00:00
Sam Reed
9b52cb83b1 Add some $retval = '' before some wfShellExec 2010-09-02 22:15:20 +00:00
Niklas Laxström
c8e109f003 Avoid stupid queries in LinkHolderArray
Title::isAlwaysKnown will return true for all existing special pages, so the rest don't exists
2010-08-30 18:16:43 +00:00
Philip Tzou
0f6c992519 follow up r69134. Change all of convertLinkToAllVariants()'s callers to call autoConvertToAllVariants(). 2010-08-23 02:07:31 +00:00
Alexandre Emsenhuber
dc50e1a4bf * Added file description headers
* Added @file where needed
2010-08-22 14:31:05 +00:00
Platonides
a72332929c getSkin() should get a Title as parameter. 2010-08-11 17:11:24 +00:00
Platonides
121bb4f03e http://www.mediawiki.org/wiki/User:Catrope/Stub_threshold shows us people setting it to insanely large values trying to disable it.
r70433 addressed the UI. Here we proxy its access via a new method getStubThreshold() that disables it if a page of such size cannot be 
created (by an user), so we can serve them parser cached articles again.
2010-08-03 22:32:09 +00:00
Philip Tzou
3b4731f5fa Follow up r69874. Fix the separation markup. 2010-07-26 16:09:06 +00:00
Philip Tzou
0e8a01a205 follow up r69874. use string instead of object . 2010-07-25 16:59:32 +00:00
Philip Tzou
6c087a5fed Performance improvement: in doVariants(), concatenate a bulk of titles to a single string, thus we just need to call convertLinkToAllVariants() once. 2010-07-25 16:53:55 +00:00
Platonides
b81bae03d0 Add page_latest to the LinkCache. 2010-06-15 12:14:54 +00:00
ThomasV
a1d810ee7e patch for bug 22981 : pass cached links to the extension hook too. 2010-06-14 13:22:21 +00:00
Alexandre Emsenhuber
1ec45bef2e Fixed some doxygen warnings 2010-06-09 14:57:59 +00:00
Brion Vibber
e1d1404372 Cleanup for bugs in r65104 (iwlinks table), that'll teach me not to commit at 4am after drinking with the wikimedia devs! 2010-04-18 00:39:12 +00:00
Brion Vibber
8eac509ab5 * (bug 14473) Add iwlinks table to track inline interwiki link usage
Like langlinks, this stores the interwiki prefix (as iwl_prefix) and full page title (as iwl_title), attached to the page doing the liking (as iwl_from -> page_id).
Unlike langlinks, there can be multiple entries stored per interwiki prefix.

Updater to add the table confirmed on MySQL, untested on SQLite but should work.
Someone may still need to add and test a PostgreSQL updater.

Refactored makeWhereFrom2d() out of LinkBatch to Database so it could be re-used for the similar mapping for the interwiki links, which need a string prefix rather than an int namespace key.
Also cleaned it up internally to reuse existing code for building where clauses from arrays. (Tim & Domas -- if the previous more verbose code was there to reduce function call and array processing overhead on very large link lists, feel free to unroll it again if the difference is measurable. Just swap the var names around from the old LinkBatch code and escape the base key value if it's not an integer, it'll be functionally equivalent.)
2010-04-16 01:40:05 +00:00
Siebrand Mazeland
30ea75c648 * replace deprecated makeBrokenLinkObj() by LinkHolderArray.php()
* replace deprecated makeKnownLink() by linkKnown()
* add FIXME where I was not able to.

Linking to r51559 for code review
2009-06-13 12:39:00 +00:00
Siebrand Mazeland
055fcbd7cb * replace use of deprecated makeLinkObj() by link() in core
* add FIXME where makeLinkObj was used in documentation
2009-06-06 15:45:43 +00:00
Ilmari Karonen
7f71d9e38f followup to r44520: simplify various bits by removing checks now made redundant 2008-12-13 04:14:40 +00:00
Tim Starling
b9a94aefa5 * Fix bug 15344. Was caused by the overwrite of $entry, assigned by reference to the last link and then overwritten in later code.
* Split doVariants() out from replaceInternal(), big functions are prone to variable reuse bugs
2008-08-28 05:22:17 +00:00
Tim Starling
350b498b9f * Revert back to my parser pseudo-branch again. Note: if you feel like reverting this, reverting Parser.php alone to r40010 will work just fine.
* Merged replaceFreeExternalLinks() with doMagicLinks(). Makes a lot of sense, very similar operations, doesn't break any parser tests. Stops free links from interacting with other parser stages, the same way ISBN links don't. 
* The pass order change fixes Brion's complaint in r39980. Early link expansion, triggered by having more than 1000 links in the page, was outputting URLs which were destroyed by RFEL. Added parser test.
* Fixed an unrelated bug in LinkHolderArray::replace(): if a link to a redirect appears in two separate RLH calls, the second and subsequent calls do not add the mw-redirect class. Caused by an unmigrated LinkCache fetch.
* Added a parser test for a pass interaction bug that the pass order change fixes.
* The fuzzer told me to tell you that free external links in non-caption image parameters, which are and have always been invisible, are now not registered either.
* Miscellaneous supporting updates to the test infrastructure.
2008-08-26 14:37:15 +00:00
Brion Vibber
c83882e96e Revert r39949 "* Revert revert r39662 of my parser changes."
Causes weird regressions on http://meta.wikimedia.org/wiki/Talk:Spam_blacklist
Couldn't isolate to a parser test in a few minutes; some kind of template interaction perhaps.

Sample bad HTML like:
The associated page is used by the Mediawiki <a href="&lt;a href=" class="external free" title="http://www.mediawiki.org/wiki/Extension:SpamBlacklist" rel="nofollow">http://www.mediawiki.org/wiki/Extension:SpamBlacklist</a>" class="extiw" title="mw:Extension:SpamBlacklist"&gt;Spam Blacklist extension, and lists strings of text that may not be used in URLs in any page in Wikimedia Foundation projects (as well as many external wikis). Any meta <a href="/wiki/Administrator" title="Administrator">administrator</a> can edit the spam blacklist. There is also a more aggressive way to block spamming through direct use of <a href="/wiki/Anti-spam_features#.24wgSpamRegex" title="Anti-spam features">$wgSpamRegex</a>. Only <a href="/wiki/Developers" title="Developers" class="mw-redirect">developers</a> can make changes to $wgSpamRegex, and its use is to be avoided whenever possible.
2008-08-25 22:19:50 +00:00
Aaron Schulz
e75cafabd8 this looks backwards 2008-08-25 20:57:19 +00:00
Tim Starling
ccacba9f3a * Revert revert r39662 of my parser changes.
* Fixed image link whitespace handling (Brion's complaint, r39662)
* Added fuzz test capability to parserTests.php
* Added __destruct() functions to Parser and Language, and called them explicitly from parserTests.inc, to avoid unconstrained memory usage during fuzz testing.
* Added unified diff to output of Parser_DiffTest
* Fixed whitespace change in Parser::doTableStuff() (found by fuzzing)
* Added feature to RELEASE-NOTES which I'd committed last time but forgotten to note: <gallery> will accept image names with no "Image:" prefix (rediscovered by fuzzing)
* Limit memory usage in Title::getInterwikiLink()
* Fixed chronic fail of all interwiki link parser tests (hid Siebrand's complaint, r39464)
* Fixed chronic fail of one of the LanguageConverter parser tests. Was actually an ignored bug.
2008-08-25 16:08:19 +00:00
Fran Rogers
3ad5bfb749 Fix for problems with r39414; LinkHolderArray::replaceInterwiki() was badly broken 2008-08-16 10:13:35 +00:00
Siebrand Mazeland
2dedbbdfa1 Revert r39414. Breaks processing links like [[:wikipedia:nl:User:Siebrand|Dutch language Wikipedia]]. It will add a comment like "<!--IWLINK 0-->" in the HTML output. Happens even if there is one such link on a page. 2008-08-16 09:33:11 +00:00
Tim Starling
c45292ac40 * In the parser: do link existence tests in batches of 1000. Avoids using excessive memory to store Title objects.
* Split link placeholder/replacement handling into a separate object, LinkHolderArray.
* Remove Title objects from LinkCache, they apparently weren't being used at all. Same unconstrained memory usage as the former $parser->mLinkHolders.
* Introduced ExplodeIterator -- a workalike for explode() which doesn't use a significant amount of memory
* Introduced StringUtils::explode() -- select whether to use the simulated or native explode() depending on how many items there are
* Migrated most instances of explode() in Parser.php to StringUtils::explode()
* Renamed some variables in Parser::doBlockLevels()
* In Parser.php: $fname => __METHOD__, Parser => self/__CLASS__, to support Parser_DiffTest more easily
* Doc update in includes/MessageCache.php for r39412
* MW_TITLECACHE_MAX => Title::CACHE_MAX, nicer name, easier to access from another module
2008-08-15 16:35:03 +00:00