Commit graph

326 commits

Author SHA1 Message Date
Max Semenik
8085c58a4b Replace call_user_func_array(), part 1
Uses new PHP 5.6 syntax like ...parameter unpacking and
calling anything looking like a callback to make the code more readable.
There are much more occurrences but this commit is intentionally limited
to an easily reviewable size.

Change-Id: Idcec077ef3fdf029b632cceafd0150851ad723e3
2018-06-04 23:39:04 -07:00
James D. Forrester
225b462a50 Drop deprecated EnableAPI and EnableWriteAPI settings
The siteinfo API response's 'writeapi' value is now hard-set to true,
as are the ResourceLoader variables wgEnableAPI and wgEnableWriteAPI,
to be deprecated later.

Bug: T115414
Change-Id: I54ff9428b247ba203d67aba079149393f323d5a9
2018-04-18 00:30:34 +00:00
Amir Sarabadani
00a4f0939c Replace rc_patrolled values with contants, part I
This constants has been recently introduced and it's good to use them

Change-Id: I8ce56dc95de3e49610dca71c00965ca1ac74bcf0
2018-04-11 22:35:31 +02:00
Bartosz Dziewoński
99e8325cc1 DifferenceEngine: Use CSS classes instead of inline styles
Change-Id: Iee0e5e7eb73023a6f57c1f462e71cbb0e771d1f2
2018-03-05 19:24:37 +01:00
Brad Jorsch
2791fb0861 Hard-deprecate ParserOutput stateful transform methods
This also removes all the in-core calls that had been kept for the
benefit of extensions, and causes them to not have any effect since
anything that had been calling them was already either a no-op or will
probably be broken now that nothing in core is setting or checking the
flags.

Change-Id: Id22c1a5a6d6a249debb14063ae3f8838d105b634
2018-02-13 12:28:36 -05:00
Thiemo Mättig
d77dfda69e Add missing PHPDoc block to DifferenceEngine::getParserOutput
Bug: T186163
Change-Id: Ifde6f8e458d90b1ec250dc4d587cd428717fe509
2018-02-01 12:49:57 +01:00
Brad Jorsch
e74ba29aa6 Use ParserOutput stateless transforms
We still set the state in many cases for benefit of extensions, but all
calls within core should no longer be using non-default state.

Change-Id: I78b62ec33fcb8273acb9b3b4e9012215442be94c
Depends-On: I140ff32373430b61b92226689ef9b58cca317450
2017-11-30 14:27:49 -05:00
WMDE-Fisch
9f2dde8a3a Fix regex on diff tooltips
Follow-up to I71600acc19319f7b5781b42dc88cd5e8c65c29a0

Change-Id: If307f6a02291005c12f28129a67aa00e423e5e9c
2017-11-22 11:51:43 +01:00
WMDE-Fisch
f7b1b48c4e Add localised tooltips for moved paragraph indicators
Bug: T166882
Change-Id: I71600acc19319f7b5781b42dc88cd5e8c65c29a0
2017-11-21 12:35:38 +01:00
Kunal Mehta
23ebfcddc4 DifferenceEngine: Improve cache invalidation
Invalidate the diff cache if the engine producing the diff changes, or
if a configuration setting that controls the diff output changes. This
is probably what most users expect, that changing the configuration will
result in a change for diffs that may have already been viewed.

For wikidiff2 specifically, a change in version or
$wgWikiDiff2MovedParagraphDetectionCutoff will invalidate the cache.

Refactor engine detection and sanity-checking into a private getEngine()
function.

As part of this getDiffBodyCacheKey() was deprecated, and subclasses
should implement getDiffBodyCacheKeyParams() instead. Drop the
deprecated and unused MW_DIFF_VERSION constant while we're at it, and
bump DIFF_VERSION since we're already changing the cache key format.

Bug: T180043
Change-Id: I4e386ca05bd2a2fb54208d760c131eb42e3a72ab
2017-11-21 12:10:11 +01:00
WMDE-Fisch
a656121e13 Add missing @throws in doc
Change-Id: I978369a727d557db8650b32ec155a6b490c4c866
2017-11-06 16:40:48 +01:00
Kunal Mehta
f2999fb1f7 DifferenceEngine: Add debug text for native PHP diffs
Change-Id: I004844989dfd98083f4b1f8722f6a142d47928e9
2017-11-01 23:36:11 -07:00
Kunal Mehta
66c9faccb7 DifferenceEngine: Fix wikidiff2 version check
The feature was actually released in 1.5.0.

