aboutsummaryrefslogtreecommitdiffstats
path: root/includes/Revision
Commit message (Collapse)AuthorAgeFilesLines
* Use type declaration on undocumented private functionsUmherirrender2025-04-022-6/+6
| | | | Change-Id: I0d8d2237500ed6f18439410c902d47c42e4119bc
* Namespace all remaining files in includes/exceptionJames D. Forrester2025-03-252-3/+3
| | | | | | | | | 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
* Namespace all remaining files in includes/recentchangesJames D. Forrester2025-03-201-1/+1
| | | | | Bug: T353458 Change-Id: I2ae4577de79832b082adca282ff73cfabc8f9392
* Namespace all remaining files in includes/pageJames D. Forrester2025-03-181-1/+1
| | | | | Bug: T353458 Change-Id: I7a9c74f2106655d41ae029742090253f541bd4a6
* content: Improve class docs for various Content classesTimo Tijhof2025-03-121-1/+1
| | | | | | | | | | | | | * Move duplicate brief and ingroup from file doc to class doc. <https://gerrit.wikimedia.org/r/q/message:ingroup+owner:Krinkle> * Ensure methods have an understable brief, separate from other text. <https://www.mediawiki.org/wiki/Manual:Coding_conventions/Documentation> * Remove obsolete `todo` comments. Bug: T364652 Change-Id: I6eebbf20775e73d008ef86c592a7128456abcb06
* Merge "RevisionStore: Remove redundant code in getQueryInfo"jenkins-bot2025-03-081-22/+20
|\
| * RevisionStore: Remove redundant code in getQueryInfoReedy2025-02-261-22/+20
| | | | | | | | | | | | No point doing array_merge() when the LHS is an empty array Change-Id: Iaffe7cc11c65d9616b27e1afcf76004ae18aa426
* | Merge "rdbms: Remove usages of passed-in DB handle from transaction callbacks"jenkins-bot2025-02-261-3/+1
|\ \ | |/ |/|
| * rdbms: Remove usages of passed-in DB handle from transaction callbacksMáté Szabó2025-02-121-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - When a transaction lifecycle callback such as onTransactionPreCommitOrIdle() is invoked by rdbms, rdbms passes in the DB connection handle the callback was scheduled on. - However, the DB connection handle may have since been reset to a different DB domain on the same physical cluster due to connection reuse. - We could implement bookkeeping to keep track of the expected DB domain for each pending callback and ensure the passed-in DB handle matches that before invoking the callback, but nobody seems to be making use of the passed-in DB handle except for two call sites in core. - As such, it seems more prudent to remove this functionality. What: - Update the only places that use the DB handle passed to transaction lifecycle callbacks to not use it. Bug: T386190 Change-Id: If682ec26d3599add9dbe06c7a386c95162b5184a
* | RevisionStore: Don't use a Title for archived revisionsdaniel2025-02-131-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - The title information stored in archived revisions may not represent a valid title by current standards. This will cause Title::isValid() to return false, which makes Title::canExist() return false, which causes the constructor of RevisionArchiveRecord to throw an assertion error. What: - Use a PageIdentityValue to represent the page the archived revision belongs to. PageIdentityValue doesn't perform validation or normalization, so it is unaffected by changes to configuration. Bug: T384628 Change-Id: I4cc1dabd9c7aee94e191f75addd44327788a5d13
* | Merge "Replace call_user_func with dynamic function call"jenkins-bot2025-02-135-7/+7
|\ \
| * | Replace call_user_func with dynamic function callUmherirrender2025-02-135-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | | RevisionStore: improve grammar of error messageNovem Linguae2025-02-121-2/+2
| |/ |/| | | | | | | Bug: T386162 Change-Id: Ie28653de99ea8b87f52b0e6ccae8179efb797a08
* | Replace a few misplaces is_object checksthiemowmde2025-02-121-5/+4
|/ | | | | | | | | | | | is_object is very rarely what we actually need. In many cases we know exactly what the object can be, and should check for that specific class or for null. A database row is an instance of stdClass. Checking that with is_object also works but is less correct and would allow stuff we cannot accept in these places. Change-Id: I1dc663d7325cabc059ef11c4845b0189208e907f
* Remove 2-line PHPDocs that just repeat the types from the codethiemowmde2025-01-176-31/+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-9/+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
* RevisionStore: No first revision of non-existing pagedaniel2025-01-151-0/+12
| | | | | | | | | | | | | | | | Why: - Non-existing pages can't have revisions. - If we look up a first revision during a page move, we may wrongly get revisions of another page, due to a stale replica or snapshot. - Ideally, we'd avoid the staleness, instead of using this work-around. What: - make getFirstRevision() return null if the page doesn't exist. Bug: T380677 Change-Id: I009aef656ccb7eb142a6338a4d17597bcd5ca7f3
* Merge "Revision: make RevisionRecord::getPage() return a value object"jenkins-bot2025-01-085-3/+77
|\
| * Revision: make RevisionRecord::getPage() return a value objectdaniel2025-01-085-3/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RevisionRecord::getPage() returns a PageIdentity, which may be a Title or a WikiPage. In the context of an ongoing page deletion, the state of these objects may change and the page ID may get set to 0. To provide a reliable stable interface that can be used e.g. in a deferred update or job, we need to return an immutable value object instead. NOTE: this may break callers of getPage() that downcast to Title, or that rely on the page ID contained in the returned PageIdentity to be updated dynamically during page creation or deletion. This is a modified version of I7440f8f30b05949. It reverts I4ed5406a8b3aa9, which reverted the original patch. The main difference to the original patch is the additional check in the constructor of the RevisionRecord base class and the regression test in SignatureValidatorTest. Bug: T380536 Change-Id: I0ea915983b6187090f46ad23c9b582196b4be85f
* | Replace isset() with null check on variables or globalsUmherirrender2024-12-191-1/+1
|/ | | | | | | | | 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: Ia53b71dff3299837856ae3c004cd0227bd45e05b
* Merge "Revert "Revision: make RevisionRecord::getPage() return a value object""jenkins-bot2024-12-164-36/+6
|\
| * Revert "Revision: make RevisionRecord::getPage() return a value object"Subramanya Sastry2024-12-164-36/+6
| | | | | | | | | | | | | | | | | | | | This reverts commit 1e7a520f1f42770f7eaeb4369805b427efa32634. Reason for revert: Given end-of-year timeline and last train of the year, it is more feasible to chase down the issues in 2025 and reapply this patch then. Bug: T381982 Change-Id: I4ed5406a8b3aa9c038544bfac9ea361550b2c72f
* | Ensure necessary updates are performed on import and undeletedaniel2024-12-121-1/+2
|/ | | | | | | | | | | | | | | | | | | | | | 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
* Revision: make RevisionRecord::getPage() return a value objectdaniel2024-12-054-6/+36
| | | | | | | | | | | | | | | | RevisionRecord::getPage() currently returns a PageIdentity, which may be a Title or a WikiPage. In the context of an ongoing page deletion, the state of these objects may change and the page ID may get set to 0. To provide a reliable stable interface that can be used e.g. in a deferred update or job, we need to return an immutable value object instead. NOTE: this may break callers of getPage() that downcast to Title, or that rely on the page ID contained in the returned PageIdentity to be updated dynamically during page creation or deletion. Bug: T380536 Change-Id: I7440f8f30b05949842903094908232455f6a2239
* RevisionRecord: add convenience methods for main slotdaniel2024-11-281-0/+22
| | | | | | | | | | | | | When accessing slot content and meta-data, most code wants to only access the main slot. Add convenience methods for making this less awkward. Originally, the intent was for all code to support arbitrary slots. This hasn't happened, instead we spread SlotREcord::MAIN all over the code base. It seems better to adjust the interface of RevisionRecord to reality. Change-Id: I8603f95c8e39d6fc3522a47f74657798e7f7c061
* Use explicit nullable type on parameter argumentsUmherirrender2024-10-1610-39/+39
| | | | | | | | | | | Implicitly marking parameter $... as nullable is deprecated in php8.4, the explicit nullable type must be used instead Created with autofix from Ide15839e98a6229c22584d1c1c88c690982e1d7a Break one long line in SpecialPage.php Bug: T376276 Change-Id: I807257b2ba1ab2744ab74d9572c9c3d3ac2a968e
* Namespace all remaining classes in includes/parserJames D. Forrester2024-10-152-2/+2
| | | | | Bug: T353458 Change-Id: If02cc9b1ff78e26c1cf8c91ee4695845eb133829
* Merge "specials: Catch RevisionAccessException and ignore on Special:Undelete"jenkins-bot2024-10-043-0/+8
|\
| * specials: Catch RevisionAccessException and ignore on Special:UndeleteUmherirrender2024-09-303-0/+8
| | | | | | | | | | | | | | Also add @throws documentation, when the exception needs check by caller Bug: T108495 Change-Id: I2c98381d9c3a639a71e6a8f8f8a5db6f98bcb073
* | Merge "Add namespace to remaining parts of Wikimedia\ObjectCache"jenkins-bot2024-10-032-2/+2
|\ \ | |/ |/|
| * Add namespace to remaining parts of Wikimedia\ObjectCacheJames D. Forrester2024-09-272-2/+2
| | | | | | | | | | Bug: T353458 Change-Id: I3b736346550953e3b2977c14dc3eb10edc07cf97
* | Make revision-slots expiry configurableAlexander Vorwerk2024-09-301-3/+9
|/ | | | | Bug: T183490 Change-Id: I08e35ee64eab081de85ed8745361ebc4c9025d91
* Add namespace to IDBAccessObject and DBAccessObjectUtilsJames D. Forrester2024-09-273-4/+4
| | | | | Bug: T353458 Change-Id: I23cf7991f8792d4d000d1780463d8ce76dc0aee0
* Remove unchecked exception annotationsAdam Wight2024-09-171-1/+0
| | | | | | | | | | | | | | | Callers should not catch an unchecked exception, so it doesn't belong in a function signature. Unchecked exceptions indicate a coding error, which by definition the code will not be able to handle correctly. If any of these exceptions were supposed to be in response to an edge case, user input, or initial conditions, then they should be changed to a runtime error. If the exception class cannot be changed, then the annotation should include a comment explaining its purpose and prognosis. Bug: T240672 Change-Id: I2e640b9737cb68090a8e1cb70067d1b74037d647
* Provide previous parse results to parser when renderingC. Scott Ananian2024-08-232-13/+59
| | | | | | | | | | | | | | | | | | | | | | | | | This patch lays the groundwork for incremental/selective parsing in Parsoid by ensuring that we can pass previous cached parses through the parse pipeline to Parsoid. We do this by adding a new render hint type, `previous-output`, and ensuring it is passed along. Because revisions can contain a ParserOutput which is the combination of separate ParserOutput objects for each of their slots, RenderedRevision also contains a method to unsplit the combined ParserOutput to reconstruct an original ParserOutput for use in incremental parsing. Currently this is mostly a stub, but illustrates how slot combination and splitting can work, assuming those transformations are reversible. Extra calls to ParserCache::getDirty() are added to some code paths in order to ensure that any previously-cached ParserOutput is available for selective update. In order to mitigate any performance concerns, these are only done for the Parsoid parser at the moment. Future patches will add additional metrics to quantify the cost/benefit ratio of the additional cache lookups on these paths. Bug: T363421 Bug: T371713 Change-Id: I440884f1d7e09c1ff9806f848b7b53a636367690
* Move remaining four classes in includes/content into Content namespaceJames D. Forrester2024-08-107-7/+7
| | | | | Bug: T353458 Change-Id: Ia0f3e22078550be410c4b87faf6aa4eabe6e270d
* Use expression builder instead of raw sqlUmherirrender2024-07-232-2/+2
| | | | | Bug: T361023 Change-Id: Ibf1c93ddbf8f680e8fb9442816f6fed94a069c0a
* Add namespace to the root classes of ObjectCacheEbrahim Byagowi2024-07-102-2/+2
| | | | | | | | | And deprecated aliases for the the no namespaced classes. ReplicatedBagOStuff that already is deprecated isn't moved. Bug: T353458 Change-Id: Ie01962517e5b53e59b9721e9996d4f1ea95abb51
* RevisionStore: Add documentation saying to avoid the trap I fell intoPppery2024-06-111-0/+3
| | | | | Bug: T49177 Change-Id: I33de62ce7447659c680562b8b9994511b29c41fd
* Merge "Use StatusValue::getMessages() instead of deprecated methods"jenkins-bot2024-05-291-2/+2
|\
| * Use StatusValue::getMessages() instead of deprecated methodsBartosz Dziewoński2024-05-181-2/+2
| | | | | | | | | | | | | | | | | | This commit replaces some of the uses of getErrorsArray(), getWarningsArray(), getErrorsByType(), and getErrors(). In many cases the code becomes shorter and clearer. Follow-up to Ibc4ce11594cf36ce7b2495d2636ee080d3443b04. Change-Id: Id0ebeac26ae62231edb48458dbd2e13ddcbd0a9e
* | Change some type hints from IDatabase to IReadableDatabaseUmherirrender2024-05-241-6/+6
| | | | | | | | | | | | Use narrow interface if no writes are done Change-Id: I55148c8b6fda8830a29a235c63fc118f636ab3e6
* | Merge "Add MediaWiki\Content namespace to FallbackContent{,Handler}"jenkins-bot2024-05-231-1/+1
|\ \
| * | Add MediaWiki\Content namespace to FallbackContent{,Handler}Ebrahim Byagowi2024-05-211-1/+1
| |/ | | | | | | | | | | | | | | | | This adds MediaWiki\Content namespace to FallbackContent and FallbackContentHandler and declares the unnamespaced version as deprecated since version 1.43. Bug: T353458 Change-Id: I3ee80aea379788b71539cc1c7a4ec216b753e042
* / Allow undeletion of IP revisions when temp accounts are enabledDreamy Jazz2024-05-231-2/+16
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * When wgAutoCreateTempUser['enabled'] is true, calling ActorStore ::acquireActorId for an IP address user will throw a CannotCreateActorException to prevent attributing actions to IP addresses. * When using Special:Undelete to undelete a page that has IP addresses who have made edits, the UndeletePage call to the ActorStore::acquireActorId causes an exception. * However, the revisions already existed so (similar to importing revisions) it does not represent a leak of the IP address. * As such, it should be possible to undelete a page with revisions performed by IP addresses. What: * Add ActorStore::getActorStoreForUndelete which works the same as ActorStore::getActorStoreForImport. Having methods that are named for undelete / import avoids the usage for other code that should use ::getActorStore instead. * Add RevisionStoreFactory::getRevisionStoreForUndelete which uses the ActorStore returned by ActorStore ::getActorStoreForUndelete. * Update the PageCommandFactory to take the RevisionStoreFactory and then call ::getRevisionStore for all but UndeletePage where the ::getRevisionStoreForUndelete method is called. Bug: T362019 Bug: T365669 Change-Id: Ia7c583c625843f4f400e1c4aa7ea360519e63c87
* Merge "Migrate to IReadableDatabase::newSelectQueryBuilder with queryInfo"jenkins-bot2024-05-051-8/+5
|\
| * Migrate to IReadableDatabase::newSelectQueryBuilder with queryInfoUmherirrender2024-05-041-8/+5
| | | | | | | | | | | | | | | | | | | | | | This is using SelectQueryBuilder::queryInfo to interact with legacy code In the long term this needs refactor to get a SelectQueryBuilder from the class instead of a query info array. Bug: T344971 Depends-On: I5dff80a2819bba4e923654ef31816a54269354b3 Change-Id: Ibf44e7de30e71fe8dd6447f77dfd0bf726be0a9b
* | Replace boolval with casting to boolOllie Shotton2024-05-052-2/+2
|/ | | | Change-Id: Ib9851907b00e0fcc94fb568380f5deda76713a42
* Revision: Migrate some calls to IReadableDatabase::newSelectQueryBuilderUmherirrender2024-05-012-49/+59
| | | | | Bug: T344971 Change-Id: I2db52adebc930cb5621e75a125af80cfa7926a2b
* Remove last uses of DBAccessObjectUtils::getDBOptions()Amir Sarabadani2024-04-301-38/+31
| | | | | | | With this and soon T360517 be done, we can hard-deprecate this method. Bug: T354194 Change-Id: Idad6ae65527fdb15ddd46cc41060726e3132620f