Commit graph

1849 commits

Author SHA1 Message Date
Ppchelko
643fc535c3 Reapply "Move limit report rendering to ParserOutput"
This reverts commit 2bcb3fe567.

Reason for revert: this is a good change,
just needed more work to not break CI

Change-Id: I23768bee242e3cf81b1493a740cf070e7ad1e224
2021-11-09 11:08:08 -08:00
Ppchelko
2bcb3fe567 Revert "Move limit report rendering to ParserOutput"
This reverts commit 89028e0b8e.

Reason for revert: Temporary until we deal with T295357

Change-Id: I556de18dbf900a9bc58d5ae22d1bf194682d0840
2021-11-09 15:57:18 +00:00
Petr Pchelko
89028e0b8e Move limit report rendering to ParserOutput
This does not move the actual limit report data into
ParserOptions yet, that should be done separately
given that it will require serialization changes.
Let's get this change settled first before messing
with serialization.

This unifies canonical and non-canonical ParserOptions,
so ParserCache can now be used with both. It is hard
to say how this will affect the ParserCache capacity,
so we should monitor it after releasing this.

Change-Id: I154c0a77a5b0287b5572614d56339fb57ac56c33
2021-11-08 12:45:41 -08:00
Fomafix
0071df8981 EditPage: Only update title part of firstHeading on live preview
The message wgEditMessage can contain code for the extension
ParserFunctions which is not supported by mediawiki.jqueryMsg.

This change updates only the title in the firstHeading instead of
creating the whole message including the title again. The title gets
identified by a new HTML element with id="firstHeadingTitle".

The title in the HTML title gets not updated anymore. For a preview of
the display title the title in the firstHeading should be enough.

The 6 messages
'creating',
'editconflict',
'editing',
'editingcomment',
'editingsection',
'pagetitle'
are not needed anymore in JavaScript and removed from the module.

The global JavaScript variable 'wgEditMessage' is not needed anymore in
the live preview module. Other user scripts uses this variable and
therefor this variable is kept for compatibility.

Bug: T105214
Change-Id: I8d8dc79c6bf1a94a55f1d0f6b5611ca478fd9e18
2021-10-24 20:52:49 +00:00
Roman Stolar
fa5237eb48 Replace Content::getParserOutput call to ContentRenderer::getParserOutput
Bug: T287158
Change-Id: I8a13f45027e08e2d8ddefa140dd47a0c55094934
2021-10-20 12:11:24 +03:00
Umherirrender
f7fd5338dc Fix nullable doc for EditPage::$editRevId
Change-Id: Id79b5f3a34779f18e035632de690200713d77640
2021-10-16 22:31:28 +02:00
jenkins-bot
ae5c51f354 Merge "Use Message::sizeParams to simplify code when building messages" 2021-10-15 23:21:38 +00:00
DannyS712
751dccfb12 Minor cleanup to EditPage, should be a no-op
Make some things simpler

Change-Id: Id438f928eaa588640922ba74a907f5ff75f65522
2021-10-14 00:16:54 +02:00
Umherirrender
02c0e8b8e7 Use Message::sizeParams to simplify code when building messages
Change-Id: Ic04d4dea86e61fb07b2a3b17acb6021fab6ae5ee
2021-10-13 19:52:41 +00:00
jenkins-bot
10490802e7 Merge "Change null to [] for html attributes on call of Html functions" 2021-09-29 16:20:41 +00:00
Umherirrender
0e4bb6d611 Change 'fromdbmaster' to WikiPage::READ_LATEST
Constants are harder to misspell

Change-Id: Ie1afcc8580cccf815df1cc97f05a5be81676d9f7
2021-09-26 19:27:33 +00:00
Derick Alangi
2432cc2bb4 Use PageUpdater's fluent interface as in some parts of our codebase
Some methods in the PageUpdater's class implements the fluent interface
design pattern. Use the fluent interface where need be.

