Commit graph

255 commits

Author SHA1 Message Date
Max Semenik
f4ad20c1d4 Instrument diff timing
Bug: T128697
Change-Id: I748286abac025092abc33b3b7b8a0d3dabafdd25
2016-03-04 15:06:48 -08:00
Max Semenik
44ed77c07e Don't treat configured but absent engine as executable
E.g. if you have $wgExternalDiffEngine = 'wikidiff2' but after
a PHP update you no longer have the module you still shouldn't attempt
to shell out to some nonexistent wikidiff2.

Bug: T74030
Change-Id: I745cd1cb2e152f4fbb95c8f782d70117f8c844f1
2016-03-04 15:06:39 -08:00
Max Semenik
356aea3ab6 Ditch support for original wikidiff
It's been unmaintained for a while and does not support
various languages adequately.
Also, document $wgExternalDiffEngine.

Change-Id: Ia8aeffd79d550fb7a1a7121456940446eea8bd4f
2016-03-04 12:47:59 -08:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Aashaka Shah
124026a712 Add IContextSource as parameter to ChangeTags::formatSummaryRow
Using IContextSource avoids the use of $wgLang and wfMessage which make
use of global $wgTtle.

Add IContextSource as parameter to ChangeTags::formatSummaryRow to avoid
globals. Define an IContextSource instance in all functions which
reference ChangeTags::formatSummaryRow and pass it in ChangeTags::formatSummaryRow
function call.

Also make the default value of IContextSource $context as null in
parameter, to avoid breaking changes for old callers in extensions.

Document default null value of IContextSource and add a @note to prefer
IContextSource over null value.

Remove trailing whitespace, and make code order according to parameter
order.

Bug: T105648
Change-Id: Ib54a6a96b73f6cd8fcdf8e520db2448a1e811cfa
2016-02-04 23:32:24 +05:30
Chad Horohoe
3f7ecb4027 WebRequest::appendQuery*() functions no longer take $onlyquery
Deprecated since 1.25, unused anywhere

Change-Id: I52224635cfeaf4748abeaa07b0c92e7f452fa93f
2016-01-06 15:15:10 -08:00
Florian
d52fc330ff diff: Make DifferenceEngine patrol link creation more flexible
* Move the main logic from DifferenceEngine::markPatrolledLink() to
  DifferenceEngine::getMarkPatrolledLinkInfo(). Returning an array of
  information instead of a complete HTML string.

Bug: T101491
Change-Id: Id09ccf60aec9b693d7df648a6dfcde629545f620
2015-12-23 00:17:08 +00:00
Timo Tijhof
b1e3f9e38d Don't trigger 'wikipage.diff' hook for content that looks like a diff
Follows-up 9cfb9cb9fb, and b62f0e9156.

Add data-mw="interface" to elements created by the interface
(e.g. not user-generated content) and use this to narrow down
scope of elements eligible for JavaScript binding.

This avoids bugs where e.g. the diff hook triggers on a wiki page about diffs.
This isn't a security issue per-se, but causing odd behaviour.

Also add missing tests for data-ooui filtering (follows-up aa9a52da).

Change-Id: I9a0c86c92d411538bd9e203ec6ae54616fdf49b8
2015-12-15 16:29:58 -08:00
cenarium
68692ebb69 Add user and previous rev to HistoryRevisionTools, and user to DiffRevisionTools
The next revision in the page history isn't necessarily the previous
revision (due to selective undeletions, history merges, etc). This
passes the next revision to HistoryRevisionTools so extensions can check
if needed. Also, it passes the user to this hook and DiffRevisionTools
to avoid use of wgUser or having to retrieve context.

Change-Id: Ibc68f19040eebe3614e07f753f26bbfd376ae28d
2015-12-14 00:35:59 +00:00
Aaron Schulz
4f781c7bf9 Convert some users to WANObjectCache for consistency
These callers don't need to do purges, but can still perfectly
take advantage of this instance over a plain BagOStuff. Namely:
* Replication and snapshot lag awareness
* Preemptive regeneration
* Easy process cache support

The idea is for there to only be one caching class/factory
to use, instead of having rules for picking which one to use.

Change-Id: I8e362df451c0c28731fc853c044c4c4b8e097f01
2015-10-19 16:46:52 +00:00
Aaron Schulz
39ad19a671 Removed $options from RecentChange::newFromConds
* The FORCE INDEX statements are not needed

