Commit graph

7 commits

Author SHA1 Message Date
Aaron Schulz
3c7f29a6b9 Add small HtmlCacheUpdater service class to normalize purging code (2)
This is a re-submit of 35da1bbd7c, which was accidentally merged before
CR (and reverted with aa4da3c2e8).

The purge() method handles purging of both file cache and CDN, using
a PRESEND deferred update. This avoids code duplication and missing
file cache purge calls.

Also:
* Migrate HTMLCacheUpdate callers to just directly using HTMLCacheUpdateJob
* Add HtmlFileCacheUpdate class and defer such updates just like with CDN
* Simplify HTMLCacheUpdate constructor parameters
* Remove BacklinkCache::clear() calls which do nothing since the backlink
  query does not actually happen until the job runs

Bug: T230025
Change-Id: Ic1005e70e2c22d5bd1ca36dcdb618108ebe290f3
2020-04-14 03:19:07 +00:00
Brad Jorsch
d83e00cb92 CdnCacheUpdate: Accept Titles in addition to strings
The class was already documented as "given a list of URLs or Title
instances", this makes that work.

Title objects will have ->getCdnUrls() called when the update is
resolved, which avoids problems like those encountered in T240083 where
that was being called too early.

Bug: T240083
Change-Id: I30b29a7359a8f393fb19ffc199211a421d3ea4d9
2020-03-19 09:56:19 -04:00
Aaron Schulz
f61868f13d Make MergeableUpdate jobs avoid the sub-queue so they can always merge
Change-Id: I5b100fae29b785ab4524d165dad2e8ee46406b0c
2018-10-12 00:36:39 +00:00
Timo Tijhof
31c461e75e deferred: Improve DeferredUpdates test coverage
From 1% of lines to 12% in deferred/.
From 6% of lines to 68% in DeferredUpdates.php.

* Adding relevant @covers tags to existing tests.
* Add coverage for MWCallableUpdate.
* Add coverage for MergeableUpdate.

Also:
* Make MergeableUpdate extend DeferrableUpdate.
  1. Because PHPUnit doesn't support implementing multiple interfaces
     in a mock, and would make the mock fail the typehint at run-time.
  2. It DeferredUpdates doesn't support having a MergeableUpdate that isn't
     itself a DeferrableUpdate given the only way to reach that code is past
     methods that are type-hinted with DeferrableUpdate.
  3. Making the interface extend DeferrableUpdate helps produce better and
     earlier errors. Instead of run-time error:
     > Argument 1 passed to addUpdate() must implement interface DeferrableUpdate
     > instance of MergeableUpdate given
     We get:
     > Fatal error: Class .. contains 1 abstract method and must therefore be
     > declared abstract or implement the remaining methods (doUpdate)

Change-Id: Ie384bf849a96bb37dc3e4a4154da2b02889e9fc8
2017-10-12 21:18:12 +01:00
Gergő Tisza
525bfbc8df Switch to librarized version of TestingAccessWrapper
Replaces \TestingAccessWrapper (defined in core) with
\Wikimedia\TestingAccessWrapper (defined in the composer package
wikimedia/testing-access-wrapper).

See https://gerrit.wikimedia.org/r/#/q/topic:librarize-testing-access-wrapper
for downstream patches.

The core version of the class is kept around for a while to avoid
circular dependency problems.

Bug: T163434
Change-Id: I52cc257e593da3d6c3b01a909e554a950225aec8
2017-04-20 14:15:57 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Aaron Schulz
282c5fa9f3 Rename SquidUpdate => CdnCacheUpdate
Squid is not the only possible CDN

Change-Id: Ie2a2955847c5706e630322bbbab71c9d063b378f
2015-12-09 16:31:17 -08:00
Renamed from tests/phpunit/includes/deferred/SquidUpdateTest.php (Browse further)