Change-Id: If76a4b8c5070c20ed40038a4ee78e2d677de5180
2021-09-23 00:31:33 +01:00
Umherirrender
362a48e316 Change null to [] for html attributes on call of Html functions
Change-Id: Ia84f5b1f210396cba5daa7b9e8bb8c4069e0171d
2021-09-22 22:47:28 +02:00
jenkins-bot
8ee86f1734 Merge "Avoid using ContentHandler::getContentText()" 2021-09-20 19:14:10 +00:00
Alexander Vorwerk
c4b2765ebd Avoid using ContentHandler::getContentText()
ContentHandler::getContentText() is deprecated and should be
replaced with Content::getText() for TextContent instances.

Change-Id: I556d3d3f64fafd1d54c4a0c5021efaff2d9c3ce8
2021-09-20 15:32:44 +02:00
Ammarpad
1cf4eab3ab ApiParse: Support hidden skins
Since $wgSkipSkins is meant to only 'remove skin from preferences',
it should not affect parsing with them.

So these skins need to be allowed here.

To achive this, this patch adds getInstalledSkins() method to SkinFactory
to provide the complete. The method supersedes getSkinNames() which does
the same thing but with ambiguous name.

Description of getAllowedSkins() has been corrected as it was slightly incorrect.

Bug: T237856
Change-Id: I0889b823d27f1a2830cc0205f5a21ed4de744e08
2021-09-20 09:29:24 +01:00
Kunal Mehta
c27a559a93 EditPage: Read from wpWatchlistExpiry form value on "show changes" too
To allow people to set a custom watchlist expiry and then preview the
page, we read from the POSTed 'wpWatchlistExpiry' value and set that
as the default.

It seems reasonable and what users expect to do the same for "show changes",
so check for $this->diff as well.

Bug: T291287
Change-Id: Ia3b27b61a5c65b1830045796a87f11a5659502e2
2021-09-17 11:10:59 -07:00
daniel
6ce0d2c825 Make EditPage use PageUpdater
This ensures that a DerivedPageDataUpdater is initialized earlier during
the edit process, so it can be used by hooks to access the state of the
ongoing edit.

This patch also cleans up PageUpdater a bit to make the internal information
flow more consistent with the idea that PageUpdater is acting as a
builder for a new revision.

Change-Id: I99abb7bdffb2b5ff5979ba5b1e56d39dba4cd3dc
2021-09-16 13:11:15 -07:00
jenkins-bot
79615a43c1 Merge "Drop wgAjaxEditStash, deprecated in 1.36" 2021-09-07 16:45:22 +00:00
jenkins-bot
8d2bdc20c2 Merge "Specify DB to query when checking if a user is blocked from a page" 2021-08-26 17:43:34 +00:00
Umherirrender
864068d000 Remove unneeded explicit true/false inside conditions
The non-strict conditions in if/while are true/false without the check.

In some situation the true/false is removed, because it is known to be a
bool (by is_bool check or type hint)

Change-Id: I5ca4c4771af25d2e785e82732df204a73653886e
2021-08-17 21:52:34 +02:00
jenkins-bot
0640586f88 Merge "Move Content::preloadTransform to ContentHandler" 2021-08-17 15:37:12 +00:00
Roman Stolar
42442e01ff Move Content::preloadTransform to ContentHandler
Update ContentTransformer to access ContentHandler::preLoadTransform through the service.
Prepare object to hold a data that required for ContentHandler::preLoadTranform params.

This is a fully backwards compatible change.
We are doing hard deprecation via MWDebug::detectDeprecatedOverride.

However, with the ContentHandler calling Content and
Content calling ContentHandler, it doesn't matter whether
callers use Content or ContentHandler. This will allow us
to naturally convert all callers.

Bug: T287157
Change-Id: I89537e1e7d24c6e15252b2b51890a0bd81ea3e6b
2021-08-17 15:17:34 +00:00
mainframe98
3bab2cc853 EditPage: load mediawiki.interface.helpers.styles
This module provides styling for span.comment, produced by
Linker::commentBlock, which EditPage calls when generating the
HTML for the edit summary.

Add a notice for that to Linker::commentBlock, like was done
in ddbf011257, and update the
comment in the stylesheet.

Bug: T288907
Change-Id: I3d929eaae54754bd3e41a9add419f1098a7f8e3a
2021-08-15 16:01:07 +02:00
jenkins-bot
9ca808f577 Merge "Support fluent interface for StatusValue" 2021-08-11 04:23:17 +00:00
Thiemo Kreuz
69242b0876 Various updates and fixes to PHPDoc documentation
Some minor updates I collected in my local dev environment the
past months.