Change-Id: Ia6f386140e88ad01fc35a10b00dbcb0d1eb934ea
2015-09-29 10:31:55 -07:00
umherirrender
70f3afd548 Remove unneeded empty lines at begin of if/else/foreach body
An if body must not begin with an empty line

Change-Id: I62b058be337fcc85a120fcd3dadce564db59a271
2015-06-19 20:05:45 +02:00
Vivek Ghaisas
9f5b6f5aeb Fix whitespace issues around parentheses
Fix issues found by MediaWiki.WhiteSpace.SpaceyParenthesis sniff.

Bug: T102617
Change-Id: Iec7f71e64081659fba373ec20d9d2006306a98f4
2015-06-16 22:14:02 +03:00
Ori Livneh
b31e567b78 hierarchicalize(!) stat names
Graphite expects name components to be dot-separated, so our habit of using
dashes doesn't really make sense. Change metric names to be more compatible
with Graphite, except the job queue's, since that will require a gdash
dashboard definition migration.

Change-Id: I77d0ff7606a8fc88434e4352d23415a9a8f4725a
2015-06-03 16:27:13 -07:00
Ebrahim Byagowi
fd53351456 i18n: Apply lang on UI messages on diff table
Change-Id: Ib37e4f9115e935fa60b461c2fcc36047fe4c9dc6
2015-04-18 08:56:01 +00:00
Aaron Schulz
4d58457784 Added slave/master fallback logic in Revision
* This is a more specific form of the logic removed in 3c2bc32ae1.
  It does not suffer the problem of causing constant master DB
  queries due to a bad template reference or such.
* It will use the master if writes from the current thread
  are pending or were recently committed. This deals with the
  common problem of code that needs to read things it just wrote,
  such as diffs on rollback or edit hooks.
* This commit reverts 8624e261f by making the hack obsolete.

Bug: T93866
Bug: T94407
Change-Id: Ib9ecb75e1236e767bdc86d124d5e22a03ae0fb5f
2015-03-31 23:39:28 +00:00
Marius Hoch
8624e261f0 Fallback to read from master in DifferenceEngine::loadRevisionData
In DifferenceEngine we need to show a diff immediately after
an edit happened if someone did a rollback. To make that work
again, try loading a revision from master if we have more than
one database servers and we failed loading the revision from
a slave.

Change-Id: I08a16faa9e637c614c6d2fc9a10536c7b41685a8
Follows: 3c2bc32ae1
Bug: T93866
2015-03-25 16:09:21 +01:00
jenkins-bot
579d6e7555 Merge "Add anchor "mw-oldid" for beginning of page content in diff view" 2015-03-04 10:22:58 +00:00
Federico Leva
1bdfef2d26 Add anchor "mw-oldid" for beginning of page content in diff view
* #top, #mw-content-text and others exist, but all point to the
  beginning of the diff, not of the actual page content.
* Pick mw- prefix and technical but familiar related name, in
  the hope it's not confusing nor too hard to remember.
* Lowercase letters, similar to #top, #footer, #file etc. were also
  considered and discard, inspired to usual names:
  https://www.wikidata.org/wiki/Q10966628

Bug: T4313
Change-Id: Ia90f2541327480535e9943ac30bfa19791a19620
2015-03-04 10:09:36 +00:00
jenkins-bot
61b2f07f6b Merge "Add hook for custom difference engine (WikEdDiff)" 2015-02-23 12:32:10 +00:00
umherirrender
75e3d29506 Pass user to Title::quickUserCan in DifferenceEngine
Change-Id: I2e984a51b7ad357a08ed1827b76f7f9803785cfc
2015-01-29 16:46:28 +01:00
Ricordisamoa
4ece7f53aa Revision: mark getRaw*() methods as deprecated
Revision->getRawUser()
=> Revision->getUser( Revision::RAW )

   Revision->getRawUserText()
=> Revision->getUserText( Revision::RAW )

   Revision->getRawComment()
=> Revision->getComment( Revision::RAW )

The body of Revision->getRawUserText() has been moved
into Revision->getUserText().
Every usage has been replaced.

Change-Id: Ic6fbfbc0507dcf88072fcb2a2e2364ae1436dce7
2015-01-18 06:57:56 +01:00
Niklas Laxström
80ca508ed1 Add User::equals
Seems stupid omission. Title has one. Why do I need to think how
to determine how to users objects point to the same user. Allows
more expressive code.

Also fixes a bug in multiple places where users "0" and "00" were
considered equal.

