Commit graph

48 commits

Author SHA1 Message Date
James D. Forrester
8e940c4f21 Standardise all our class alias deprecation comments for ease of grepping
Change-Id: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
2024-03-19 20:11:29 +00:00
James D. Forrester
35b2542895 Namespace includes/cache
Bug: T353458
Change-Id: Ic3f3168ef17113f5fb3ec11e0a47f52d65eefba9
2024-02-20 10:28:03 -05:00
James D. Forrester
67217d08df Namespace remaining files under includes/deferred
Bug: T166010
Change-Id: Ibd40734b96fd2900e3ce12239d09becfb4150059
2023-11-22 10:08:53 -05:00
Daimona Eaytoy
8adf1bfb93 Replace some more usages of deprecated MWException
Bug: T328220
Change-Id: I3c36835fbd90acc301731e2b33ae4815cd4b0cc5
2023-06-09 02:07:08 +02:00
James D. Forrester
fa55ec4c24 Replace some deprecated wfExpandUrl calls with UrlUtils::expand
Bug: T319340
Change-Id: I2d81c2d7fd31bb07a2d2057361f1670cdeb8b8d0
2023-05-30 19:48:01 +00:00
Umherirrender
20c3cc6ef1 Remove unused variable from unpacking arrays
Change-Id: Iac27cb4aa936cb494b3e491ce22c88c7fad375a1
2022-11-22 23:21:08 +00:00
Matěj Suchánek
9e691b0ece Remove some deprecated methods from deferred updates
They have already been deprecated and are unused.

Change-Id: I0d1a45df6b6cf6b144492e51cf6368d25c72565e
2022-11-09 11:37:48 -05:00
Tim Starling
0077c5da15 Use short array destructuring instead of list()
Introduced in PHP 7.1. Because it's shorter and looks nice.

I used regex replacement.

Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
2022-10-21 15:33:37 +11:00
Matěj Suchánek
a4d9bc0c8f Hard deprecate CdnCacheUpdate::newFromTitles
It has been deprecated since 1.35 and it is unused.

Change-Id: I2d5cf9e8a7401d7126e9deed20b3d071ca3998f6
2022-07-10 17:15:08 +00:00
Aryeh Gregor
7b791474a5 Use MainConfigNames instead of string literals, #4
Now largely automated:

VARS=$(grep -o "'[A-Za-z0-9_]*'" includes/MainConfigNames.php | \
  tr "\n" '|' | sed "s/|$/\n/;s/'//g")
sed -i -E "s/'($VARS)'/MainConfigNames::\1/g" \
  $(grep -ERIl "'($VARS)'" includes/)

Then git add -p with lots of error-prone manual checking. Then
semi-manually add all the necessary "use" lines:

vim $(grep -L 'use MediaWiki\\MainConfigNames;' \
  $(git diff --cached --name-only --diff-filter=M HEAD^))

I didn't bother fixing lines that were over 100 characters unless they
were over 120 and triggered phpcs.

Bug: T305805
Change-Id: I74e0ab511abecb276717ad4276a124760a268147
2022-04-26 19:03:37 +03:00
Umherirrender
7b091a2a49 deferred: Improve port handling in CdnCacheUpdate::naivePurge
Avoid null on php internal and cast to int

Found by phan strict checks

Change-Id: Ifb874b366d88cde51960004e5489a9c57ca9c4c6
2022-03-03 21:23:38 +01:00
Umherirrender
68808e5832 Replace deprecated JobQueueGroup::singleton()
Change-Id: Icdb301d352d302f70fefba9b40df2368cb217fd2
2022-01-27 21:37:50 +01:00
TChin
47adb6d65a Refactor global variables to use MediaWikiServices instead
Automatically refactors wg prefixed globals to use MediaWikiServices config using Rector. Doesn't include files that set globals or files that fail CI.

Rector Gist: https://gist.github.com/tchin25/7cc54f6d23aedef010b22e4dfbead228

* This patch uses a modified source code rector library for our specific use case and the rector will have different effects without it.

A writeup for future reference is here: https://meta.wikimedia.org/wiki/User:TChin_(WMF)/Using_Rector_On_MediaWiki

Change-Id: I1a691f01cd82e60bf41207d32501edb4b9835e37
2022-01-10 13:55:53 -05:00
Reedy
7bf779524a Remove or replace usages of "sanity"
Bug: T254646
Change-Id: I2b120f0b9c9e1dc1a6c216bfefa3f2463efe1001
2021-11-19 23:19:42 +00:00
Alexander Vorwerk
4cf2895914 Remove the deprecated IP class
Bug: T291008
Change-Id: I83a0ad6543384be71fa8d057932f8331cc0fdc4f
2021-09-26 13:58:28 +02:00
daniel
0dec104bc0 Deferred updates: remove Title from method signatures.
This allows deferred update tasks to be constructed with a PageIdentity
rather than a Title instance.

