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
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
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
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>
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
It's been unmaintained for a while and does not support
various languages adequately.
Also, document $wgExternalDiffEngine.
Change-Id: Ia8aeffd79d550fb7a1a7121456940446eea8bd4f
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
* 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
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
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
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
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
* 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
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
* #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
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
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
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
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
Wrap links in page revision diff header with classes like page revision history
entry links.
Bug: 44242
Change-Id: I0066827bd57c2d40b4b8bd5634cb46c5ce306f28