Commit graph

563 commits

Author SHA1 Message Date
Max Semenik
ca41a48ffe Hard deprecate LinkCache::addLink()
Deprecated in 1.27, no callers.

Change-Id: Ide39566b6741d2b844ddd5c8e62dd0fc0382670a
2018-12-08 22:23:08 -08:00
Gilles Dubuc
de3fc8f765 Log error when array_flip fails in MessageCache load
Bug: T208897
Change-Id: If6e7a6a3019abbdc11b6604ec706cc88bfddf128
2018-11-19 11:49:23 +01:00
Aaron Schulz
387071ecc2 Avoid broken markup due to conversion table DB queries in Installer:parse()
Bug: T207979
Change-Id: I6a196a64865533a073fadc4a07f5627b67924921
2018-10-27 16:41:33 -07:00
jenkins-bot
ecee5cd7c7 Merge "Use PHP 7 '??' operator instead of if-then-else" 2018-10-24 21:58:04 +00:00
jenkins-bot
13dba84b6f Merge "Fix PHPDoc type for instance variables and methods" 2018-10-24 21:17:02 +00:00
Fomafix
43244db9a2 Use PHP 7 '??' operator instead of if-then-else
Change-Id: If9d4be5d88c8927f63cbb84dfc8181baf62ea3eb
2018-10-21 21:46:46 +02:00
Alangi Derick
b4ecf374fe Fix PHPDoc type for instance variables and methods
Should be "string" not "String" and "array" not "Array" in
@param, @return and @var use cases. Also, minor typo fixes.

Change-Id: I9d5ebc5b741c6560907b95f7c0c4039da2861f4a
2018-10-21 13:00:25 +01:00
C. Scott Ananian
4b1db1190b Tidy Message::parseAsBlock() by enabling tidy in MessageCache
We are incrementally removing places where the parser is used with
tidy disabled, since future parsers will not support such operation.

Bug: T198214
Change-Id: I0f417f75a49dfea873e9a2f44d81796a48b9f428
2018-10-17 02:43:07 +00:00
Aaron Schulz
4fc5ba8bf8 messagecache: check overridable message array in getMsgFromNamespace()
Follow up to a3d6c1411d.

This avoids extra queries for messages that have a software defined value.

Bug: T193271
Change-Id: I25aa0e27200a0b417721cf1fbd34a82095405b89
2018-10-16 20:39:38 +00:00
Kunal Mehta
d0463178df LocalisationCache: Avoid use of compact()
In PHP 7.3, compact() now raises notices if the variable is undefined, which
is something that we expect. So we can check whether the key exists instead
of bothering with compat() and suppressing warnings.

Bug: T206979
Change-Id: I612049db4debd850a2e6d10bc631d31aa17be898
2018-10-15 13:35:30 -07:00
jenkins-bot
578318e688 Merge "Use a ScopedCallback to silence transaction profiler in SqlBagOStuff" 2018-10-12 18:34:02 +00:00
Umherirrender
719bfa8977 Use a ScopedCallback to silence transaction profiler in SqlBagOStuff
This affects most LCStoreDB which is the default cache
and spamming the log.

Bug: T154424
Bug: T97693
Change-Id: I68af177c7d0d88ab266eb3fefb4336eff86d861c
2018-10-12 20:04:31 +02:00
jenkins-bot
d69b967481 Merge "MessageCache: replace should actually replace, not reload" 2018-10-11 20:56:33 +00:00
jenkins-bot
7c091e68e9 Merge "messagecache: avoid caching message pages that do not override" 2018-10-11 18:59:24 +00:00
Brad Jorsch
08e9eb1fef MessageCache: replace should actually replace, not reload
Prior to I462554b30, MessageCache::replace() did just that: it took the
existing cache and updated the one entry.

In I462554b30, the rearrangement of work into a DeferredUpdate
introduced a bug: the in-process cache was updated, but when the shared
cache was loaded later the entry was never updated in there so the
shared caches kept the old value. This was found in code review and
worked around by reloading all the messages from the database instead of
updating the existing cache.

But all that extra work reloading everything from the database causes
major slowness saving any MediaWiki-namespace page when the wiki has
many such small pages. Let's go back and fix the bug so replace() can
again replace instead of reloading everything.

Bug: T203925
Change-Id: Ife8e1bd6f143f480eb8da09b817c85aadf33a923
2018-10-11 11:20:51 -04:00
Brad Jorsch
993baa3493 ActorMigration: Remove possibility of read-both
When this was originally written, the plan was to read both the old and
new fields during the transition period, while stopping writes to them
midway through. It turns out that the WHERE conditions to do read-both
correctly are generally not handled well by the database and working
around that would require a lot of complicated code (see what's being
removed from ApiQueryUserContribs here, for example).

We can simplify things greatly by instead having it write both fields
during the transition period, reading from the old for the first part
and the new for the second part, as is being done for MCR.