Change-Id: I682392e564b332b77ab489f2ad394fa2d28098a5
2015-01-13 15:04:45 +01:00
Aaron Schulz
4ff8136807 Removed remaining profile calls
Change-Id: I31c81c78715048004fc8fca0f27d09c1fa71c118
2015-01-08 02:49:33 -08: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
Niklas Laxström
4741900b5e Escape unescaped messages shown on a diff page
Change-Id: I05c07625a2dbb3c5d3ab46d1cfafeaed6a248bba
2014-12-18 20:01:32 +00: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
cacycle@gerrit.wikimedia.org
ef55b2c7b5 Add hook for custom difference engine (WikEdDiff)
The new Extension:WikEdDiff is a custom inline difference engine.
There is currently no hook to integrate custom difference engines.
This patch adds a new hook called 'GetDifferenceEngine' in
/includes/content/ContentHandler.php in function
'createDifferenceEngine()'.

Passed variables:
$context: IContextSource context to be used for diff
$old: Revision ID to show and diff with
$new: Either a revision ID or one of the strings 'cur', 'prev' or 'next'
$refreshCache: If set, refreshes the diff cache
$unhide: If set, allow viewing deleted revs
&$differenceEngine: output parameter, difference engine object to be used
for diff

If the hook handler returns false, a valid difference engine object is
returned in the passed-by-reference variable $differenceEngine.
If the handler returns true, the default engine is used as fallback.

The specified diff engine class will typically be an extension of the
class DifferenceEngine (includes/diff/DifferenceEngine.php) with
modifications, e.g. of function generateTextDiffBody() and
__construct() (without deprecated parameter $rcid).

Also fixes a missing declaration in DifferenceEngine that is required for
extending this class.

Bug: 71916
Change-Id: I9da63c1ceb339bfeba7beddc712be51977b95f65
2014-11-13 18:02:29 +00:00
Ebrahim Byagowi
36372030d4 i18n: Use native digits on 'difference-missing-revision'
Change-Id: I19cd68562690c4ab8b077681d0f3d18d4286a5cd
2014-09-26 19:53:59 +00:00
Daniel Evans
6c2262319b add mw-diff-* classes to view diff page header links
Wrap links in page revision diff header with classes like page revision history
entry links.

Bug: 44242
Change-Id: I0066827bd57c2d40b4b8bd5634cb46c5ce306f28
2014-08-16 01:21:39 +01:00
umherirrender
3b2b6a2773 Add missing @param to function docs
Change-Id: I47fa96a976f55a1a93cb75397285edb8c7f4cd8a
2014-08-14 20:22:52 +02:00
umherirrender
02dc9da399 Cleanup some docs (includes/[a-d])
- 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: I7b65fe04db431342cc58b469dc48f41a50c4e891
2014-07-24 19:42:45 +02:00
umherirrender
abfa0d7854 Standardize @todo
Always use lowercase @todo
Changed some "@FIXME" to "@todo FIXME: "

Change-Id: I016d1f9511e6f3bbd22427f0fffeccd77ab5e0db
2014-07-23 22:27:20 +02:00
Bartosz Dziewoński
108d4aa2ba Article: Add RL modules for the ParserOutput when showing CSS/JS page
It previously added only the page HTML, which meant that ResourceLoader
modules associated with the page and other metadata was lost. This
affected the new way of doing things in SyntaxHighlight (Idf4ad439).

We still do not show categories, language links and other things
on the pages (although internally they behave just like in wikitext)

Also needs a fix in DifferenceEngine because our code sucks so much.

Bug: 64859
Change-Id: I5867985693b27ccc9195fddde8b922e67463e836
2014-06-20 19:48:25 +00:00
Krinkle
811a6172b3 Merge "Removed unneeded spaces and colons in @param and friends" 2014-04-08 18:05:38 +00: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
Aaron Schulz
57731929ab Added limit to countRevisionsBetween() for sanity
* This was causing dozens of DB query timeout errors at WMF

Change-Id: Ie51a491ff5d22c2d84934e83d4b3f690c9dbd595
2014-04-07 15:18:19 -07:00
umherirrender
23fab68274 Fix spacing after @param and friends in comments
Searched for:
\@(param|return|throws|since|deprecated|access|todo|var)[ \t]{2,}