Change-Id: Ic1a8818e34327510a75a4252f98b1f67aeeacb04
2017-11-01 11:00:22 -07:00
Brad Jorsch
3488f49532 Replace selectFields() methods with getQueryInfo()
Several classes have a "selectFields()" static method to tell callers
which fields to select from the database. With the recent comment table
change and the upcoming actor table change, this pattern has become too
simplistic as a SELECT will need to join several tables to be able to
retrieve all the needed fields.

Thus, we deprecate the selectFields() methods in favor of getQueryInfo()
methods that return tables and join conditions in addition to the
fields.

Change-Id: Idcfd15568489d9f03a7ba4460e96610d33bc4089
2017-10-30 22:57:33 +00:00
Umherirrender
9aa56950c2 Remove @codingStandardsIgnore from long lines
Breaks some line where the ignore is not needed.

The sniff was changed upstream to be okay
with long unbreakable lines in comments

Change-Id: I2bbe2be7cedd4d3c0ce8dc3e62d0e268bc171876
2017-10-22 16:44:04 +02:00
Max Semenik
782b207621 Switch DifferenceEngine to the new shell framework
Change-Id: Iad8718e5f54ed829efded8efbb0f3496c119e6ad
2017-10-20 16:03:04 -07:00
Brad Jorsch
7a44c51580 Fix warning in DifferenceEngine
Make sure that the ar_namespace and ar_text fields are selected from the
database.

Change-Id: Ic2e8f99f43025510c14e0a8ff2b708b378cf7ef3
2017-09-20 19:39:07 +00:00
Brad Jorsch
33ba36c88a Replace more problematic uses of "SELECT *"
With the introduction of CommentStore, selects from various table
require certain joins or column aliases for proper operation.

Change-Id: I2ecb6030bf253664c3227d69b5ed2277596a83f0
2017-09-13 13:09:51 +00:00
Tobias Gritschacher
286245181d Check for Wikidiff2 version 0.3 NOT for 0.3.0
version_compare( '0.3', '0.3.0', '>=' ) gives false, so we need to check
for 0.3 since the Wikidiff2 version is defined as 0.3 in
https://gerrit.wikimedia.org/r/#/c/319866/60/Wikidiff2.h

Bug: T166571
Change-Id: Id6e9f402af2fab784a3db2444f201022e2d0de3e
2017-09-04 13:58:49 +02:00
Fomafix
6c30fab960 Use double quotes instead of singe quotes for HTML attributes
htmlspecialchars[1] encodes only double quotes not single quotes.
Therefor the HTML attribute must enclosed with double quotes for
correct output encoding.

[1] https://secure.php.net/manual/en/function.htmlspecialchars.php

Change-Id: I3fec5299585187ed70d62b9248007af34b0db85b
2017-07-26 22:56:52 +00:00
jenkins-bot
e72303c9f3 Merge "Remove auto-generated "Constructor" documentation on constructors" 2017-07-21 13:19:44 +00:00
Thiemo Mättig
91a920fd85 Remove auto-generated "Constructor" documentation on constructors
Having such comments is worse than not having them. They add zero
information. But you must read the text to understand there is
nothing you don't already know from the class and the method name.

This is similar to I994d11e. Even more trivial, because this here is
about comments that don't say anything but "constructor".

Change-Id: I474dcdb5997bea3aafd11c0760ee072dfaff124c
2017-07-21 12:19:30 +02:00
jenkins-bot
a3fc1b6236 Merge "Export revision IDs to JS config on diff pages" 2017-07-18 15:40:00 +00:00
jenkins-bot
43a548a5c3 Merge "Introduce config var for moved-paragraph-detection threshold" 2017-07-18 14:20:00 +00:00
Ed Sanders
a469795efc Export revision IDs to JS config on diff pages
Bug: T169574
Change-Id: Ic4abaae6e9c74509f7a114a697cdbb78dd1b89b6
2017-07-18 11:24:26 +01:00
Tobias Gritschacher
76e64c3afe Introduce config var for moved-paragraph-detection threshold
This introduces a configuration variable for the bailout threshold for
the moved-paragraph-detection in wikidiff2.
This allows to rollout a new version of wikidiff2 that supports
detecting changes in moved paragraphs without changing behaviour of all
wikis in production as the default value of the setting (0) will leave the
new feature disabled.
Compatibility with older versions of wikidiff2 is retained by checking for
the version number of wikidiff2 and calling the method without the 4th
parameter if the version is < 0.3.0.

