aboutsummaryrefslogtreecommitdiffstats
path: root/includes/Storage
Commit message (Collapse)AuthorAgeFilesLines
* storage: Push CategoryMembershipChangeJob in ChangeTrackingEventIngressMáté Szabó2025-04-042-47/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - CategoryMembershipChangeJob is currently enqueued in DerivedPageDataUpdater. - This job is responsible for creating RC entries for category membership changes that resulted from an edit, so it is semantically a better fit for ChangeTrackingEventIngress instead. - Idf6625d3e737e4a225648b0fd81cc929b095d315 unintentionally changed the logic to enqueue this job for both direct content changes and reconciliation requests, rather than only direct content changes. Since the job creates RC entries, it should only be enqueued as a result of direct content changes. What: - Move the logic of enqueueing CategoryMembershipChangeJobs into ChangeTrackingEventIngress. - Only enqueue CategoryMembershipChangeJobs for direct content changes and update tests accordingly. - Resolve the old TODO of making this logic MCR-aware by checking whether any changed content slot supports categories as a precondition of enqueueing the job, rather than only checking the main slot. Bug: T390636 Change-Id: Icfe33ccc6cfa391e65ecae21d8c1d575dc247ee3
* Use type declaration on undocumented private functionsUmherirrender2025-04-024-9/+9
| | | | Change-Id: I0d8d2237500ed6f18439410c902d47c42e4119bc
* objectcache: Remove internal StorageAwareness, now unusedTimo Tijhof2025-03-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update a few remnant references inside the library while at it. * WANObjectCache: Didn't use ATTR/QOS directly, and getQoS test already implemnented as BagOStuff const. Update getQoS() docs to match. * WANObjectCache: Already documented ERR_ as BagOStuff::ERR_. And Codesearch confirms no use of `WANObjectCache::(ERR|ATTR|QOS)`. * MemcachedClient: Switch from referencing one to the other. The class is not directly used outside core, only via BagOStuff. * Implicitly remove unused ATTR_EMULATION by not carrying over. Follows-up: * e8275758fe (I20fde9fa5c) Split IExpiringStore from BagOStuff, and re-use in WANObjectCache. * 74be3a0150 (I4377fc3f53) Move ERR_ from BagOStuff to IExpiringStore. * 69950da666 (Ia862c5111a) Replace IExpiringStore with StorageAwareness. * 59b002b866 (I9885f53f00) Remove StorageAwareness::QOS_LOCALITY_. * ec90b543ab (I8dec3f73fa) Remove StorageAwareness::QOS_EMULATION_SQL. * 62bdd78817 (I5649a29310) Adopt ERR_ in MemcachedClient. * e5a3e36bd1 (I836735b1fe) Mark StorageAwareness as internal. Bug: T353529 Bug: T364652 Change-Id: I1dfde995e29d5264611cf3500d61fe4d8631a7d7
* Merge "DomainEvents: Model page state before/after"jenkins-bot2025-03-252-19/+51
|\
| * DomainEvents: Model page state before/afterdaniel2025-03-252-19/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - PageStateEvent models a change in page state, so it should provide access to the state before and after What: - add getPageRecordBefore() and getPageRecordAfter() to PageStateEvent - Move getPage() from PageStateEvent down to PageRevisionUpdatedEvent. - Add getPageId() to PageStateEvent. - Add getDeletedPage to PageDeletedEvent Bug: T388588 Depends-On: I76b09f2275a74d02e5701de2082d6b256d6b3b78 Change-Id: I94c52c0314e5dbe9adf82aab732f2e54ca42f686
* | Namespace all remaining files in includes/changetagsJames D. Forrester2025-03-252-2/+2
| | | | | | | | | | Bug: T353458 Change-Id: I3cf44dfe5425f2efb8409c83571c427447b053af
* | Namespace all remaining files in includes/exceptionJames D. Forrester2025-03-251-1/+1
|/ | | | | | | | | In MediaWiki/Exception, to follow PSR-4 per plural vs. singular (this can be changed later if people really care). Also, move the couple of exceptions in here that were already namespaced in the MW-top-level into the new space. Bug: T353458 Change-Id: I12ed850ae99effb699a6d7ada173f54e72f0570e
* EditResult: only stash revertsdaniel2025-03-212-5/+16
| | | | | | | | | | | | | | | | | | | | Why: - In I38cb5622238bc674 we started to write EditResults to the stash unconditionally. That's several orders of magnitude more than before and would flood the cache. We should only store the EditResult for reverts, and only if RC patrolling is enabled. - While this logic should really be in ChangeTrackingEventIngress, that currently doesn't work because some extensions need the cache to be updated before their hooks run, but the ingress is only triggered post-send. What: - Make DerivedPageDataUpdater skip writing to EditResultCache if the edit is not a revert or RC patrolling is not enabled. Bug: T388573 Bug: T386217 Change-Id: I4ac6efbdc1713c87153e66e0520c9f749a7a2a9d
* Namespace all remaining files in includes/jobqueueJames D. Forrester2025-03-203-6/+6
| | | | | Bug: T353458 Change-Id: I95690a312e356c45dbeed607d32fb0e4626690cf
* Namespace all remaining files in includes/recentchangesJames D. Forrester2025-03-201-1/+1
| | | | | Bug: T353458 Change-Id: I2ae4577de79832b082adca282ff73cfabc8f9392
* Merge "PageUpdater: move revert tag update logic"jenkins-bot2025-03-203-64/+13
|\
| * PageUpdater: move revert tag update logicdaniel2025-03-193-64/+13
| | | | | | | | | | | | | | | | | | | | | | Revert tag updates belong to change tracking, so move them out of the content component. Note: The behavior of updateRevertTagAfterPageUpdated() is covered by the existing RevertedTagUpdateIntegrationTest. Bug: T388573 Change-Id: I38cb5622238bc674ad97d6f47ecd4b8d09f45349
* | Namespace all remaining files in includes/loggingJames D. Forrester2025-03-191-1/+1
|/ | | | | Bug: T353458 Change-Id: Ibe1810f1c71316a9124e1dc6ae405097dafd5267
* Namespace all remaining files in includes/pageJames D. Forrester2025-03-189-9/+9
| | | | | Bug: T353458 Change-Id: I7a9c74f2106655d41ae029742090253f541bd4a6
* DomainEvents: Rename getOldRevision and getNewRevisiondaniel2025-03-151-1/+1
| | | | | | | | | | | | | Why: - Use consistent naming scheme based on "before" and "after" to represent the change. What: - rename getOldRevision to getLatestRevisionBefore - rename getNewRevision to getLatestRevisionAfter Bug: T388588 Change-Id: I30078f606f457981987d95def5b2aaae181f0690
* Merge "DomainEvents: Rename PageEvent and PageUpdatedEvent"jenkins-bot2025-03-143-40/+41
|\
| * DomainEvents: Rename PageEvent and PageUpdatedEventdaniel2025-03-113-40/+41
| | | | | | | | | | | | | | | | | | | | | | | | Why: - clarify naming after modeling discussions What: - Rename PageEvent to PageStateEvent - Rename PageUpdatedEvent to PageRevisionUpdatedEvent. Bug: T388588 Change-Id: I987c93a443d364782e692e2cf71b878ccbc5a2fa
* | Merge "Do not enqueue RevertedTagUpdateJob for null edits"jenkins-bot2025-03-111-1/+1
|\ \ | |/ |/|
| * Do not enqueue RevertedTagUpdateJob for null editsMatěj Suchánek2025-03-101-1/+1
| | | | | | | | | | Bug: T387838 Change-Id: I7bc38f07d1edea71e2dcd62781ec1c7f1fb0d261
* | Merge "DeletePage: emit PageDeletedEvent"jenkins-bot2025-03-101-0/+3
|\ \ | |/ |/|
| * DeletePage: emit PageDeletedEventdaniel2025-03-101-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - We want to replace the PageDeletionComplete hook with an event - We want to validate our design for the hierarchical event type system and the modeling of page events. What: - Introduce PageDeletedEvent - Make DeletePage emit PageDeletedEvent - Move update triggers from DeletePage into ingress objects: - search index - message cache - module cache Bug: T379932 Change-Id: I01490fbaf33118eba109aa91908783117ba5aa20
* | Merge "WikiPage: Emit PageUpdatedEvent when protection changes"jenkins-bot2025-03-081-0/+6
|\ \
| * | WikiPage: Emit PageUpdatedEvent when protection changesdaniel2025-03-071-0/+6
| |/ | | | | | | | | | | | | | | | | | | | | | | | | Why: - All changes that cause a dummy revision to be created should trigger a PageUpdatedEvent. What: - Make WikiPage::doUpdateRestrictions use PageUpdater Bug: T198297 Bug: T384691 Change-Id: Ib3196c2d9b964d149d733688bfc7a8d2b5733f4e
* / PageUpdatedEvent: Model revert causesdaniel2025-03-071-0/+6
|/ | | | | | | | | | | | | | | | Why: - Rollback and undo should not use the "edit" cause, since they are triggered by a dedicated user action. What: - Introduce constants for rollback and undo into PageUpdateCauses. - Set update cause in McrUndoAction, EditPage, WikiPage, and Rollbackpage. - Add test cases asserting the properties of the PageUpdatedEvent for manual reverts, undos, and rollbacks. Bug: T378936 Change-Id: If3174732846795e322ddd61257459395eb10e73e
* Restore PHPDoc comment of PageUpdaterFactory::__construct()Tacsipacsi2025-03-021-0/+23
| | | | | | | | | | | Removed in 60941f701c98190be3de66ff7702003dd6507e30, this comment provides more information than the type declarations—it states the array value type of `$softwareTags`, not only the fact that it’s an array (which is sadly all what type declarations can state). So even if this causes double maintenance, it’s worth being kept because it helps Phan (and IDEs) flag issues. Change-Id: I0f88570454e94743eff2c48da2513db9f3fba741
* DomainEvents: More clearly model null edits and dummy revisionsdaniel2025-02-261-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | Why: - Listeners that want to skip processing if the page content didn't change should generally not skip reconciliation requests. PageUpdatedEvent should offer getters that make this straightforward. What: - Add isNominalContentChange that will return false for dummy revisions but true for null edits. This is the preferred way for listeners to determine whether they can skip redundant processing of page content. - Rename isContentChange to isEffectiveContentChange, to distinguish it from isNominalContentChange. - Rename isRevisionChange to isRevisionHistoryChange, to make it clear that the change affects the sequences of revisions. - Add test cases to PageUpdaterTest asserting the expected update propagation for null edits and dummy revisions. - Change ingress objects so that: - the message cache is updated for null edits - module caches are not cleared for dummy revisions Bug: T383552 Change-Id: Idf6625d3e737e4a225648b0fd81cc929b095d315
* PageUpdatedEvent: include EditResult on null-editsdaniel2025-02-242-1/+12
| | | | | | | | | | | | Why: - PageUpdater creates an EditResult on null-edits, the PageUpdatedEvent should also have it. What: - Call DerivedPageDataUpdater::prepareUpdate for null edits Bug: T386938 Change-Id: Ie6e59e0b089a973f338bafb646893e3334d2ea14
* PageUpdater: allow dummy revisions to be minordaniel2025-02-241-2/+6
| | | | | | | | | | | | | | Why: - When introducing saveDummyRevision() in I1f8c0ac68b, we didn't account for the fact that most (but not all) dummy revisions should be marked as minor edits. What: - Add a $flag parameter to saveDummyRevision() Bug: T198297 Bug: T387067 Change-Id: I1db3ccc816cdb0e2a93593625306a9080b7204eb
* PageUpdatedEvent: improve modeling of flagsdaniel2025-02-202-44/+22
| | | | | | | | | | | | | | | | Why: - Improve consistency, naming, documentation and definition of flags. What: - remove direct access to flags, provide a separate getter for each flag instead. - Deprecate EDIT_SUPPRESS_RC in favor of EDIT_SILENT - Introduce EDIT_IMPLICIT to replace "automated" mode - Introduce FLAG_RECONCILIATION_REQUEST into PageEvent. - Introduce isReconciliationRequest into DomainEvent. Bug: T383552 Change-Id: I2bffbb5810376829f871e1840ca799a8d8232dda
* PageUpdater: make it easy to create dummy revisionsdaniel2025-02-142-14/+66
| | | | | | | | | | | | | | Creating dummy revisions was a fiddly multi-stage process. PageUpdater should just offer a method for doing it. Change how we create dummy revisions in: * LocalFile * MovePage * ImportReporter Bug: T198297 Bug: T384691 Change-Id: I4c7595ce24337ab637a4e0fdbb313fc77d452a15
* Replace call_user_func with dynamic function callUmherirrender2025-02-132-3/+3
| | | | | | | | Use modern php syntax to call a callable. Reduce the stack trace to improve performance and better IDE and static analyzer support Change-Id: I9ef131032a662a3b8db69aa7079dbd51f88f575a
* Merge "PageUpdater: move more updates to ingress objects"jenkins-bot2025-02-082-153/+6
|\
| * PageUpdater: move more updates to ingress objectsdaniel2025-02-062-153/+6
| | | | | | | | | | | | | | | | | | | | | | | | This moves the following update logic out of DerivedPageDataUpdater::doUpdates into listeners for the PageUpdated event: - ResourceLoader: WikiModule::invalidateModuleCache to ResourceLoaderEventIngress. - TalkPageNotifications: TalkPageNotificationManager::setUserHasNewMessages to UserNotificationEventIngress. Bug: T378936 Change-Id: I5f2083b09d90cbd20abe2e8143a000dfc4d02aae
* | When a deleted page is undeleted, the most recent edit should not be tagged ↵Kgraessle2025-02-071-5/+8
|/ | | | | | | with 'Recreated' Bug: T385253 Change-Id: I0a4ddc4187ef4441381fcb15a79a710a4a7891ee
* PageUpdater: no PageUpdatedEvent on derived slot updatesdaniel2025-02-031-7/+3
| | | | | | | | | | | | Why: Derived slot updates modify a revision's meta-data, not the revision content. Also, they may apply to old revisions. They don't fit the semantics of PageUpdatedEvent. What: Suppress PageUpdatedEvent in PageUpdater::doUpdate Bug: T381299 Bug: T378936 Change-Id: Ic70bf675dd18a8b85b056aba3f80f8dec37f2643
* PageUpdatedEvent: explicitly model cause and performerdaniel2025-01-213-49/+139
| | | | | | | | | | | | | | | | | | | | | This introduces the concept of a "cause" and "performer" into PageUpdatedEvent. Causes are e.g. "edit" or "import" or "move". The performer is the same as the author for edits, but not necessarily for undeletions, moves, etc. Note that cause and performer were already being tracked in DerivedPageDataUpdater for logging purposes. PageUpdatedEvent was modeling the cause using flags. This change formalizes the concept of "cause" and "performer" and ensures it is handled consistently. As an aside, this simplifies some test cases in DerivedPageDataUpdaterTest to avoid confused state. Bug: T383031 Bug: T383095 Change-Id: I79bde5604790636c91848f265fffd81d6348a8b4
* DomainEvent: Support type hierarchiesdaniel2025-01-212-298/+1
| | | | | | | | | | | | | | Why: - It's useful to be able to listen to sets of compatible event types. What: - Make DomainEvents aware of a list of types they are compatible with. - Make EventDispatchEngine dispatch to all compatible listeners, registered for any of the supported types. - Move all page events to their own namespace Bug: T384330 Change-Id: I96bde2cfaf198e409a6ef3a24101ee7d02d57959
* Storage,MessageCache: Reference TTL constants from BagOStuffTimo Tijhof2025-01-201-2/+2
| | | | | | | | | | | | | Mark `ExpirationAwareness` as internal, as it is effectively a private trait for the benefit of de-duplication between MapCacheLRU, BagOStuff, and WANObjectCache APIs. Callers should reference constants from the object ($cache::TTL_DAY) or type (BagOStuff/WANObjectCache) that their code is interfacing with. Fix a handful of cases that didn't do this. Bug: T353529 Change-Id: Ic46e09c848e69db3d22219d2231274c81c0cb275
* Remove 2-line PHPDocs that just repeat the types from the codethiemowmde2025-01-179-59/+0
| | | | | | | | | | | | | | | | Same as Ia294bf4 did for 1-line comments. This patch removes slightly more complex 2-line PHPDoc comments that don't add any new information to the code, but literally repeat what the code already says. They say "don't document the code, code the documentation", and we are doing this more and more. We just tend to forget to remove the obsolete comments. Note I'm also removing a line of text in a few cases when it's very short and literally says the same as the method name. Again, such comments add zero new information. Change-Id: I01535404bab458c6c47e48e5456403b7a64198ed
* Remove trivial 1-line PHPDocs that just repeat the codethiemowmde2025-01-162-15/+0
| | | | | | | | | | | | | I assume these are all either auto-generated by an IDE or the language-level type declarations have been added later. In any case the comments don't add any new information to what the code already says. This is just extra clutter that makes the code harder to read, I would argue. There are many, many more comments like this. In this patch I intentionally focus on the most trivial 1-line comments. Change-Id: Ia294bf4ce0d8a77036842fe25884bc175c2b0e7d
* Tag page creations of previously deleted pageKgraessle2025-01-142-2/+48
| | | | | | | | adds a new tag in core titled mw-recreated to note when a new page is a recreation Bug: T56145 Co-Authored-by: Rockingpenny4 <rockingpenny4@gmail.com> Change-Id: Ib8ffe3fba73d0464f3fd353138456b07e7afc7d7
* PageUpdater: do not map EDIT_INTERNAL to FLAG_AUTOMATED.daniel2025-01-071-2/+19
| | | | | | | | | | | | | Why: - Things like rollbacks use the EDIT_INTERNAL flag to bypass the edit stash, but should still be counted as edits. What: - Introduce a separate toggle into PageUpdater for marking an update as automated. Bug: T382592 Change-Id: Iec70d510d7104df0f57885a842b2583250a07135
* Storage: Document error silence reason, use native atTimo Tijhof2024-12-211-19/+17
| | | | | | | | | | | | Follows-up If163674dd0, which introduced new use of AtEase. While at it, convert the other AtEase call to @-operator as well, and improve its documentation to separate the three reasons, and make it obvious which one the two bug/task references belong to. Bug: T380347 Change-Id: Icaf4be5979ef6dce05c9e0511282f47f71f9dd10
* Replace isset() with falsy checksUmherirrender2024-12-191-3/+3
| | | | | | | | | isset() should only be used to suppress errors, not for null check. When the property is always defined, there is no need to use isset. Found by a new phan plugin (2efea9f989) https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#isset Change-Id: I186e799256fbaf5ee77558bd146f9418dd5eaacc
* Merge "storage: move endAtomic() calls in PageUpdater::do(Create|Modify|Update)"jenkins-bot2024-12-181-16/+28
|\
| * storage: move endAtomic() calls in PageUpdater::do(Create|Modify|Update)Aaron Schulz2024-12-171-16/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | This makes some DeferredUpdates run more consistently between web and CLI modes. Previously, deferred updates from before endAtomic() would run during endAtomic() in CLI mode due to the transaction listener in MWLBFactory. The listener callback will be removed soon, in which case those updates would remain deferred after the commit from endAtomic() and would run when the DeferredUpdates::addUpdate call is made for the getAtomicSectionUpdate() update. Depends-On: I33d94c1c54bc266c74c980ef1c73fd99a55c268e Change-Id: I50aa9fe9387c9b7b7ff97dfd39a2830bce647db8
* | Merge "Storage: Suppress error from gzinflate and expand log message"jenkins-bot2024-12-181-7/+11
|\ \ | |/ |/|
| * Storage: Suppress error from gzinflate and expand log messageUmherirrender2024-11-231-7/+11
| | | | | | | | | | | | | | | | Suppress issues with gzinflate and include the blob address on the wfWarn call to get more information for debugging Bug: T380347 Change-Id: If163674dd040459eec692866fc05976e201ee6fe
* | Ensure necessary updates are performed on import and undeletedaniel2024-12-124-88/+294
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ice76519 we lost the mechanism for triggering updates for the search index and message cache on import and undeletion. This change restores the trigger for these updates. To achieve this, the logic for instantiating PageUpdatedEvents is moved into DerivedPageDataUpdater. Perhaps the firing of the event can be moved into that class eventually. To improve consistency, the flags field in PageUpdatedEvent is changed from a bitmap corresponding to the flags field in PageUpdater to an array corresponding to the options array in DerivedPageDataUpdater. For regression testing, this change defines new test traits, one for each ingress. These traits define the expected behavior of each ingress in each relevant situation (edit, move, import, and undeletion). Bug: T381225 Bug: T381299 Change-Id: Ib0d1dd143160fb64d42cacfbc75fbb55f5614c1c
* | Merge "PageUpdatedEvent: improve documentation"jenkins-bot2024-12-011-9/+70
|\ \