Commit graph

289 commits

Author SHA1 Message Date
Yuri Astrakhan
02015d0e63 Document diff/DifferenceEngine.php function
Change-Id: I999824d8ce569de93fe4c9a889edea582d07611c
2016-10-30 20:26:08 -04:00
Kunal Mehta
a7de5b0b7c Improve deprecation comment for MW_DIFF_VERSION
IDEs will now recognize it as deprecated.

Change-Id: Iac96449fb204a1e4b1e707138b3f0b5697bdfab4
2016-10-15 05:57:36 +00:00
Reedy
8a29a56fb1 Make ShowRawCssJs hook emit deprecated warnings
Bug: T147392
Change-Id: Iae3b1532a91a9bf545a0a3c8df1df5e59b4974db
2016-10-06 14:44:57 +01:00
Reedy
dee0d1ce4e Mark 3 hooks deprecated by ContentHandler as such
ArticleViewCustom, EditPageGetDiffText and EditPageGetPreviewText hooks
now marked as deprecated in 1.21.

TitleIsCssOrJsPage and TitleIsWikitextPage deprecation version dropped
from 1.25 to 1.21 to match other hooks.

Bug: T145728
Bug: T147382
Bug: T147383
Bug: T147384
Bug: T147385
Bug: T147386
Change-Id: I59b6b9f253857eb1040dad879a71e0d8cf141553
2016-10-05 23:41:14 +00:00
jenkins-bot
7e350ba150 Merge "Rename mediawiki.action.history.diff to mediawiki.diff.styles" 2016-09-06 15:56:17 +00:00
Leszek Manicki
a6b402c1c3 Rename mediawiki.action.history.diff to mediawiki.diff.styles
Diff is not shown on action=history, so the name was not valid.
This module contains only styles, so let's make it explicit in its name too.

mediawiki.action.history.diff module is temporarily left for
backwards compatibility. It should be removed when no longer used.

This also renames docs/uidesign/mediawiki.action.history.diff.html
to docs/uidesign/mediawiki.diff.html.

Change-Id: I7ecc08417c5f1870ed6f2ca139fd953d68f6ec8e
2016-09-06 11:11:33 +02:00
Aaron Schulz
950cf6016c Rename DB_SLAVE constant to DB_REPLICA
This is more consistent with LoadBalancer, modern, and inclusive
of master/master mysql, NDB cluster, and MariaDB galera cluster.

The old constant is an alias now.

Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
2016-09-05 22:55:53 -07:00
jenkins-bot
501d34c599 Merge "Revert "Move CSS for patrol from mediawiki.legacy to new module mediawiki.page.patrol"" 2016-08-11 23:05:06 +00:00
Bartosz Dziewoński
7cea81b8ff Revert "Move CSS for patrol from mediawiki.legacy to new module mediawiki.page.patrol"
This reverts commit e9f896d6a5.

Bug: T142750
Change-Id: Idb815d64d795d790ea2c07f2b5188ea5a46bfefb
2016-08-11 22:54:54 +00:00
jenkins-bot
3e9d53bfad Merge "Adding a bunch of hooks from wikiHow into DifferenceEngine, 2nd try" 2016-08-08 16:30:59 +00:00
Fomafix
e9f896d6a5 Move CSS for patrol from mediawiki.legacy to new module mediawiki.page.patrol
Also change the selector from
	div.patrollink
to
	.patrollink

Bug: T89981
Change-Id: Ib79d17fab61b1a7b940b2acff6d19a58a3fe0bc9
2016-08-06 13:46:47 +00:00
Florian
c35d1ce205 Remove DifferenceEngine::generateDiffBody()
Bug: T122754
Change-Id: Iedd319fa5e7b7218ee5341f18f31a8f1101b5eee
2016-08-01 00:37:25 +02:00
Reedy
58ea3e0902 MW_DIFF_VERSION is globally defined, drop MW_ prefix when used as
the class constant

Bug: T141272
Change-Id: I0a9e9037b2259515df6366184cc781ecb78f424c
2016-07-25 17:36:35 +01:00
Chad Horohoe
e0d2d91ef8 DifferenceEngine: Move MW_DIFF_VERSION to class constant DIFF_VERSION
Deprecated the former. It's only used in 2 extensions (both active),
so we can probably get rid of this within a single release cycle.

Change-Id: I39bef62556f8f0625a5741d54f9f84d15b50610d
2016-07-22 17:38:43 +00:00
Seb35
ff397feea8 Handle the default value of $wgExternalDiffEngine without warning
The default value (false) was not handled by the recent depreciation warnings
in 037f056, and was triggering the last warning. This removes this warning.

Change-Id: If7fe92d874eb10525a72f6d3a97f00117c79acc1
2016-07-09 10:07:49 +02:00
Jack Phoenix
03dfe2c3be Adding a bunch of hooks from wikiHow into DifferenceEngine, 2nd try
Now with less fatals and more functionality! At least I sure hope so.