Bug: T204669
Change-Id: I4764c1c7883dc1003cb12729455c8107319f70b1
Depends-On: I845f6ae462f2539ebd35cbb5f2ca8b5714e2c1fb
Depends-On: I88b31b977543fdbdf69f8c1158e77e448df94e11
2018-10-11 12:12:00 +11:00
Aaron Schulz
a3d6c1411d messagecache: avoid caching message pages that do not override
Clean up individual message cache handling when the master key is
volatile. The goal is not to treat the message as gone but to re-fetch
it when accessed rather than cache the value in the main/process cache.

Bug: T193271
Change-Id: I4bcaf10c1516e7c96c2d0963722affeaf80272e0
2018-10-10 12:35:07 -07:00
Aaron Schulz
59242afaa7 messagecache: use MergeableUpdate for the deferred replace() update
This combines the load loop for multiple messages for a language code.

Bug: T203925
Bug: T193271
Change-Id: Ie5e1e83d6740344b7ca641c99fb3bd4ad5718492
2018-10-05 20:14:41 +00:00
Aaron Schulz
548c92a332 MessageCache: do not store the EXCESSIVE array as it is only needed for HASH
This saves space as the number of entries becomes larger.

Bug: T193271
Change-Id: I32d7512d7f05ae7c9a69b88cd19df64d7a21b4a1
2018-10-04 02:22:05 +00:00
Aaron Schulz
7d2b121ac8 MessageCache: remove confusing and unused $isFullKey parameter from get()
Follows-up cba0fb1c15, which removed the last caller.

Change-Id: I00c17fedff39b1b35519cff2a0f8eac3e4d6f2ab
2018-10-02 23:34:53 +00:00
Umherirrender
173df1768b Fix logged method in MessageCache::replace/loadCachedMessagePageEntry
Seeing {closure} in the logs as caller is not helpful

Change-Id: Iddfb6042bba2a59a9f21f533b748c96478a87b97
2018-09-30 17:37:51 +00:00
Ed Sanders
8477d4a6f5 Define which languages explicitly fallback to 'en'
In the message store, all messages fall through to English,
but only a few languages should actually explicitly fallback
to English (English variants and dialects).

These new explicit fallbacks are used by ResourceLoaderImageModule,
and this change doesn't affect the message fall through system.

Bug: T203350
Change-Id: I6b68a17f4d69341bccdae748727b5133a600d8bc
2018-09-19 15:55:38 -07:00
James D. Forrester
7cadf392f6 resources: Rename oojs-ui file paths to ooui per general branding
No change to the module names yet.

Change-Id: Ica33520b0128bd56dc06c8951bdc6932fce041fe
2018-09-10 14:35:45 -07:00
Kunal Mehta
e4676f42ff Use StaticArrayWriter in LCStoreStaticArray
...instead of var_export(), which uses array() syntax and spaces for
indentation.

Also get rid of some unnecessary closure indirection.

Bug: T200626
Change-Id: I5db8ade50fcba5ecf394817b2d14295620314ea7
2018-08-27 22:23:08 +00:00
Umherirrender
40d3ce8d17 Reduce calls to MediaWikiServices::getInstance()
In some functions MediaWikiServices::getInstance() was called twices or
in loops. Extract the variable to reduce calls.

Change-Id: I2705db11d7a9ea73efb9b5a5c40747ab0b3ea36f
2018-08-18 06:02:39 +02:00
jenkins-bot
e4a4029517 Merge "Have LinkCache::getMutableCacheKeys() accept LinkTarget" 2018-08-15 20:32:16 +00:00
Niklas Laxström
cb74e93b44 Make LinkBatch::setCaller chainable
To allow for one-liners such as $lb->setCaller( __METHOD__ )->execute();

Change-Id: I45cd81d9e583f09aacb578ffb87d7c11b0e13d57
2018-08-15 10:57:21 +02:00
Kunal Mehta
f503ab10b8 Have LinkCache::getMutableCacheKeys() accept LinkTarget
Change-Id: Id84590b3aa285e31a358877167fe8ff502077f3c
2018-08-14 22:56:27 -07:00
jenkins-bot
6c5bdf5ace Merge "Move l10n_cache table to a separate DB for sqlite via the installer" 2018-08-14 18:32:33 +00:00
Aaron Schulz
1081356412 Move l10n_cache table to a separate DB for sqlite via the installer
This does not set 'db' as the cache type so that admins can still
easily set the cache directory to use the file-based cdb system.
If they do not, then at least the second DB file will be used to
avoid heavy contention.