Bug: T166571
Change-Id: Ic01054354a4fbba410e58c9873edcbde797f883d
2017-07-18 11:07:04 +02:00
Umherirrender
be42e09aa8 build: Prepare for mediawiki/mediawiki-codesniffer to 0.9.0
The used phpcs has a bug, so the version 0.9.0 could not be enforced at the moment.
Will be fixed in next version, see T167168

Changed:
- Remove duplicate newline at end of file
- Add space between function and ( for closures
- and -> &&, or -> ||

Change-Id: I4172fb08861729bccd55aecbd07e029e2638d311
2017-06-26 17:14:31 +00:00
WMDE-Fisch
7b5f08e703 Replace deprecated Context::getStats() with MWServices::getStatsdDataFactory()
Change-Id: I1756f69ca2ebd301a5049bf758d1a87c37771fe6
2017-03-17 12:07:03 +01:00
James D. Forrester
9635dda73a includes: Replace implicit Bugzilla bug numbers with Phab ones
It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345"
except where it doesn't, so let's just standardise on the real numbers.

Change-Id: I6f59febaf8fc96e80f8cfc11f4356283f461142a
2017-02-21 18:13:24 +00:00
Brad Jorsch
fb3ae6fbe3 Replace use of &$this
Use of &$this doesn't work in PHP 7.1. For callbacks to methods like
array_map() it's completely unnecessary, while for hooks we still need
to pass a reference and so we need to copy $this into a local variable.

Bug: T153505
Change-Id: I8bbb26e248cd6f213fd0e7460d6d6935a3f9e468
2017-01-31 23:01:54 -05:00
jenkins-bot
9ac29c74ed Merge "Cleanup some incorrect return annotations" 2016-12-16 07:22:24 +00:00
Jack Phoenix
c40fbea783 Make DifferenceEngine's markPatrolledLink and getRevisionHeader public so that hooked functions can use them where needed
The said hooks were added to core in
https://gerrit.wikimedia.org/r/#/c/298026/ . One of the many intended use
cases is https://gerrit.wikimedia.org/r/#/c/326074/ which currently fatals
due to these two being protected, and obviously we don't want to lose
functionality when hooking into one (or more) of the aforementioned hooks.

Change-Id: I260c8b57c0bb2af3a6982bd7142b112a4a023391
Depends-On: I02de9069854532faec4c0c1798a10f862e6dfd7c
2016-12-14 22:19:53 +00:00
Jack Phoenix
04736acd44 A few more hooks in DifferenceEngine
For mucking with the class member variable mNewContent and optionally
allowing the suppression of the "missing revision" message when revision
data is not found for a requested revision.

Originally implemented as the "GetUserMessagesDiffCurrent" hook (yes,
these three separate hooks in three separate places were essentially the
same) by Wikia for their SiteWideMessages extension.

Change-Id: Ie0c175af2af418d4ed3de28c94df918115312da3
2016-12-14 21:31:06 +00:00
Erik Bernhardson
d67197fa11 Cleanup some incorrect return annotations
Most of these are simply changing annotations to reflect
reality. If a function can return false to indicate failure
the @return should indicate it.

Some are fixing preg_match calls, preg match returns 1, 0 or false,
but the functions all claim to return booleans.

This is far from all the incorrect return types in mediawiki, there
are around 250 detected by phan, but have to start somewhere.

Change-Id: I1bbdfee6190747bde460f8a7084212ccafe169ef
2016-12-12 10:15:05 -08:00
Reedy
2c74b04356 ArticleViewCustom, EditPageGetDiffText and ShowRawCssJs were removed
Bug: T145728
Change-Id: Iddf29005abbaceaa1e3cc2c79e4becfb46294414
2016-12-03 12:27:07 +00:00
jenkins-bot
63ab00b60d Merge "Convert action=markpatrolled fallback interface to HTTP POST" 2016-11-08 17:43:25 +00:00
Timo Tijhof
4ff510e4a7 Convert action=markpatrolled fallback interface to HTTP POST
The main interface already has javascript enhancement to use
the API and mw.notify. This patch affects permalinks without
tokens, and opening the link without javascript.

This will match the current behaviour of action=watch.

Bug: T130946
Change-Id: I6be2c07824c17b165e068fc4ac36ab192e12bc9d
2016-11-04 23:57:26 +00:00
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