Unlike the first time around (https://gerrit.wikimedia.org/r/206642), the
DifferenceEngineRenderRevisionAddParserOutput and
DifferenceEngineShowEmptyOldContent hooks now only affect things if a
hooked function returns false. Since by default nothing is hooked into
these brand new hooks, the behavior should stay exactly the same as before
this patch and things like bug T139435 shouldn't happen anymore.

These hooks allow things such as:
* adding CSS(/JS) into the OutputPage when viewing diffs
* adding extra HTML content (such as avatars) into diff views
* hiding the bottom "mark as patrolled" link
* altering the parser output that is used by DifferenceEngine
* and more

Example extension using these hooks is wikiHow's
/extensions/wikihow/hooks/, specifically the file DiffHooks.php (but the
hooks are setup in WikihowHooks.php).

Live example of the DiffHooks stuff in action can be found at wikiHow.com,
for example:
http://www.wikihow.com/index.php?title=Set-Your-Homepage&diff=17112892&oldid=15888129
(user avatars, additional CSS, changes to the old/new revision header
texts/links)

Bug: T139526
Change-Id: I10293be4581140c3edf0e4b538b04b31cb6f5730
2016-07-08 19:46:20 +03:00
jenkins-bot
724c16c4f4 Merge "Revert "Adding a bunch of hooks from wikiHow into DifferenceEngine"" 2016-07-06 21:57:33 +00:00
jenkins-bot
b8115ce691 Merge "Revert "Show parser output for diffs unless extension aborts"" 2016-07-06 21:49:13 +00:00
MaxSem
3f5717cac8 Revert "Adding a bunch of hooks from wikiHow into DifferenceEngine"
Causes fatals.

This reverts commit b02bfac06b.

Bug: T139526
Change-Id: I4c77b4d51408540a9238d38e8324028879b1bbf2
2016-07-06 17:43:32 -04:00
MaxSem
be3c147bde Revert "Show parser output for diffs unless extension aborts"
Reverting the underlying change.

This reverts commit 3354e8d550.

Bug: T139526
Change-Id: I2e0f2098981bda411f360eea89e5fac3b644f043
2016-07-06 21:32:44 +00:00
jenkins-bot
b2f295eb6d Merge "DifferenceEngine: Autodetect if wikidiff2 is installed" 2016-07-06 21:17:40 +00:00
Matthew Flaschen
3354e8d550 Show parser output for diffs unless extension aborts
It was backwards.

Bug: T139433
Change-Id: Ie370da9d77e1d7608e2d5492f9d34094af233d0b
2016-07-05 20:08:32 -04:00
Kunal Mehta
037f056e0e DifferenceEngine: Autodetect if wikidiff2 is installed
If wikidiff2 is installed, use it for diffing without requiring
$wgExternalDiffEngine to be set to 'wikidiff2'.

Also add some extra sanity-checking by coercing all non-string values to
false and make sure the custom diff executable passes `is_executable()`.

Change-Id: I32b670ebf613be9f1c034d65d006829a215614da
2016-07-02 16:19:07 -07:00
Jack Phoenix
b02bfac06b Adding a bunch of hooks from wikiHow into DifferenceEngine
These hooks allow things such as:
* adding CSS(/JS) into the OutputPage when viewing diffs
* adding extra HTML content (such as avatars) into diff views
* hiding the bottom "mark as patrolled" link
* altering the parser output that is used by DifferenceEngine
* and more

Example extension using these hooks is wikiHow's
/extensions/wikihow/hooks/, specifically the file DiffHooks.php (but the
hooks are setup in WikihowHooks.php).

Live example of the DiffHooks stuff in action can be found at wikiHow.com,
for example:
http://www.wikihow.com/index.php?title=Set-Your-Homepage&diff=17112892&oldid=15888129
(user avatars, additional CSS, changes to the old/new revision header
texts/links)

Change-Id: Icbc987fa4806e7bfc66743375301912b428dc348
2016-06-21 22:19:03 +03:00
umherirrender
72632115d6 Fix various phpcs error from last security patches
Found by tests:
https://integration.wikimedia.org/ci/job/mediawiki-core-phpcs-trusty/1069/console

Breaking merges

Change-Id: If01b94705cd7b939ac380053730b1b602c838a8e
2016-05-20 20:20:36 +02:00
Max Semenik
9097fb54c5 Use pool counter for generating large diffs to prevent DoS.
Bug: T130947
Change-Id: If560844664051c04e01b954377b4bdfdb744d13f

Signed-off-by: Chad Horohoe <chadh@wikimedia.org>
2016-05-20 09:49:12 -07:00
Brian Wolff
17b3659995 SECURITY: Add data attribute to patrol links so it can't be spoofed by user
Javascript used to look just for the patrollinks class, which
could be set by the user in order to patrol an arbitrary page.

Bug: T103239
Change-Id: I13fcc3ce479c0a4a90a6217c2e5244f051eaf862

Signed-off-by: Chad Horohoe <chadh@wikimedia.org>
2016-05-20 09:25:35 -07:00
Max Semenik
e08cd0de84 Make wikidiff3 the only diff engine
In addition to much improved worst-case performance, it also has better
relevance.

Bug: T128896
Change-Id: I3b52c502d7cd5923c5a02942afbe75aba9016148
2016-04-26 13:09:44 -07:00
Reedy
982d210712 DifferenceEngine::setText() was removed
Bug: T122754
Change-Id: I796f0c4d86d0d5a8c2b24820dc84b18a7dc50981
Depends-On: Ia52054a85944f51adb8a644e703db02f6833b262
2016-04-02 10:22:23 +01:00
Reedy
b5656b6953 Many more function case mismatches
Change-Id: I5d3a5eb8adea1ecbf136415bb9fd7a162633ccca
2016-03-19 00:20:58 +00:00
jenkins-bot
c42f066420 Merge "Log slow diffs" 2016-03-18 00:52:59 +00:00
Max Semenik
7b18a62c0e Log slow diffs
Change-Id: Id17e116cd58d433bf6bb51c38096727a660135b9
2016-03-11 13:11:43 -08:00
umherirrender
8678e32b8d Change remaining places to use short array syntax
Change-Id: I0785c73a239c11188ad7411c5cd8ed09a2dbc9b3
2016-03-11 18:41:26 +01:00
Max Semenik
edf7889821 Convert timing to ms before we've recorded too much data
Change-Id: I0a4e18290cdc662e597484a94205a481415cbb7b
2016-03-10 15:03:48 -08:00
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