Change-Id: I30d5339bc262d54ba76e2860a3a3e9e5f002fdc3
2021-08-09 09:26:23 +02:00
jenkins-bot
e89e7aa8b0 Merge "Revert "Use CsrfTokenSet as CSRF token source"" 2021-08-05 23:37:31 +00:00
Umherirrender
21e3caa033 Remove explicit LIMIT 1 when using IDatabase::selectRow/selectField
The limit is the reason why there is an explicit function to use

Change-Id: Ic85cb80b10f233fad4f8ffa214848d76092aee91
2021-08-06 00:54:47 +02:00
Kunal Mehta
a85f569dd1 Revert "Use CsrfTokenSet as CSRF token source"
This reverts commit 0d75fdb4f7.

Bug: T287542
Change-Id: Iedd3461869f973f8d621a39e6ad4674cbb577551
2021-08-05 15:48:26 -07:00
Umherirrender
d87dc4d99a Change Title::mNamespace to ::getNamespace() in EditPage
Change-Id: I852309cc88c2cddbd19c5c51c1f9c4be642c3ae3
2021-08-04 05:18:55 +02:00
James D. Forrester
1ca1b910c5 Drop wgAjaxEditStash, deprecated in 1.36
Bug: T274695
Change-Id: Ia51d889fff5132ff4f9a89d07bc04cc72f936f1f
2021-08-02 12:21:56 -07:00
TChin
fa5d3dba51 Support fluent interface for StatusValue
Also refactored some calls to use it.

Bug: T287485
Change-Id: If9e96ce87dc3f3641e9b3ebe093f92d8fa49b9ee
2021-08-02 15:14:11 -04:00
jenkins-bot
eb58fa9d82 Merge "Move Content::preSaveTransform to ContentHandler" 2021-07-29 19:25:28 +00:00
Petr Pchelko
b782a7e66d Move Content::preSaveTransform to ContentHandler
Create ContentTransformer to access ContentHandler::preSaveTransform through the service.
Prepare object to hold a data that required for ContentHandler::preSaveTranform params.

This will require making a semi-backwards-incompatible
change no matter what, we don't really have a great way
of hard-deprecating overriding methods.

However, with the ContentHandler calling Content and
Content calling ContentHandler, and with the ProxyContent
trick to stop infinite recursion, it doesn't matter whether
callers use Content or ContentHandler. This will allow us
to naturally convert all callers. But won't really allow
hard-deprecation.

Bug: T287156
Change-Id: If6a2025868ceca3a3b6f11baec39695e47292e40
2021-07-29 18:06:02 +03:00
jenkins-bot
56a2c16e48 Merge "Add missing spaces to imploded debug strings" 2021-07-28 13:44:04 +00:00
Matěj Suchánek
d71ff53639 Add missing spaces to imploded debug strings
Change-Id: I32d921aaa3a5799777ff62b35608cbedcfff907d
2021-07-28 11:07:17 +02:00
libraryupgrader
5357695270 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
  The following sniffs now pass and were enabled:
  * Generic.ControlStructures.InlineControlStructure
  * MediaWiki.PHPUnit.AssertCount.NotUsed

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)

Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
2021-07-22 03:36:05 +00:00
Petr Pchelko
0d75fdb4f7 Use CsrfTokenSet as CSRF token source
Change-Id: I079d2c802d9b48d6abf7f37fa9ef7dafac631345
2021-07-12 14:19:15 -07:00
jenkins-bot
c309a5dd25 Merge "Remove the fallback for create rights (covered in PM edit rights check). Remove key to i18n message, no longer being used." 2021-06-30 15:16:39 +00:00
Roman Stolar
6ebaa5caf6 Remove the fallback for create rights (covered in PM edit rights check).
Remove key to i18n message, no longer being used.

