aboutsummaryrefslogtreecommitdiffstats
path: root/includes/language/MessageCache.php
Commit message (Collapse)AuthorAgeFilesLines
...
* MessageCache: Don't initialize messageKeyOverrides in the constructormainframe982023-03-191-1/+0
| | | | | | | Follow-up to I89e1a9b901aff6ff1bde729df8958ba42a45f3d5 where I forgot to remove this line after initialization was moved to MessageCache::get. Change-Id: Iae441ccedba08eb12685d81381259aad49b7b42f
* MessageCache: Add a new hook for more performant override fetchingmainframe982023-03-141-1/+25
| | | | | | | | | | | | | | | | This new hook is called only once, for all overrides, instead of every time a message is fetched. Overrides can be specified as string or a callable, to allow for dynamically computing the override on-demand. These callables are passed the message key, MessageCache instance, the language and a boolean indicating if the message should be fetched from the database. The parameter choices are based upon current usages of the MessageCache::get hook. Bug: T328183 Change-Id: I89e1a9b901aff6ff1bde729df8958ba42a45f3d5
* Reorg: Namespace the Title classJames D. Forrester2023-03-021-0/+1
| | | | | | | | | | | | | | | | | | | This is moderately messy. Process was principally: * xargs rg --files-with-matches '^use Title;' | grep 'php$' | \ xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1' * rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \ xargs rg --files-with-matches 'Title\b' | \ xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1' * composer fix Then manual fix-ups for a few files that don't have any use statements. Bug: T166010 Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
* MessageCache: immediately update the local cache upon hash mismatchAaron Schulz2023-02-221-1/+3
| | | | | | | | The $hashVolatile exception should only apply if the only reason the local cache is considered stale is due to hash key volatility. Bug: T258860 Change-Id: I03f595e000cec5a6f14c26c8096456ad3bb153aa
* MessageCache: improve handling of I/O errors from cache lock keysAaron Schulz2023-02-081-36/+71
| | | | | | | | | | | If the cluster cache lock fails due to an I/O error, we should fallback to loading from the DB using a local server lock and only update the local server cache. Fix some code comments and documentation. Bug: T258860 Change-Id: I672908a0f042f52dc0847a1f8e73723d35cdbc88
* docs: Add missing StubUserLang type to some @param/@returnUmherirrender2023-01-121-1/+2
| | | | Change-Id: Ic1f192c7a21e529113fd7d537a79b2e4f8983b9c
* Replace some tivial ??= with even more trivial ??thiemowmde2022-12-231-2/+2
| | | | | | | | | Patch Ifa7a9bc replaced some longer `=== null` constructs with the new ??= operator we have since PHP 7.4. However, some of these can be simplified even more with the ?? operator we have since PHP 7.0. Follow-Up: Ifa7a9bc7b2ec415ad7ecb23f4c1776f51f58fd6b Change-Id: I7b05e723810558bb5437adc97eab54ca04d38c06
* Make use of ??= in more placesDannyS7122022-12-171-3/+1
| | | | | | New feature from PHP 7.4 Change-Id: Ifa7a9bc7b2ec415ad7ecb23f4c1776f51f58fd6b
* Make use of ?:, ?? and ??= operators in mostly trivial casesthiemowmde2022-12-051-4/+1
| | | | | | | | | | The motivation is to make the code less confusing. I hope this is the case. ?? is an older PHP 7.0 feature. ??= was added in PHP 7.4, which we can finally use. Change-Id: Id807affa52bd1151a74c064623b41d950a389560
* Reorg: Move StubObject classes in includes to its own directoryAmir Sarabadani2022-10-251-0/+1
| | | | | Bug: T166010 Change-Id: Idcf0e9dc6e0841e4f132207bce0f96774dad898c
* Use short array destructuring instead of list()Tim Starling2022-10-211-5/+5
| | | | | | | | Introduced in PHP 7.1. Because it's shorter and looks nice. I used regex replacement. Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
* Revert "MessageCache: Avoid 'contributions' replicas"Lucas Werkmeister2022-08-031-5/+1
| | | | | | | | | The 'contributions' group no longer exists, no need to avoid it. This reverts commit 6efee6f0dbe9340badbc973aa5fab8413f35a6a6. Bug: T314493 Change-Id: I548077fa3122e9bd5b6cbec990a3dcabffe1659e
* language: Improve type hints in MessageCache.phpTimo Tijhof2022-07-151-20/+11
| | | | | | | | | | * Replace is_/throw with native where possible. * Prefer strict comparisons where possible. * Remove `@throws` for exceptions that are not meant to be checked or caught by callers. * Make the separateCacheableRows() return hint more precise. Change-Id: I1c14bb8faaf1b377b6d179d96e18331acff23c5b
* MessageCache: Don't load the content for uncacheable rowsTim Starling2022-07-151-26/+55
| | | | | | | | | | Attempting to load the content for 30,000 revisions on metawiki routinely times out after 60 seconds. So split the result array from the revision query and treat cacheable revisions differently to uncacheable ones. Bug: T313004 Change-Id: I26185f256cbc0a1f664efe65c73131b92a3084dc
* MessageCache style updatesTim Starling2022-07-151-115/+123
| | | | | | | | | | * Inject config * Use a consistent single-line comment style * Don't prefix properties with "m" * Use "private" instead of "protected". No matches in codesearch for /(new|extends) MessageCache/. Change-Id: Id0cad8a8fa73fb972c13b5386c31658f534e2584
* language: Disable MessageCache if load() throws an exceptionTim Starling2022-07-151-1/+17
| | | | | Bug: T313004 Change-Id: I5e74e371090c2ce7578d540c5a1a85111bd3c70f
* language: Add missing `@ingroup`, subgroup "Languages" and ungroup filesTimo Tijhof2022-06-281-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | == Ungroup file blocks Remove `@ingroup` from `@file` blocks and keep only the class block. This matches similar changes previously applied to API, Skins, Profile, and ResourceLoader. This helps make the API documentation easier to navigate. E.g. Modules -> Language in the sidebar of <https://doc.wikimedia.org/mediawiki-core/master/php/> as well as <https://doc.wikimedia.org/mediawiki-core/master/php/group__Language.html> These are currently cluttered with tons of duplicate entries for files and classes both. We only need to group files that aren't also documented as a class (e.g. message files, entry points, other scripts or files that we mainly consider a data file). This has the helpful side-effect that we don't encourage duplication of the class description (or worse, place useful docs only in the file block), and makes the class files consistently start with a mentally ignorable block. Basically, unless there's something other than a class, don't describe or group the file itself. == Missing group Various classes in this subtree were missing the `Language` group, or were using different group from before T225756. == Subgroup For ease of navigation, move Converter subclasses to a group called "Languages", which for documentation purposes is a subgroup of "Language". The next commit does the same for Messages* files, and Language subclasses (done separately for ease of review). Change-Id: I301f471f86ba2dee924fece29a16dc3c20b5bebe
* language: Move l10n-related classes from /cache to /languageTimo Tijhof2022-06-281-0/+1495
* Make the code easier to own and maintain by being part of a topical area of expertise rather than a generic catch-all bucket. This also helps Gerrit team dashboards, [[mw:Git/Reviewers]] subscription patterns, more meaningful component prefix for [[mw:Commit_message_guidelines]]. * Prep for possible CODEOWNERS adoption. * Prep for T166010 to give us better PSR-4 namespaces that we won't have to break/migrate again shortly after for the above. Bug: T225756 Change-Id: I62c701d574d2a79365b1c5350f92bef47770e3ce