Commit graph

431 commits

Author SHA1 Message Date
Umherirrender
b1e1a11ca6 Replace deprecated JobQueueGroup::singleton in JobQueueEnqueueUpdate
Fix documentation and type hint in JobQueueEnqueueUpdate

Change-Id: I68487d0c44ed4f3064455f79f36ce896e8eff143
2021-10-19 20:09:02 +00:00
C. Scott Ananian
af5d13c5de Rename ParserOutput::{get,set,unset}Property to {get,set,unset}PageProperty
The ::getProperty() naming is too generic and doesn't clearly indicate
that these are "page properties" (which have their own table in the DB).
As part of refactoring a clean API out of ParserOutput which can be used
by Parsoid, clean up the naming here.

Soft-deprecation in this patch, there are a handful of external users
which need to be cleaned up before we hard-deprecate.

Bug: T287216
Change-Id: Ie963eea5aa0f0e984ced7c4dfa0fd65d57313cfa
2021-10-08 10:07:17 -04:00
TChin
fd5915823f Update callers of deprecated BacklinkCache methods
Bug: T290015
Change-Id: I73a111d064f7778bbeb90fd4ea85d8bec201427b
2021-09-29 18:56:17 +00:00
Alexander Vorwerk
4cf2895914 Remove the deprecated IP class
Bug: T291008
Change-Id: I83a0ad6543384be71fa8d057932f8331cc0fdc4f
2021-09-26 13:58:28 +02:00
Petr Pchelko
35f38e995b Remove User from LinksUpdate
This does a breaking change, but all (2) known usages
of the LinksUpdate::getTriggeringUser are satisfied
by UserIdentity.

Change-Id: I682ee65f7b3d30fe6c0fe76d5106857ddfa6da5d
2021-09-13 09:40:24 -07:00
Derick Alangi
db43511e6a Title: Make use of BacklinkCacheFactory service
Change-Id: I48161585de6f329ec4037156234e0b07b3b837e6
2021-09-09 14:04:02 +01:00
jenkins-bot
233fff3423 Merge "MWExceptionHandler: Rename rollbackMasterChangesAndLog to rollbackPrimaryChangesAndLog" 2021-09-07 16:31:08 +00:00
Umherirrender
5b3d3ef802 collation: Create CollationFactory service
Use ObjectFactory specs for collation classes
Avoid the language construction in the factory class,
make it a detail of the implementation of each class

Follow-Up of Ifc96f851e6091ce834dbaf0e91695c648a42169c

Bug: T286079
Change-Id: Ib581f64aec8619986fb8dd49ceee0524d59a1b84
2021-09-04 02:46:06 +02:00
James D. Forrester
3407458ea0 MWExceptionHandler: Rename rollbackMasterChangesAndLog to rollbackPrimaryChangesAndLog
Change-Id: I9a90b4f74eb65cd9e20ae9faa6d1949be96543c0
2021-09-03 17:36:34 -07:00
James D. Forrester
8426aacd96 ILoadBalancer: Rename waitForMasterPos to waitForPrimaryPos
Hard-deprecating immediately as no known users in git outside of this repo.

Bug: T282894
Change-Id: I5fa312ae89660a9c6de3c24e13d48de92893e5b0
2021-09-03 20:11:05 +00:00
James D. Forrester
3983572c49 ILoadBalancer: Rename forEachOpenMasterConnection to forEachOpenPrimaryConnection
Bug: T282894
Change-Id: I4892084aba6c7fdfbeccec42de88b9f23490b61c
2021-09-03 13:05:23 -07:00
James D. Forrester
10324c232a ILoadBalancer/ILBFactory: Rename rollbackMasterChanges to rollbackPrimaryChanges
Bug: T282894
Change-Id: I31794e052d71160195dd3b6c29fea24bc98b356b
2021-09-02 12:50:52 -07:00
jenkins-bot
9957bc2f84 Merge "ILoadBalancer/ILBFactory: Rename commitMasterChanges() to commitPrimaryChanges()" 2021-09-02 18:50:43 +00:00
jenkins-bot
5f30d77f4d Merge "ILoadBalancer/ILBFactory: Rename beginMasterChanges() to beginPrimaryChanges()" 2021-09-02 18:30:07 +00:00
James D. Forrester
5ad7ca7eba ILoadBalancer/ILBFactory: Rename commitMasterChanges() to commitPrimaryChanges()
Bug: T282894
Change-Id: I0d80be56e683924254c4e38d05e1109ea74eeab5
2021-09-02 11:27:10 -07:00
James D. Forrester
577e1c3710 ILoadBalancer/ILBFactory: Rename beginMasterChanges() to beginPrimaryChanges()
Bug: T282894
Change-Id: I10e607215e6772c48670659719948f7135472a7f
2021-09-01 22:15:45 +00:00
Umherirrender
4d42b5e86e docs: Change wording master to primary in comments and log text
Bug: T254646
Change-Id: I5379dc79be60c99f0a30f74e5d624f81fe6f921b
2021-09-01 23:04:40 +02:00
libraryupgrader
5357695270 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
  The following sniffs now pass and were enabled:
  * Generic.ControlStructures.InlineControlStructure
  * MediaWiki.PHPUnit.AssertCount.NotUsed

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)

Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
2021-07-22 03:36:05 +00:00
DannyS712
79e17ab2ff Typo fix: "the the" -> "the"
Bug: T201491
Change-Id: I4e347afbfdd1bbac20e0ac00b9e6a046e7c49a49
2021-07-17 02:48:54 +00:00
Matěj Suchánek
fe05fd2919 LinkDeletionUpdate: Remove dead code
There is no lock to release since 6d315fb7f7. Static analysis
is not reporting this because it is allowed to pass an unset
variable by reference.

