Commit graph

11 commits

Author SHA1 Message Date
Timo Tijhof
37f380aac6 Storage: Minor docs and file header cleanup
* Move description and ingroup annotations from PHP file docblock to
  class docblock, where IDEs and Doxygen (and humans!) tend to read it
  from.

  This is in part evidences by the fact that for numerous classes,
  the file docblock was copy-pasted and actually about a different
  class.

  Follows-up Ia3b9b8c22 (page), I301f471f86 (language),
  I216d85c6df (PageEditStash), and others that apply similar doc
  improvements.

* Add missing `@defgroup` for page. Without this, the group is ignored
  and not added in the sidebar at
  <https://doc.wikimedia.org/mediawiki-core/master/php/>

* Clean up the file header, similar to other commits under
  <https://gerrit.wikimedia.org/r/q/message:ingroup+owner:Krinkle>.

Change-Id: I94de8299c184fee8c05b7108448255fcf36f8260
2022-11-04 22:25:46 +00:00
Reedy
a3095fbb94 Add return type to jsonSerialize()
Bug: T311919
Change-Id: I469deae973ab58ef41aac6a56cea0653a988c05c
2022-07-02 15:34:02 +00:00
Aryeh Gregor
1560b98225 Type hints for ArrayAccess and JsonSerializable
These two interfaces' methods have tentative return types in PHP 8.1,
which causes code without the type hints to raise warnings. Where the
type hint is "mixed", we need to use the special declaration
[\ReturnTypeWillChange] in a comment to suppress the warning as long as
we still support PHP < 8.0, which doesn't have a "mixed" type hint.

Bug: T289879
Change-Id: I1a126e602e92b8d13c7795eb6d790effd5ddc986
2022-04-11 15:06:27 +03: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
DannyS712
c80841f58b Remove comments that repeat the code
Don't provide any addition information

Change-Id: I4f474537056e34bac74b0d0cd5b4beb800664f90
2021-06-02 08:03:09 +00:00
Umherirrender
78cc6d77ff build: Swap deprecated @codingStandardsIgnore to phpcs:ignore
Bug: T278594
Change-Id: I09a6175917090593e6e0055203a890c32bea03a5
2021-04-04 21:18:22 +02:00
Ostrzyciel
299cd0db9f Implement EditResultCache
EditResultCache is meant to be an easy way for storing and retrieving
EditResults associated with revisions. It stores the data in the main
object stash which is supposed to be mostly persistent. In case the
main stash method fails, it falls back to trying to find the
EditResult in the ct_params field of revert change tags.

EditResultCache is to be used for delaying the execution of
RevertedTagUpdateJob until the edit is approved. The code for that
will be in the next commit in the relation chain.

This is a separate commit just for clarity.

Bug: T259103
Change-Id: I6c0c6556b6d98fcd131beb0957230ce7c7d268da
2020-08-31 08:59:10 +02:00
Ostrzyciel
a3f9ed68ce EditResult: update undo-related docs
Updated the doc block to reflect the changes made in
I9279230303a01461039ae8a4641d9897ce194f73

Bug: T259014
Change-Id: I6aeec4ba75f1e5ac939ef526171d7268902f1f57
2020-08-18 11:08:50 +02:00
Ostrzyciel
67b5a4214c EditResult: enable serialization
Serializable EditResult will be required to save it for later use by
RevertedTagUpdateJob.

Additionally I decided to save the serialization format version in
case we want to modify it in the future.

Bug: T259732
Change-Id: I0cddc9c0439c8a59b5f66cea9e7db5bb151cb53b
2020-08-05 20:38:14 +02:00
Ostrzyciel
7d5fa77324 EditResult: improve documentation
As the EditResult class changes a few things slightly and may be
a bit confusing for developers, I clarified it a bit in the
comments.

It would be probably useful to document this properly on mediawiki.org,
which I'll do once a few things with EditResult are sorted out.

Bug: T254074
Change-Id: Ic8d654ce2c10f079c5a3f417cb2dc0f6e5d7b5b2
2020-07-09 14:19:38 +00:00
Ostrzyciel
3d73bdf568 PageUpdater: create EditResult class
EditResult is an immutable object created during a page update by
the PageUpdater using a builder object, the EditResultBuilder.

EditResult is a container for information on how the edit
interacted with the page and previous revisions. It also aims to
provide a standardized way of describing reverts and reverted
edits. It is as simple as possible, with no dependencies on the DB
or global variables. Most of the logic is encapsulated in the
builder.

PageUpdater::getEditResult() replaces the following methods:
* getOriginalRevisionId()
* getUndidRevisionId()
They are both available in the EditResult object.

PageUpdater::markAsRevert() replaces
PageUpdater::setUndidRevisionId()

Bug: T254074
Change-Id: Ie04c38043d9c295552e488109436ec1df20bb2ca
2020-06-23 11:49:02 +02:00