Bug: T278459
Change-Id: Ifa2888fdef9ecc97f5bf09ae0b3fa7be48a0e9ef
2021-05-11 11:17:02 +02:00
Aaron Schulz
bb1fdb91ac uuid: Simplify GlobalIdGenerator by removing QUICK_VOLATILE flag
Change-Id: I4f504be5d805281eeb9400cd4fd783c50b561b87
2021-04-14 21:40:35 +00:00
Umherirrender
8de3b7d324 Use static closures where safe to use
This is micro-optimization of closure code to avoid binding the closure
to $this where it is not needed.

Created by I25a17fb22b6b669e817317a0f45051ae9c608208

Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
2021-02-11 00:13:52 +00:00
Ferran Tufan
77d16bc1f7 CdnCacheUpdate: Send full URL instead of path to Curl for purge
Follows-up I4ed471c0b50a, which introduced the bug by copying code
from SquidPurgeClient but applied it to Curl, which works differently
from raw sockets.

The issue is that Curl returns the following when using just the path:
> curl: (3) URL using bad/illegal format or missing URL

Curl needs a full url, including host.

Change-Id: Id97b38ef9e0104a3034e5bd69f93d877e663576f
2021-02-08 21:16:01 +00:00
Umherirrender
1b80321f39 Replace deprecated Title::getCdnUrls
Change-Id: Ie3cd9ebd6ef442af19a054a1bb81e5c3574fb2bb
2020-11-03 11:58:05 +01:00
Tim Starling
feba7ee306 Use HttpRequestFactory::createMultiClient() in core where possible
* Use createMultiClient() in CdnCacheUpdate. This will reduce the
  timeout from a hard-coded 900s to a configurable 25s. This is not
  used in WMF production.
* Use createMultiClient() in the VirtualRESTServiceClient service. This
  should have no effect in production since the service is broken per
  T175224.
* Use the new createMultiClient() in the old createMultiClient(). The
  configuration is the same except that the maximum timeouts are now
  respected.

Bug: T245170
Change-Id: I63139d29471bc59e9ef60032fd812a1f24644113
2020-06-02 10:51:43 +10:00
Reedy
c50ba9b190 Fix more PSR12.Properties.ConstantVisibility.NotFound
Change-Id: I0ccda3d1de29b1044f74ef0972949eb8fbcb707d
2020-05-15 00:32:23 +01:00
James D. Forrester
4111cab7ee Replace use of old $wgVersion constant with MW_VERSION
Change-Id: I4b9208b63fa082c9dbc7842868f1199b1a747dc5
2020-05-13 15:01:19 -07:00
Aaron Schulz
1260bf71da Migrate CdnCacheUpdate to MultiHttpClient and deprecate SquidPurgeClient
Bug: T250417
Change-Id: I4ed471c0b50a94426cfea4ae326454b98419e218
2020-04-20 17:03:32 +01:00
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
6b12696452 Move UIDGenerator code to a service and put it under /libs
All MediaWiki dependencies have been removed or injected.

Change-Id: I01c9e96edd6b03496c1595670967ffa5a4069c9d
2020-02-18 00:20:40 +00:00
James D. Forrester
4f2d1efdda Coding style: Auto-fix MediaWiki.Classes.UnsortedUseStatements.UnsortedUse
Change-Id: I94a0ae83c65e8ee419bbd1ae1e86ab21ed4d8210
2020-01-10 09:32:25 -08:00
Aaron Schulz
fef9ed715a Make CdnCacheUpdate::expand() private and update the sole caller
Change-Id: Id427a1667618b65055be772e9919052e95def1f9
2019-09-13 01:56:23 +00:00
Aaron Schulz
2adff7579d Cleanup field visibility and comments in CdnCacheUpdate and HTMLCacheUpdate
Change-Id: Ifbdc3e845aee9c6785c7813f6c955da4bfbe2bc8
2019-09-11 15:04:58 -07:00
Daimona Eaytoy
e7ee0bc0f5 Better docs to make phan happy
Change-Id: I8a9a6330cf1f889cbb77dfc28c93774204767323
2019-09-07 16:47:18 +00:00
Daniel Kinzler
aa4da3c2e8 Revert "Add small HtmlCacheUpdater service class to normalize purging code"
This reverts commit 35da1bbd7c.

Reason for revert: wrong tab, wrong patch. Ooops.