Change-Id: I819cf438fe074cbe06e103566f61adecee018c1e
2021-07-13 11:09:50 +02:00
jenkins-bot
56ff3059ea Merge "DeferredUpdates: Log execution time for updates" 2021-06-29 20:24:20 +00:00
DannyS712
5ca02c77b2 UserEditCountUpdate: only store a single UserIdentity object
No longer need to save more than one, which was previously
needed to be able to call User::setEditCountInternal(), but
that method has been removed.

It turns out we can't just rely on the user id alone, because
UserEditTracker requires a UserIdentity object and the name
of the user matters.

Follow-up:  Ie3fb4887d9f2d96b32598865030351bf3bf20ce5
Change-Id: I4ba1300837cf2cf624c563d4445a2a7dc6b88d86
2021-06-24 11:28:52 +00:00
DannyS712
b82cf00983 Remove User::$mEditCount and internal caching
UserEditTracker now returns null for anonymous users
instead of throwing an exception.

Added new UserEditTracker::setCachedUserEditCount()
method (internal) to handle the user_editcount field
in User::loadFromRow()'s row. This now means that
the creation of one User object can set the cached
value for any other object for the same underlying user
- the alternative (just ignoring the value) would mean
that an extra database read might be needed. This is
only used for users created with a row that includes
the user id - we silently discard the value if
the row doesn't have a user id (or the user id is 0)
to avoid issues with UserEditTracker trying to fetch
the user id and potentially triggering another load.

A follow-up will simplify the UserEditCountUpdate class
to remove storing full UserIdentity objects now that
only the id is needed.

Follow-up: Ibf1482bcbcbf4d56fc06531bb3e17e2a6e3e2e6f
Change-Id: Ie3fb4887d9f2d96b32598865030351bf3bf20ce5
2021-06-18 00:25:47 +00:00
Matěj Suchánek
ae7fa75b6a Fix documentation of UserEditCountUpdate::doUpdate
The original documentation was probably copied from somewhere else.
It never corresponded to what the method actually does.

Change-Id: I21491ec97cc24a36450466a090079f63402c8c1c
2021-06-16 22:48:56 +00:00
Kosta Harlan
20422d9324 DeferredUpdates: Log execution time for updates
Doesn't cost anything to compute and include in logs, and would be
useful for understanding serial processing of DeferredUpdates
(basically, non-deferred deferred updates) in CI are slowing down
browser tests.

Bug: T225968
Change-Id: Id55bde5d8f4e465723d8db6df29b4c554fc1bc9c
2021-06-09 19:00:39 +00:00
DannyS712
5a229f691f Accept UserIdentity in code to manage edit counts
- UserEditCountUpdate: accept UserIdentity instead of User
- Move User::incEditCount() to UserEditTracker

Change-Id: Ibf1482bcbcbf4d56fc06531bb3e17e2a6e3e2e6f
2021-06-08 05:41:03 +00:00
Petr Pchelko
23f2311978 Remove WikiPage from SearchUpdate
Change-Id: Iba1aa238752ce864e9b6dd0ed1ab741191d86bc0
2021-06-01 16:05:09 +00:00
James D. Forrester
f2f9345e39 Replace uses of DB_MASTER with DB_PRIMARY in documentation and local variables
This is just a start.

