This reverts a change from 5a792b6558. The hook only requires
a PageIdentity, and we only used toPageRecord() because it takes
a parameter to read latest data, and toPageIdentity() does not.
Instead call another method to update the internal data within the
Title instance. Maybe it's not great to rely on this side-effect…
Bug: T340568
Change-Id: If9cbd95eb84b6c39bf50af4564710839628a9bc3
Sometimes we call this API and then reload the page (or navigate to
another URL), without using the page content it returns. Save some
work and some data transfer and don't generate it in those cases.
Change-Id: Ic5fac61f3ef9b2dfce6ff757f1d414a9f41f217d
There are no occurrences of the error message in our error logging
data, so it most likely can never happen.
https://superset.wikimedia.org/superset/sqllab/
```
select count(*)
from editattemptstep
where event.save_failure_message = 'visualeditor-docserver'
```
Change-Id: I8172564057418283468c657cbc6d42ce8ddb35f4
More could be done, but these are the ones that annoy me the most,
and I'm not willing to do more changes right now.
Change-Id: Ia02af09d631fea191e57da75420f0d2d1ed46c19
We want to be able to measure how backend performance changes
when we switch from RESTbase to calling Parsoid directly.
We expect to see a performance boost, in particular for
html/to/wikitext, since we avoid the network overhead.
Since we will make the switch by wiki, we need to be able to compare
the metric before vs. after for a single wiki. So, this adds the
wiki ID as a prefix to all existing metrics. Once fully rolled out,
we should get rid of the wiki prefix.
We will need to update the dashboard found at this url:
https://grafana.wikimedia.org/d/000000249/edit-stash?orgId=1
Change-Id: Iac9070b27f4b0d25b0e31c9fad38abc08c433a28
All code that used to live in ParsoidHelper has been moved to
VisualEditorParsoidClientFactory and VRSParsoidClient.
ParsoidHelper is no longer needed.
Change-Id: I21c4a8cd86f8d085e75a601ed6d2509dedd75d42
Introduced in FlaggedRevs with Idbdab9a7396 (6bfd276e64), and I've
migrated consumers away from the singleton in I192b962147 (5ee96e5ca7)
and I04fdbd497b8 (bbdfc4c024).
The one thing that remains global by default is the context, but
VE already avoids that with setContext, and (correctly) restores this
afterward since the FlaggablePageView object is re-used by title.
That's exactly as terrible as it sounds, but at least it's a bit more
visible after my refactor.
Bug: T314008
Change-Id: I0008818ec821c35c570d9db9c82f737783e6729b
Remove WikiFilePage instance check, isLocal exists also on WikiPage and
newFromTitle never returns null
Bug: T297688
Change-Id: I925771a84afe4402fdb0f201c0b562c7028c44b2
This also matches the current code in OutputPage::setPageTitle()
Depends-On: Ic864c01471c292f11799c4fbdac4d7d30b8bc50f
Change-Id: I018b34bb5f6e113056da9b04cc72d4318422adce
Passing the useskin parameter ensures that output hooks are run
on the new page HTML. This already happens because we request
the 'subtitle' and 'categorieshtml' props which also trigger
skin mode (along with the 'headhtml' which we don't request).
However it is better for us to be explicit that we want the rendering
for a specific skin, rather than relying on these props to trigger
the correct mode.
Also pass through mobileformat param, which is added by a hook
in MobileFrontend.
Change-Id: I1cd2c5c5c13ae0b90cc32e441b453532343a434a
Specifying it as such creates a 0 based index for what is a single value
property. This wasn't noticed before because I6b81ea318f52e accessed the
request object directly instead of using $params. See also
I3baa1ebb66559 for how this bug manifested in GrowthExperiments.
Bug: T289652
Change-Id: Ife8350d1cea79fc1dd6f3cb040a7801b9fe6db91
What:
Add a hook that runs before a save attempt is made in
ApiVisualEditorEdit. The hook receives the same data available in
ApiVisualEditorEdit, and implementations of the hook can modify the API
response.
Why:
VE plugins may send additional data when saving an edit, and extensions
might want to prevent the save from taking place based on that
additional data.
See for example the AddLink plugin in Ic8225933c9, where the save is
blocked if link suggestions don't exist in the database at save time.
Bug: T283109
Change-Id: I6b81ea318f52ec47661086d85b5cc242a3fcd0e4
* Mismatching capitalization.
* Unused pieces of code.
* Properties that can be constants.
* Use $this->getConfig() in special pages.
Change-Id: Ia7e2c438c5ddd3c770070701e4cbdfc79fccf009
What:
Add hook that runs after a save attempt is made in ApiVisualEditorEdit.
The hook receives the same data available in ApiVisualEditorEdit, and
implementations of the hook can modify the API response.
Also introduce templated
parameters (https://www.mediawiki.org/wiki/API:Templated_parameters) in
the API parameters; this allows plugins to pass arbitrary data along
with their request using e.g. plugins=linkrecommendation&data-linkrecommendation=foo
Add ServiceWiring files, a PHP namespace, and a HookRunner class to
support the above changes.
Why:
VE plugins may wish to send additional data when saving an edit and take
action based on that data on the server-side. See for example the
AddLink plugin in I7a052f8e which sends annotation data, and then uses
the new hook to perform a database operation.
Change-Id: I392691475fbdcec766acbd832600e82efcb5bfe8
Otherwise, the global context is used (RequestContext::getMain()),
which is undesirable when you're building a rubegoldbergian
contraption and we're already inside an internal action API request
with a fake context.
Change-Id: I66e79e641eda185f7af2561d3655c92cba762135
isRegistered is part of the slick UserIdentity interface, i.e.
it's the more "canonical" form. This change makes it a bit
easier to move away from using the huge (4000+ LOC) User class
everywhere, in favor of the UserIdentity interface, where
possible.
This patch is meant as a small step towards this goal. I tried
to replace some usages of User type hints already, but prefer
to go in small, incremental steps.
Change-Id: I827b83a5304b1975437d5fd5083f2877dba6f6d8
Although wikitext is (expected to be) in Unicode Normalization Form C,
the output HTML may not be, due to the presence of explicit entities in
the wikitext representing non-NFC codepoints.
Bug: T266140
Depends-On: I2e78e660ba1867744e34eda7d00ea527ec016b71
Change-Id: I0d34c9a01f1132c2616ed3392ea40d8b73e15325
This patch starts using watchlist related values from ApiEditPage
results instead of updating the "watch link" based on whether the
checkbox was selected or not at the time of saving the article.
This change does not depend on T261030 and can be merged without it
but T261030 needs to be fixed or temporarily watched items will not
display the right tooltip when hovering the "watch link" or star icon.
Bug: T260434
Change-Id: I2c844223620d7d28f36a0cd8ae3dee4b0c8ae5bf
The output is assumed to be the same as you would get if you
fetched the page again, so this output-modifying hook needs to run.
Bug: T258980
Change-Id: I015ac183a0c25dafb9b95c577edd4ef59c112d43
* Remove postHTML/postData separation, not very useful.
* Pass $oldid instead of full params object.
* Return full repsonse like other methods, instead of just body.
Change-Id: I0fe301475adeb0fd5952809c3f74f0cb19f89cfe
This allows Special:ApiSandbox to display multi-line text boxes for
them, which makes testing the API easier.
Change-Id: I10541a8e9033d81740033da80d842f58d1d3e0de
Goals:
* Allow other extensions to reuse these methods (maybe upstream them
to MediaWiki core later)
* Allow ApiVisualEditorEdit to extend ApiEditPage. We'll be able to
reuse its definitions for API parameters instead of duplicating
them, and we won't have to pass around unrecognized parameters.
Bug: T252573
Change-Id: If5c8d95560cbb078ae4980f4a912cbaeafe53d3e
We go through all this trouble to pass the config to the API modules,
and then we don't use it at all (we removed the uses recently in
ce094c72d and d85d30f9b).
If we end up needing the config there again, we can just get it by using
MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'visualeditor' )
anywhere we want, like we do all over the place in VisualEditorHooks.
Change-Id: I9d254a9946f0d24783baf68c409b10291a8fd1b3