Change-Id: I5828fff6308d43460a3b2b10f60996409181f8b3
2019-08-07 13:56:30 +00:00
Aaron Schulz
35da1bbd7c Add small HtmlCacheUpdater service class to normalize purging code
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

Change-Id: Ic453b189a40109a73a9426538608eea87a76befa
2019-08-06 13:45:27 -07:00
James D. Forrester
f9f8dff40f Rename CDN config variables to be generic, deprecating the old names
Hook, methods, classes still to rename where appropriate.

Bug: T104148
Depends-On: Id34339dff88bc6d1863378ac94b96b2d590b891d
Depends-On: I4e2938395bcbf7956b83fff00978f09c61dcfa36
Change-Id: I7a725dae551c867a4fa7c213838d52c7fb862756
2019-05-24 21:09:22 +00:00
Aaron Schulz
fc5d51f129 jobqueue: add GenericParameterJob and RunnableJob interface
Simplify the code of jobs that do not care about titles and removes
the direct Title dependency from JobQueue. Remove getTitle() from
IJobSpecification itself. Move all the Job::factory calls into a
single JobQueue::factoryJob() method.

Depends-on: Iee78f4baeca0c0b4d6db073f2fbcc56855114ab0
Change-Id: I9c9d0726d4066bb0aa937665847ad6042ade13ec
2019-04-08 11:05:23 -07:00
Timo Tijhof
2a76976016 deferred: Remove deprecated CdnCacheUpdate::newSimplePurge
Change-Id: I4ad7429b5253b5f2d38b9380d55acf42e34e21ba
2019-03-15 01:16:05 +00:00
Umherirrender
6ebe568c4e Remove deprecated class SquidUpdate
Change-Id: Iac53864296990befe7c573a29dd2f35aca52a79e
2019-02-05 20:35:05 +01:00
Tim Starling
dc2948d76d A few doc comment fixups
* Remove some creation dates, they are not protected by GPL
* Remove duplicate @defgroup API
* Remove @ingroup from some @file doc comments on class files. It is not
  useful to list class files alongside classes in the doxygen module menu.
  Add @ingroup to some more class files that had @ingroup on their file,
  that was probably the author's intent.
* In PackedOverlayImageGallery, use the file comment as a class comment
* Don't put @defgroup and @file in the same comment. @defgroup makes the
  whole doc comment describe the group.
* Instead of putting AnsiTermColorer in two groups, use hierarchical
  groups.

Change-Id: If54f6e0b2bc1ea6de42045885cf836ee67b8e961
2017-12-04 11:11:52 +11:00
Erik Bernhardson
3370b052fc Batch request titles for cdn purge from db
Xenon shows a significant amount of time is spent individually fetching
the content model for titles being purged. It's probably not a huge
improvement but lets fetch them all in one go instead of lazily as
needed.

Change-Id: I71af6f13c84e740c1367617d7a51210501363b33
2017-08-30 18:22:11 +00:00
Bartosz Dziewoński
a49b3216fc Canonicalise '@deprecated since' doc comments
Change-Id: I440041512feb47a998efb45e76e3fd00e0655752
2016-08-02 22:21:57 +00:00
Stanislav Malyshev
837173d45e Convert CdnCacheUpdate to event per URL
Bug: T134535
Change-Id: I73e22606e86b4db1bc9bf2cb12b9605507ffe2c2
2016-05-16 13:15:07 -07:00
Stanislav Malyshev
4f95365877 Convert EventRelayerGroup to services infrastructure
Change-Id: If55ddf441de69189c7fcdd3440f899c6b14f690f
2016-04-25 14:22:31 -07: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
621487f603 Make CDN purges send EventRelayer events
* Also create EventRelayerGroup class and config

Bug: T97562
Change-Id: Id7c9b0deb0ffd21277572a8e6407f87be6931a4d
2016-02-09 14:13:21 -08:00
Aaron Schulz
4302b0419d Rename getSquidURLs() => getCdnUrls()
Change-Id: I433acc7990a5fcefd0d2ff5b14ba33dec0424706
2015-12-11 16:40:35 -08:00
Aaron Schulz
01c2b0a425 Add $wgCdnReboundPurgeDelay for more consistent CDN purges
Bug: T113192
Change-Id: I89deb4f8143c1cc6154cdd05bcee1f49d3e3a75a
2015-12-10 22:52:30 +00:00
Aaron Schulz
6af3c39c07 Replace "squid" with "CDN" in various comments
Change-Id: Idcc528daf28e119349155d36e30a9bcf61b2e7d5
2015-12-09 17:35:37 -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 includes/deferred/SquidUpdate.php (Browse further)