Bug: T254646
Change-Id: I9213aad4660e27afe7ff9e5d2e730cbf03911068
2021-05-14 12:40:34 -07:00
Thiemo Kreuz
6805f39a30 Remove unused default values from class properties
In all these cases the property is unconditionally set in
the constructor. The extra initialisation is effectively
dead code and an extra source of errors and confusion.

Change-Id: Icae13390d5ca5c14e2754f3be4eb956dd7f54ac4
2021-05-12 13:44: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
daniel
398cc53333 LinksUpdate: don't throw if page does not exist
LinksUpdate may encounter a non-existing page due to race conditions,
when the page has been deleted or renamed before the update is executed
or even created. We should log such incidents to detect anomalities,
but we should not crash hard.

Similarly, RefreshLinksJob should not attempt to run on a page that
no longer exists.

Bug: T281802
Change-Id: Ic73c3e339ff0478710bd57a9f707c1284dcce2d9
2021-05-04 14:51:14 +02:00
DannyS712
c0dd682544 Start removing places using Revision objects
- EditPage::$mBaseRevision
- EditPage::getBaseRevision()
- Title::getFirstRevision()
- LinksUpdate::setRevision()
- LinksUpdate::getRevision()
- Article::$mRevision
- Article::getRevisionFetched()
- WikiPage::getOldestRevision()
- WikiPage::getRevision()
- ContribsPager::tryToCreateValidRevision()

To make things easier, instead of rewritting
the Revision tests that were using WikiPage::getRevision,
just delete them, its not worth the effort to rewrite
them since the class is going away. For the WikiPage
tests, replace uses of getRevision with getRevisionRecord,
manually converting to a Revision object where needed

Bug: T247143
Change-Id: I52bc1f49649f8bd25797e3f7a090bec9c63ac2d1
2021-04-30 12:33:15 -07:00
James D. Forrester
df5eb22f83 Replace uses of DB_MASTER with DB_PRIMARY
Just an auto-replace from codesniffer for now.

Change-Id: I5240dc9ac5929d291b0ef1c743ea2bfd3f428266
2021-04-29 09:24:31 -07:00
jenkins-bot
9c269ae3b8 Merge "Add change tags for media additions/removals" 2021-04-28 15:13:34 +00:00
Timo Tijhof
e9051b2b99 rdbms: Move setLBFactoryTriggers from doMaintenance to service wiring
This logic is not needed to run on every PHP process and was making
it difficult to run offline maintenance scripts without additional
complexity based on Maintenance::getDbType and DB_NONE.

Instead of skipping this only for DB_NONE, and establishing a pattern
that may spread to other ad-hoc places throughout the codebase, instead
remove this entirely from the eager set up code for all PHP processes
and move it to the service wiring and dependency injection.

That way, it naturally doesn't happen until and unless the DB service
is actually called upon. Scripts and entry point that need to disable
the DB service, can continue to use
MediaWikiServices::disableStorageBackend.

== Impact on SiteStatsUpdate ==

With wgCommandLineMode no longer being read at run-time from a global,
but in service wiring, this means SiteStatsUpdateTest can't change
the behaviour between CLI-like and Web-like, unless it e.g. resets
the 'DBLoadBalancerFactory' service first. Unfortunately, while most
any reset is supported, a reset of the 'DBLoadBalancerFactory' would
be unsupported as that would lose the temporary db clone context and
such, bringing us to either the developer's live db, or a broken set
up altogether. If there is a strong need for toggling oppertunistic
updates off and on at run-time, this could be supported in the
DeferredUpdates class perhaps, but we already have numerous methods
there (incl db begin/commit being a good proxy already), which this
test already used, so for now I've just removed the extra assertion
for this as it wasn't essential to that test.

Bug: T228895
Bug: T238436
Change-Id: Icf29bc484c155f52b6d8f61e5902233a15ba0c6d
2021-04-27 23:35:20 +01:00
Matthias Mullie
dab7b16741 Add change tags for media additions/removals
This introduces 2 new tags to track changes in media usage
across articles. These tags are both hidden & disabled by
default.

Bug: T266067
Change-Id: Ia230eadf7dcf6f52facab17b92293f25de38bb1c
2021-04-26 12:22:21 +02:00
Aaron Schulz
bb1fdb91ac uuid: Simplify GlobalIdGenerator by removing QUICK_VOLATILE flag
Change-Id: I4f504be5d805281eeb9400cd4fd783c50b561b87
2021-04-14 21:40:35 +00:00
Tim Starling
8977383631 Actor migration cleanup for SiteStatsUpdate
In the commit that introduced ActorMigration, the ActiveUsers query was
modified to use RecentChange::getQueryInfo() instead of building the
query directly. Now that actor migration is complete in the
recentchanges table, we can revert that.

