aboutsummaryrefslogtreecommitdiffstats
path: root/includes/Storage
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Use explicit nullable type on parameter arguments"jenkins-bot2024-10-165-9/+9
|\
| * Use explicit nullable type on parameter argumentsUmherirrender2024-10-165-9/+9
| | | | | | | | | | | | | | | | | | | | | | 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
* | Replace uses of deprecated ChangeTags static methodsJames D. Forrester2024-10-162-5/+7
|/ | | | | Bug: T360664 Change-Id: I3363a225e54bb2cae01ba066d432a8b7b21933d2
* Namespace all remaining classes in includes/parserJames D. Forrester2024-10-153-4/+4
| | | | | Bug: T353458 Change-Id: If02cc9b1ff78e26c1cf8c91ee4695845eb133829
* Remove meaningless @var documentation from constantsthiemowmde2024-10-091-2/+0
| | | | | | | | | A constant is not a variable. The type is hard-coded via the value and can never change. While the extra @var probably doesn't hurt much, it's redundant and error-prone and can't provide any additional information. Change-Id: Iee1f36a1905d9b9c6b26d0684b7848571f0c1733
* Merge "Use import actor store where needed in RC categorisation"jenkins-bot2024-10-031-1/+2
|\
| * Use import actor store where needed in RC categorisationDreamy Jazz2024-10-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - When temporary users are enabled, creating IP actors is disallowed apart from specific cases, such as importing revisions authored by anonymous users. - If such a revision includes a category link and wgRCWatchCategoryMembership is true, MediaWiki will fire a job to create a corresponding RC entry, which will attempt to attribute the RC to the anonymous IP that authored the imported revision and fail in doing so. What: - Track whether a category membership change job was triggered by an import, and allow RecentChange objects created by such jobs to create anonymous actors. Test Plan: 1. On a wiki with temporary accounts enabled and wgRCWatchCategoryMembership = true, import a revision via Special:Import that was authored by an anonymous user and contains a category link. 2. Verify that the import succeeds and that the corresponding RC entry shows up. Bug: T373318 Change-Id: I89abdca9c4ab8796a211df8b37c1bd7173a496e5
* | Add namespace to remaining parts of Wikimedia\ObjectCacheJames D. Forrester2024-09-276-6/+6
|/ | | | | Bug: T353458 Change-Id: I3b736346550953e3b2977c14dc3eb10edc07cf97
* Add namespace to IDBAccessObject and DBAccessObjectUtilsJames D. Forrester2024-09-273-4/+4
| | | | | Bug: T353458 Change-Id: I23cf7991f8792d4d000d1780463d8ce76dc0aee0
* nametablestore: simplify NameTableStore::acquireId() and update commentsAaron Schulz2024-09-242-63/+61
| | | | | | | | | | | | | Make store() handle cache purging upon new ID insertion and fetching of the winning ID when raced out. This avoids the reloadMap() call. Remove connection flag hack in reloadMap() given 0cb0f0ba7. Remove comments about retryStore() logic removed in 505bd8e70f. Clean up return types for the ID:name arrays. Change-Id: Ic57eb5e2b59da67c6511b935d9e68ffb595028fa
* Remove unchecked exception annotationsAdam Wight2024-09-173-7/+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
* Add missing documentation to class properties (miscellaneous classes)Umherirrender2024-09-141-0/+1
| | | | | | | | | | 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: I1da4b272a6b28c419cc8e860d142dae19ca0bbcf
* Add missing documentation to class properties in NameTableStoreFactoryUmherirrender2024-09-071-2/+2
| | | | | | | | | | | | 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. This also avoid false positive from phan Change-Id: I4b182fda29e9cb9719c26fd01a609de2453be56d
* Storage: Remove transaction cancel callback from NameTableStoreAmir Sarabadani2024-08-301-103/+13
| | | | | | | | | | | | | | What it's trying to achieve can be done much simpler by just making an out of transaction connection via setting CONN_TRX_AUTOCOMMIT flag. Removing this allows us to get rid of a large portion of transaction management in rdbms library as this is the only place that uses cancel callbacks. Split out of I3cb1e30611b83c0 Bug: T372169 Change-Id: Idad029b6da6b09e084d466d282ef1145ebd8fe73
* Merge "objectcache: Consolidate WRITE_PRUNE_SEGMENTS into WRITE_ALLOW_SEGMENTS"jenkins-bot2024-08-121-1/+1
|\
| * objectcache: Consolidate WRITE_PRUNE_SEGMENTS into WRITE_ALLOW_SEGMENTSTimo Tijhof2024-08-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of making the caller responsible for knowing what we do internally at each step, rebrand WRITE_ALLOW_SEGMENTS as generally "do stuff for segments", not only creating them, but also deleting them. * Easier to find and verify correct usage. * Easier to understand parity between set() and delete(). * Documentation for deleteMulti() already said this, by mistake. * Reduce amount of required knowledge. There is only 1 usage in Codesearch Everywhere (in PageEditStash here in core), with no known usage anywhere else. Hypothetically, if it were used, this commit keeps compat by aliasing WRITE_PRUNE_SEGMENTS to WRITE_ALLOW_SEGMENTS. Change-Id: Iea10b23f06243814c35ccd02a4a878cdc1195c76
* | Move Language and friends into Language namespaceJames D. Forrester2024-08-102-2/+2
| | | | | | | | | | Bug: T353458 Change-Id: Id3202c0c4f4a2043bf97b7caee081acab684155c
* | Move remaining four classes in includes/content into Content namespaceJames D. Forrester2024-08-107-9/+9
|/ | | | | Bug: T353458 Change-Id: Ia0f3e22078550be410c4b87faf6aa4eabe6e270d
* Merge "Add namespace to the root classes of ObjectCache"jenkins-bot2024-07-102-2/+2
|\
| * 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
* | Make PageUpdater accept PageIdentityDaimona Eaytoy2024-07-103-29/+41
|/ | | | | | | | | | Internally it still uses WikiPage. While this change shouldn't have any effect in theory, this is not guaranteed because WikiPage is not stateless and if different parts of the code use different instances we may see unexpected errors. Hence, this patch is limited to the bare minimum so that it's easier to revert if necessary. Change-Id: I2c18a62ccc04720a2ef25298515850e91fb288e9
* Migrate MediaWiki.editstash to statslibfrankie2024-06-131-15/+25
| | | | | | | Modifies incrStatsByContent in order to migrate cache_misses, cache_hits to Prometheus backend Bug: T359465 Change-Id: I78afac7437bc2849b64f43c23477d702b94e907b
* Change some type hints from IDatabase to IReadableDatabaseUmherirrender2024-05-241-2/+3
| | | | | | Use narrow interface if no writes are done Change-Id: I55148c8b6fda8830a29a235c63fc118f636ab3e6
* Add namespace and deprecation alias to RefreshSecondaryDataUpdateEbrahim Byagowi2024-05-201-1/+1
| | | | | | | | | This patch introduces a namespace declaration for the MediaWiki\Deferred to RefreshSecondaryDataUpdate and establishes a class alias marked as deprecated since version 1.43. Bug: T353458 Change-Id: I9ee3282918f8f3d444a12ca32434a15e93952055
* Import InvalidArgumentException at top of the sourceEbrahim Byagowi2024-05-191-1/+2
| | | | | | | | | | | | | | It was asked in a patch review to apply fully import InvalidArgumentException where possible. I was guessing some of my other already merged patches have but turned out such thing exists other places style so for the sake of consistency I've turned rest of inline import of the specific exception at top of the file. There are instances of source files that aren't in any namespace but have fully qualified import which this patch doesn't touch. Change-Id: I4071fc698b65746d9594cf4d5f45bae82843d436
* Add namespace and deprecation alias to FormatJsonEbrahim Byagowi2024-05-162-2/+2
| | | | | | | | | This patch introduces a namespace declaration for the MediaWiki\Json to FormatJson and establishes a class alias marked as deprecated since version 1.43. Bug: T353458 Change-Id: I5e1311e4eb7a878a7db319b725ae262f40671c32
* Merge "Formally deprecate code marked with @deprecated"jenkins-bot2024-05-041-1/+1
|\
| * Formally deprecate code marked with @deprecatedJames D. Forrester2024-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some of these have been marked in-code as deprecated for a long while, but haven't ever been announced in the RELEASE-NOTES (and later, HISTORY) file, so let's mark them up now so we can get the ball rolling at least. Per Gergo, the AuthManager one was 'born deprecated' and should only have been used by humans also reading the deprecation notice given in the code, and indeed no uses are known to code search, so also emit deprecation warnings there immediately; others will have to wait until uses have been migrated. Change-Id: I0c1c71d8f4293623039302da35d58d2a24367e97
* | Merge "SqlBlobStore: Directly store ES addresses in content table"jenkins-bot2024-05-031-18/+28
|\ \ | |/ |/|
| * SqlBlobStore: Directly store ES addresses in content tableAmir Sarabadani2024-04-301-18/+28
| | | | | | | | | | | | | | | | Introduce "es:" which has ?flags= as url parameter and store that instead. Bug: T362566 Change-Id: I9d8409fdbd757ef061aa38ff6248cf614f6ef2de
* | Stop using LoadBalancer::getConnectionRef() so it can be hard-deprecatedAmir Sarabadani2024-04-301-1/+1
| | | | | | | | | | Bug: T326274 Change-Id: I90493d7cd4c21fdc022bcc19765fc04d986a9c8f
* | IReadableDatabase::select cannot return falseUmherirrender2024-04-181-5/+1
|/ | | | | | | | | | | | Remove check for false from IDatabase::select as this is not possible A DBQueryError is thrown (documented since efda8cd3 / I056b7148) Use IResultWrapper::numRows to check for empty IResultWrapper This ignores includes\libs\rdbms as QUERY_SILENCE_ERRORS is an internal option to get false from this function Change-Id: I4b2fc26ca0e68612f6beadc01e68097a74962c84
* Merge "rdbms: Remove more usages of DBAccessObjectUtils::getDBOptions()"jenkins-bot2024-02-271-1/+31
|\
| * rdbms: Remove more usages of DBAccessObjectUtils::getDBOptions()Amir Sarabadani2024-02-221-1/+31
| | | | | | | | | | | | | | | | | | Also remove the fallback index and options as it was agreed upon in the ticket as its needlessly complicates the function and is only used in SqlBlobStore which can have its own copy of the function Bug: T354194 Change-Id: I38b179c9bfeb7d2c3e92fa4845dce19558f45a0f
* | Remove IDBAccessObject from being implemented in many classesAmir Sarabadani2024-02-192-2/+2
|/ | | | | | | | | | | | This is inconsistent with the access pattern of other constants in MediaWiki. it's also confusing (e.g. it's unclear to a newcomer why UserFactory is implementing IDBAccessObject) and it's prone to clashes (e.g. BagOStuff class has a clashing constant). It has been already announced: https://w.wiki/9DAX Bug: T354194 Change-Id: Ic2357634b8385d65b55db2b557191419b06c40e0
* Remove more indirect calls to IDBAccessObject::READ_* constantsAmir Sarabadani2024-01-232-4/+5
| | | | | | | | | | Found via (?<!IDBAccessObject)::READ_ We are planning to deprecate and remove implementing IDBAccessObject interface just to use the constants. Bug: T354194 Change-Id: I89d442fa493b8e5332ce118e5bf13f13b8dd3477
* Merge "Directly call IDBAccessObject constants instead of implementing it"jenkins-bot2024-01-152-4/+4
|\
| * Directly call IDBAccessObject constants instead of implementing itAmir Sarabadani2024-01-102-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | Instead of calling self::READ_* on these constants, just directly call it. Since these classes are public and might be relied on directly in other places, we can't remove the "implements IDBAccessObject" yet but we will start doing that soon. Bug: T354194 Change-Id: I3e26b9fc7f93efdfc55a1790a7cdfa5c0d562303
* | Replace various magic numbers with easy-to-verify expressionsTimo Tijhof2024-01-111-5/+8
|/ | | | | | | | | | | | | | | | | | | | | Follows-up I8518e0488 (9c02258a04). Instead of documenting how to compute the number to manually verify it, use the expression directly. This should make it significantly easier to understand, verify, and modify. Noteworthy: * Language.php, I kept 31_556_952 as-is because the calculation would otherwise involve a float. It also has the benefit of allowing the long durations to build upon that as a given number. * SqlBlobStore.php, remove this irrelevant default value as it is unreachable. The only call to new SqlBlobStore is BlobStoreFactory, which always calls setCacheExpiry. For back-compat and to keep tests as-is, move to re-used constant between class and config. Change-Id: I86b034883bd7efdf93b8365b43178af826f1c703
* deferred: Add a freshness option to RefreshSecondaryDataUpdateUmherirrender2023-12-271-2/+4
| | | | | | | | | | | | | | | | Allows to trigger RefreshSecondaryDataUpdate jobs with a timestamp to ensure a link update was done after that timestamp. Since e5655255 it is possible that RefreshSecondaryDataUpdate gets queued for api action=purge, but RefreshSecondaryDataUpdate only checks that the links update is done after the last edit, so when jobs get queued by action=purge, the jobs does nothing. Ensure that page_links_updated gets updated via action=purge when the timestamp is before the new freshness timestamp (checked in RefreshLinksJob::isAlreadyRefreshed). Bug: T351729 Change-Id: I85aed4c40d430ba6c30c763141f4b821c36e6eaf
* Merge "Inline once-called short private methods to its caller, part 1"jenkins-bot2023-12-191-11/+1
|\
| * Inline once-called short private methods to its caller, part 1Amir Sarabadani2023-12-181-11/+1
| | | | | | | | | | | | | | | | | | This makes the code easier to read to avoid jumps and improves encapsulation by not allowing the rest of the class having access to the logic. Of course, if needed then some code can be refactored out again but for now let's not do YAGNI. Change-Id: Ic37524e386fc04fd67e33768417ff8425f85b0ca
* | Namespace ParserOutputJames D. Forrester2023-12-144-4/+4
|/ | | | | | | Most used non-namespaced class! Bug: T353458 Change-Id: I4c2cbb0a808b3881a4d6ca489eee5d8c8ebf26cf
* Use thousands separators in selected integer literalsTim Starling2023-12-121-1/+1
| | | | | | | | | | For readability. Allowed since PHP 7.4. I searched for integer literals of 6 or more digits, and also changed some nearby smaller numbers for consistency. Bug: T353205 Change-Id: I8518e04889ba8fd52e0f9476a74f8e3e1454b678
* PageEditStash: Deprecate passing Wikipage to parseAndCache()Ammarpad2023-11-281-2/+1
| | | | | | There are no remaining callers with Wikipage Change-Id: I33bcda004399348cab47a12673ca757668ab7d18
* Namespace remaining files under includes/deferredJames D. Forrester2023-11-224-8/+8
| | | | | Bug: T166010 Change-Id: Ibd40734b96fd2900e3ce12239d09becfb4150059
* Make ParsoidOutputAccess a wrapper over ParserOutputAccessSubramanya Sastry2023-10-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Updated ParserOutput to set Parsoid render ids that REST API functionality expects in ParserOutput objects. * CacheThresholdTime functionality no longer exists since it was implemented in ParsoidOutputAccess and ParserOutputAccess doesn't support it. This is tracked in T346765. * Enforce the constraint that uncacheable parses are only for fake or mutable revisions. Updated tests that violated this constraint to use 'getParseOutput' instead of calling the parse method directly. * Had to make some changes in ParsoidParser around use of preferredVariant passed to Parsoid. I also left some TODO comments for future fixes. T267067 is also relevant here. PARSOID-SPECIFIC OPTIONS: * logLinterData: linter data is always logged by default -- removed support to disable it. Linter extension handles stale lints properly and it is better to let it handle it rather than add special cases to the API. * offsetType: Moved this support to ParsoidHandler as a post-processing of byte-offset output. This eliminates the need to support this Parsoid-specific options in the ContentHandler hierarchies. * body_only / wrapSections: Handled this in HtmlOutputRendererHelper as a post-processing of regular output by removing sections and returning the body content only. This does result in some useless section-wrapping work with Parsoid, but the simplification is probably worth it. If in the future, we support Parsoid-specific options in the ContentHandler hierarchy, we could re-introduce this. But, in any case, this "fragment" flavor options is likely to get moved out of core into the VisualEditor extension code. DEPLOYMENT: * This patch changes the cache key by setting the useParsoid option in ParserOptions. The parent patch handles this to ensure we don't encounter a cold cache on deploy. TESTS: * Updated tests and mocks to reflect new reality. * Do we need any new tests? Bug: T332931 Change-Id: Ic9b7cc0fcf365e772b7d080d76a065e3fd585f80
* DerivedPageDataUpdater: Do HTMLCacheUpdate on file page redirect changesBartosz Dziewoński2023-09-261-3/+10
| | | | | | | | | | | | | Previously, we never scheduled HTMLCacheUpdate jobs on file page edits or creations, but it is necessary when the page's redirect target has changed, or it's created as a redirect. (We now do it unnecessarily when a redirect page is edited without changing the target, but that's more difficult to detect at this point.) Bug: T238426 Change-Id: I6775a4fb7239d49de88e22e45082ab474cfaaa8b
* DerivedPageDataUpdater: Only do RefreshLinks on file page redirect changesBartosz Dziewo?ski2023-09-261-1/+4
| | | | | | | | | | | | | | Previously, we scheduled recursive RefreshLinks jobs on every file page edit, but it's only necessary when the page's redirect target has changed. Optimize this, and only schedule them when the page is or was a redirect. (We still do it unnecessarily when a redirect page is edited without changing the target, but that's more difficult to detect at this point.) Bug: T346383 Change-Id: Ie629881c94a7a81ae7bf597aab4587921d1c25ae
* DerivedPageDataUpdater: Fix unset $this->pageState['oldRevision']Bartosz Dziewoński2023-09-261-5/+2
| | | | | | | In only this code path, $this->pageState['oldRevision'] was left unset. Other code expects it to be null, but not unset. Change-Id: I15023834ffbac307924aee4028f3b7fe75fbabeb