Bug: T93097
Change-Id: Ib3912f00cf12de99801ebda4f06135b2987ce71a
2018-08-14 17:29:01 +00:00
jenkins-bot
a8b828a774 Merge "Avoid MapCacheLRU error when MessageCache fails to load" 2018-08-14 16:32:07 +00:00
Fomafix
0a0d5cb7f7 Fix typos
Bug: T201491
Change-Id: I25a27d11faabe2f5fa02950c7a4fb58b13fb3662
2018-08-14 09:52:19 +00:00
Aaron Schulz
65ad02955c Avoid MapCacheLRU error when MessageCache fails to load
Bug: T201893
Change-Id: I6093113a3ffa8092dea3351a6ed6c815c7ff7162
2018-08-13 23:03:27 -07:00
Aryeh Gregor
90d4f56fe4 Mass conversion of $wgContLang to service
Brought to you by vim macros.

Bug: T200246
Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
2018-08-11 22:44:29 -06:00
Max Semenik
1facc21e49 Make sure to not unpack an associative array into parameter list
Bug: T200394
Change-Id: I9c28e1cadeb76275d24eb7725f1578bf5ba43ad0
2018-07-28 23:52:57 +00:00
Max Semenik
ae314346d5 Enclose compact() call in error suppression
In PHP 7.3, compact() now emits warnings when a variable doesn't exist.
Because our language files aren't required to contain all the possible
variables, this results in massive spam trying to run tests.

Change-Id: Idab0340ec1cdebfca67cb448e350a408438bcbbc
2018-07-28 08:09:19 -07:00
Aaron Schulz
70b38d4d2b Make MessageCache use APC for big messages
Bug: T118893
Change-Id: I418d0ca490911d7ee4213fe1728cfbc637ef8b10
2018-07-25 13:24:52 -07:00
jenkins-bot
d23c700ef7 Merge "cache: Minor docs for MessageCache interaction with WANObjectCache" 2018-07-25 14:52:44 +00:00
Timo Tijhof
c9bcbaa558 cache: Minor docs for MessageCache interaction with WANObjectCache
Follows-up 04bc03a29a.

Change-Id: I8fb810fc2e08277bb64fa18595483a2161cfb1cc
2018-07-25 13:28:19 +00:00
jenkins-bot
cd5372409f Merge "Make MessageCache use getWithSetCallback() for big messages" 2018-07-22 23:59:18 +00:00
Aaron Schulz
04bc03a29a Make MessageCache use getWithSetCallback() for big messages
Change-Id: I8f93e1dffbcbbabf4d7cb361b001d8ca6e7ad954
2018-07-19 12:41:14 +00:00
Aaron Schulz
b4c8614885 Convert LinkCache to using MapCacheLRU
Clean up the variable names while at it.

Change-Id: I3b7860c0657111d73567e247bcc1ebcbaef53e22
2018-07-16 21:16:00 +00:00
Fomafix
9926033b4f Use Language::equals to compare Language objects
With I8a47a8500922906bd4e4936b59b657de3bb9abdc Language::equals can
directly and faster compare the objects.

$wgLanguageCode can differ from $wgContLang->getCode() when a deprecated
language code is used. This change prevents this because Language
replaces deprecated language codes in Language::factory().

Change-Id: I07f47eceff8b3a4192278b1e9e1cfd9a41816a1c
2018-07-10 01:04:03 +00:00
Umherirrender
130ec2523d Fix PhanTypeMismatchDeclaredParam
Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff

Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
2018-07-07 00:34:30 +00:00
Aaron Schulz
97e86d934b Limit the number of cached languages in MessageCache via MapCacheLRU
Change-Id: I37a128cfc553e0edaab524098461776cec3fe08a
2018-07-03 11:03:14 +00:00
Edward Chernenko
86cf01d433 LCStoreStaticArray: create cache directory when it doesn't exist
Array store (LCStoreStaticArray) should behave as standard LCStoreCDB,
creating the target directory when it doesn't exist.

This fixes unexpected "No such file or directory" errors when
replacing 'files' with 'array' in $wgLocalisationCacheConf['store'].

Change-Id: Ie49cf03ca93ac47fc98665de36e6207bef287193
2018-06-25 18:40:25 +03:00
Aaron Schulz
5c0937b167 Make MessageCache::getMsgFromNamespace() process cache hook-defined keys
Change-Id: I6f8a0c002b54dc48bc3e6902ab1ba41b2f99412a
2018-06-23 17:59:12 +01:00
Aaron Schulz
9b6168da53 Make LinkCache::invalidateTitle() use the instance WAN cache
Change-Id: Idefcee9b37dcb73b2f18351123b097f4ae68fa76
2018-06-14 21:00:38 -07:00
Fomafix
0f1858321c Use PHP 7 '??' operator instead of if-then-else
Change-Id: I790b86e2e9e3e41386144637659516a4bfca1cfe
2018-06-12 23:14:18 +02:00
Fomafix
e1630b6a53 PHP: Use short ternary operator (?:) where possible
Change-Id: Idcc7e4fcdd4d8302ceda44bf6d294fa8c2219381
2018-06-11 11:26:35 +02:00