I also took the opportunity to migrate the query to SelectQueryBuilder.

Bug: T278917
Change-Id: I46f97081286185ecd28ab45fd66eb3d116873ec9
2021-04-07 16:24:55 +10:00
Ammarpad
b754d1eeae Remove $wgPagePropsHaveSortkey
This is no longer useful. The schema update it supports
has been removed: patch-pp_sortkey.sql/(I76b4235)

Bug: T273978
Change-Id: Ida469a5401f98a028b7a69242105dc1595af3613
2021-03-13 12:08:49 -08:00
Timo Tijhof
26c9849330 docs: Fix 'dependant' typos
The intended word in all these cases was the adjective "dependent".

Whilst the "dependant" does exist, it is a noun and generally
refers to a person. The word is rare used in general, but
especially so in a technology context.

Change-Id: Ic7e2d2ea6a566f4139ff1fdb77f38b0e962ccd9c
2021-02-18 16:59:20 +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
Aaron Schulz
4b7ddd3c67 deferred: make DeferredUpdates::doUpdates() recursion more uniform
Follow-up ba6490aa1e.

That patch worked around $executeContext iteration errors due to the
lack of recursion support in doUpdates()/handleUpdateQueue(). Errors
were triggered by MediaWiki::schedulePostSendJobs() enqueueing deferred
updates that invoke JobRunner::run(), which, in turn, invoke doUpdates()
for each job via JobRunner:: doExecuteJob(). The doUpdates() method was
changed to operate on the sub-queue for the in-progress DeferrableUpdate.

Further improve the recursion logic:
* Use classes for the scope stack and scope queues.
* Put *all* updates added during a DeferrableUpdate::doUpdate() call into
  the subqueue, regardless of "defer until" stage or whether it implements
  MergeableUpdate. Now, doUpdate() can run *everything* it enqueued instead
  of a non-obvious subset. Note that the TransactionRoundDefiningUpdate
  that invokes JobRunner was already a POSTSEND update before ba6490aa1eb;
  the only effect of this change is that MergeableUpdate instances from jobs
  will once again run in doExecuteJob().
* Make recursive DeferredUpdates::doUpdate() calls error out immediately
  unless the DeferrableUpdate responsible is a TransactionRoundAwareUpdate
  with the TRX_ROUND_ABSENT flag. This covers the schedulePostSendJobs()
  scenario and only prohibits insane call patterns. Failing early avoids
  the risk of handleUpdateQueue() dropping all the updates due to the same
  DBTransactionError error in DeferredUpdates::attemptUpdate().
* Avoid recursion loop in tryOpportunisticExecute() when JobQueueDB is in
  use and a large number of tasks are pending. This happened due to methods
  like onTransactionPreCommitOrIdle() being used within JobQueueDB.

Mark DeferredUpdates::doUpdates()/tryOpportunisticExecute() as @internal
and create a Maintenance::shutdown() method to avoid a direct call in the
doMaintenance.php file.

Bug: T249069
Bug: T268840
Change-Id: Ib369f0e74243a48ababdb9cd83b155c9a0f5e741
2021-01-14 15:37:58 -08:00
jenkins-bot
6415fd72a1 Merge "Replace deprecated Title::getCdnUrls" 2020-11-13 08:22:53 +00:00
jenkins-bot
56114691a4 Merge "Replace deprecated WikiPage::factory/newFromID in deferred classes" 2020-11-12 22:47:59 +00:00
Umherirrender
eeaf72c2cf Replace deprecated WikiPage::factory/newFromID in deferred classes
Change-Id: Ie226017950dd722d4752910a0b962da3b3e7e413
2020-11-12 21:15:02 +01:00
Thiemo Kreuz
6f901ef17c Make use of native array_column() function where possible
Change-Id: I78108e7dc5a10d892e97b0101c1b72cb8d363e97
2020-11-11 22:48:53 +00:00
Umherirrender
1b80321f39 Replace deprecated Title::getCdnUrls
Change-Id: Ie3cd9ebd6ef442af19a054a1bb81e5c3574fb2bb
2020-11-03 11:58:05 +01:00
Umherirrender
1e8b1de808 Use finally in AutoCommitUpdate
More readable than catch + re-throw

Change-Id: I458cfd5ff5c6a89b62b94c6837c2de2b764fc85a
2020-10-24 23:38:10 +02:00
jenkins-bot
72a90d3d06 Merge "Document hook names in hook interfaces." 2020-10-02 16:15:21 +00:00