Commit graph

11 commits

Author SHA1 Message Date
Umherirrender
503bff0b04 Rest: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: Idf17719c875466810313f0fbbf16bc67f3e40059
2024-09-07 21:49:56 +02:00
Ebrahim Byagowi
fab78547ad Add namespace to the root classes of ObjectCache
And deprecated aliases for the the no namespaced classes.

ReplicatedBagOStuff that already is deprecated isn't moved.

Bug: T353458
Change-Id: Ie01962517e5b53e59b9721e9996d4f1ea95abb51
2024-07-10 00:14:54 +03:30
Umherirrender
f27c2433bb tests: Use namespaced classes (2)
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I4ff4d0c10820dc2a3b8419b4115fadf81a76f7a2
2024-06-13 23:21:02 +02:00
Reedy
c8276f731a tests: Add more use statements in namespaced classes
Change-Id: I2629cfcb09fde6f18be824779a2c12c013ea0cb5
2024-02-18 21:31:02 +00:00
C. Scott Ananian
52320c0902 Move ParsoidRenderID to MediaWiki\Edit
This class belongs with the rest of the Parsoid output stash code.

This class has been marked @unstable since 1.39 and thus the move
does not need release notes.

Change-Id: I16061c0c28b1549fbe90ea082cc717fee4a09a6e
2024-02-07 21:22:06 -05:00
Derick Alangi
d674367af4
REST: Inject Authority instead of full User object
Per T310476, it looks like the Authority interface now supports
rate limiting, so we can just use that instead of a heavy full user
object.

Possible followups
==================
More can be done to make all consumers of the HTML helper's `init()`
method to inject Authority instead.

This patch is needed for the work happening in I08ebea5e8a601f161f.

NOTE: This is technically not a breaking change as the Authority
interface is implemented by both UserAuthority and User classes,
so passing either is fine so consumers passing a full user object
should still work even though we changed the signature of a public
method in HtmlOutputRendererHelper.

Change-Id: I025cd83cc81f73ded861fcab943ba3b942d7c390
2023-11-13 13:42:48 +01:00
Daimona Eaytoy
77d4c2c454 phpunit: Randomize and improve default test page names
UTPage is badly named, because it doesn't give any information as to
what test caused the page to be created. It also sort of encourages test
authors to rely on this "UTPage" page being created by the framework for
them.

Both these things are dangerous, or at least very questionable. Use a
random page title instead, but include the caller name in case someone
needs to investigate where a test page is coming from.

Do the same for summary and content, too.

In getExistingTestPage, add a check to make sure that the page was
created successfully. Do not use assert* to avoid adding assertions
extraneous to the test.

addCoreDBData is not changed because that method will be removed
entirely (T342428).

Fix tests that are now failing:
- ParsoidOutputAccessTest was relying on the content of
  getExistingTestPage to be UTContent.
- HTMLHandlerTestTrait did not account for spaces in the page name (also
  change the signature to reflect the fact that WikiPage is always
  passed in).
- HtmlInputTransformHelperTest was relying on the fake test page to be
  there.
- PoolWorkArticleViewTest is leaving pages behind, and for some reason
  that's making SpecialRecentchangesTest fail.

Bug: T341344
Change-Id: I9c2dc1cf1f184c8062864756d2747ee56e886086
2023-08-15 20:39:25 +00:00
daniel
6fd3a7b0b0 Stash original wikitext when rendering unsaved content.
When visual editor switches from source mode to visual mode, we need to
stash the wikitext. Otherwise, we later lack the proper context to
convert the modified HTML back to wikitext.

Bug: T321862
Change-Id: Id611e6e022bf8d9d774ca1a3a214220ada713285
2022-11-04 17:17:32 +01:00
daniel
4dd7bd16b5 ParsoidOutputStash: make storage backend configurable.
This introduces the ParsoidOutputStash config setting, which defines the
storage backend and cache duration. The storage backend name refers to
an entry in the ObjectCache setting, and defaults to the main stash.

Bug: T267990
Bug: T309016
Change-Id: Ic67dc43ed9843810e4b180127f9a3bb7608f7608
2022-06-14 14:11:37 +01:00
Derick Alangi
d62f97d5e0 Rest: Return different eTags for different output modes
This patch enables the response from PageHTMLHandler and
RevisionHTMLHandler to have different eTags for different
output modes and varying flavors.

Before, the only difference we got was when the stashing
option is set or not, but we need more flavors.

Bug: T308744
Change-Id: I2e9679e46a31955a2106a52af4eb612b32799c8c
2022-05-25 11:15:47 +00:00
Derick Alangi
13f6ec9e1b Rest: Migrate parsoid stashing logic from RESTbase
Add stash option to /page/html & /revision/html endpoints.
When this option is set, the PageBundle returned by Parsoid is
stashed and an etag is returned that can later be used to
make use of the stashed PageBundle.

The stash is for now backed by the BagOStuff returned by
ObjectCache::getLocalClusterInstance().

This patch adds additional data to the ParserOutput stored in ParserCache.
Old entries lacking that data will be ignored.

Bug: T267990
Co-Authored-by: Nikki <nnikkhoui@wikimedia.org>
Change-Id: Id35f1423a69e3ff63e4f9883b3f7e3f9521d81d5
2022-05-23 17:28:29 +01:00