Change-Id: Icce22ba9fe0635455691ca58d9872d618151f346
2014-04-05 20:02:29 +00:00
aude
6a5c9bd28b Add visibility to DifferenceEngine methods
Change-Id: I415719442ca1778be36f173067d4b090fbe9265a
2014-03-06 15:34:51 +01:00
Thiemo Mättig
6806400129 Added and updated Doxygen comments in content handler and diff namespaces
Reasons for touching this are:
* "@param type $var" were mixed in a lot of places. Both works but the
  MediaWiki coding conventions suggest that specific order.
* Things like String and Bool aren't objects and shouldn't be uppercase.
* Tried to fill missing types in "@param $var".
* Tried to fill missing descriptions in "@return type" when I could.
* Removed duplicate descriptions if a @see is sufficend.
* Removed useless descriptions ("isUsefull returns true if usefull").
* Removed useless @return void.
* Replaces mixed[] with array (does have the exact same meaning).
* Tried to find better replacements for "varargs", phpDocumentor
  suggest $var,...
* Order should be @since, @param, @throws, @return, @see. This is the
  order Doxygen renders this.

There is always more to do but I think this is already much better
than before. Please feel free to put more change sets on top of mine
or request more changes by adding comments.

Change-Id: I05262ce06caabf79f68772302524ac91bbead1c6
2014-03-06 11:17:41 +01:00
Siebrand Mazeland
f077c4b1d6 Update formatting
Change-Id: I18aff576262479c9bb1c56eb8e1d1aaae200e4b1
2014-02-06 09:27:05 +01:00
jenkins-bot
1f84a574e3 Merge "Improve clarity of diff-multi message" 2014-01-31 17:24:00 +00:00
jenkins-bot
f726bbf6e7 Merge "Add oldRev parameter to DiffRevisionTools hook" 2014-01-29 01:44:01 +00:00
Jackmcbarn
25b83169c8 Add oldRev parameter to DiffRevisionTools hook
Add a third parameter to the DiffRevisionTools hook, containing the old
revision.

Bug: 57721
Change-Id: I6ee956c5b9901033f618d7e4d09f8f416f3d72cb
2014-01-28 20:43:55 -05:00
Jackmcbarn
874fed9306 Improve clarity of diff-multi message
When one user has made all of the intermediate revisions in a diff,
make it clear whether or not this is the same user that made the
latest revision.

Bug: 59833
Change-Id: I7db9a02ae8bc7a8e092fcdc257b5e17595de02b4
2014-01-09 10:10:35 -05:00
Brad Jorsch
d8b1b79ea4 Move redirect rendering into WikitextContent
There's no good reason for everything that wants to render a page to
have to test whether the page is a redirect and then call
Article::viewRedirect to get the fancy rendering instead of using the
ParserOutput. This logic can easily be moved into
WikitextContent::getParserOutput so callers can just use the
returned ParserOutput.

At the same time, we can handle "#REDIRECT [[File:Foo]]" and
"#REDIRECT [[Category:Foo]]" the way people expect, by recording the
link in pagelinks rather than imagelinks/categorylinks (although this
means fixing ImagePage's bug about assuming anything in imagelinks that
is a redirect is a redirect to the image too).

And we can finally fix bug 14323, too.

Bug: 14323
Bug: 17259
Bug: 27621
Bug: 42642
Bug: 50488
Change-Id: Id44d566a7ca35a1b9579d0c0e947877c980b0686
Followup: I1c7582d1bf7ec4184a45b00154e3dd5b39dd444b
Followup: I3653b608941813a73281f4f0545bea2487d43964
2014-01-07 09:18:22 -05:00
Siebrand Mazeland
9cd43cd01a Replace inline tab with space
Spotted by Umherirrender in
https://gerrit.wikimedia.org/r/#/c/96554/1/includes/diff/DifferenceEngine.php

Change-Id: I363a3299d61e2cfb7c31db9c293a2c7e73fcef44
2013-11-21 18:32:38 +00:00
Siebrand Mazeland
c13d478e9b Break long lines in includes/diff/
Change-Id: I778079edb147623f54f6140e11e25120b04c382e
2013-11-20 20:22:36 +01:00
Siebrand Mazeland
abefd2c07e Update formatting for includes/diff
Change-Id: Id032a32ca6ebea3daf5313a05602c5e98603d983
2013-11-20 20:11:57 +01:00
Siebrand
60fa0e1c3b Revert "DifferenceEngine cleanup"
This reverts commit 1f423cc609.

Change-Id: I2254eb37376063a081ad89481654b735fb0360b1
2013-11-11 16:35:19 +00:00