Bug: T272079
Change-Id: Id6566e5241b06ba377c2eca083221ee02556365f
2021-06-30 17:30:30 +03:00
jenkins-bot
9e09b85044 Merge "EditPage::displayPermissionsError always use exception if no content" 2021-06-29 02:57:34 +00:00
DannyS712
b45ddb2ab3 Use WikiPage::doUserEditContent() instead of ::doEditContent()
Results in passing a user where previously the fallback
to $wgUser was being used, mostly in tests.

Bug: T255507
Change-Id: Iabe24315b23c0ad1272353186425e71974528d23
2021-06-28 00:11:30 -07:00
DannyS712
47d70dbfba Post Revision-removal cleanup
Updates for the removal of the Revision class itself
and the various methods/hooks/variables removed in the
process, including:

- Update some documentation removing most references
to the Revision class and updating the MCR migration
notes to reflect the past tense for Revision methods.

- Change some capitalization from "Revision" to "revision"
to make it clear comments are about revisions in general,
not the Revision class in particular.

- Minor code tweaks including removing unused variables that
were around for the old hooks that were removed, and
removing the use of DeprecatablePropertyArray where no
longer needed for anything.

- Fix incorrect documentation for PageUpdater::getStatus(),
the status value changed a while ago to have revision-record
in addition to revision, and recently to only have the
revision-record, but ironically PageUpdater was never updated.

- Removed Parser::$mRevisionObject, used to be a Revision object
and was deprecated in 1.35, missed earlier because it was no
longer being set to Revision objects, always null.

- Add RevisionRecord typehints in DummyLinker to match those
in the corresponding Linker methods

This should be a no-op in terms of functionality.

Bug: T247143
Change-Id: I03bbb94fc29085855448780b1a5ad9063911ecc4
2021-06-24 00:32:39 +00:00
Thiemo Kreuz
2ba01c7ee7 Remove some more comments that literally repeat the code
… including PHPDoc tags like `@return <type> $variableName`.
A return value doesn't have a variable name. I can see that
some people do this intentionally, repeating the variable
name that was used in the final `return $var;` at the end
of a method. This can indeed be helpful. I leave a lot of
these untouched and removed them only when it's obviously
wrong, or does not provide any additional information in
addition to what the code already says.

Change-Id: Ia18cd9f25ef658b08ad25b97a744897e2a8deffc
2021-06-18 21:23:56 +00:00
Petr Pchelko
eccd347da9 Hard-deprecate User::matchEditTokenNoSuffix
This feature was added to provide a custom error message
if the edit token was present, but trailing slashes were
stripped from it by some ASCII mangling proxy. According
to metrics this has happened 5 times last month, which
IMHO doesn't justify having special handling. Giving a
regular token mismatch error message should be good enough.

Depends-On: Ieb4f6e25a74ecaa1110c59a8d8eed3ca792f2d41
Change-Id: I85759e315581f891721dfac246daaafe956ab201
2021-06-18 09:42:24 -07:00
Petr Pchelko
92564edc7c Use Message::page instead of Message::title
Also modified new APIs added to ApiErrorFormatter to
use PageReference instead of Title.

Change-Id: I093c89f8e1e6d383603f887358be6ece70f23a02
2021-06-09 13:18:22 +00:00
jenkins-bot
96c6af6878 Merge "Use null coalecing operators everywhere consistenctly." 2021-06-04 15:31:52 +00:00
Bartek Łukawski
e712f75cb8 EditPage: Fix raw asterisk in multi-error message box
A status object may return multiple error messages, encoded as a
wikilist of *-items by `getWikiText`. Without a leading newline, the
first asterisk is not parsed and therefore displayed as-is in the
resulting HTML.

See also: 9b530b2b5a

Bug: T282810
Change-Id: Ifc0a3ae32598ea4f8738cd13798ea4cdf4c0cd98
2021-06-04 11:45:10 +00:00
Petr Pchelko
0dfa846653 Use null coalecing operators everywhere consistenctly.
Auto-generated with rector.

Change-Id: I4f27e10cf029bb067b7bc57d82f7a64e21ea8d42
2021-06-03 21:42:06 -07:00
Petr Pchelko
dbc198e303 Remove EditPage::buildTextboxAttribs, protected and unused
Change-Id: I104ea008d1e4038e49eaaa63298e71ee204e3b61
2021-06-02 18:41:33 -07:00