Commit graph

17 commits

Author SHA1 Message Date
DannyS712
dcf682a521 Inject UserFactory into ActorMigration
Bug: T265311
Change-Id: Ie51ea0be0b09dc782365c4b201152b52fd5b3573
2020-10-13 19:34:19 +00:00
DannyS712
6b4edf2ad3 Inject UserNameUtils into ActorMigration service
Change-Id: Id14d96b9dfcb49909d1b24a787434212dd9f9733
2020-10-12 17:46:39 +00:00
daniel
4fe4407731 SECURITY: ensure actor ID from correct wiki is used.
This builds on top of Urbanecm's patch, now also covering the case
where the actor ID does not exist in the target DB, but does exist in
the local DB.

Bug: T260485
Change-Id: I2336954c665366a99f9995df9b08071d4de6db79
(cherry picked from commit ca4094db9e7f6f5e330d89db6bf70a8af48e1561)
2020-09-24 19:37:43 +01:00
Martin Urbanec
037e63c2f7 SECURITY: ActorMigration: Load user from the correct database
In ActorMigration::getInsertValues, when creating a User object, calling
User::getActorId triggers a call to User::load, which ignores
the database passed to getInsertValues, meaning incorrect actor IDs
are returned.

To ensure that the correct (foreign) database is used, try
to get the actor ID from the correct database within ActorMigration
service, and if that fails, let User class handle the actor ID creation.

Todo notes are left in the patch to fix the issue properly,
by making User object wiki-aware.

Bug: T260485
Change-Id: Iaa886a1824e5a74f4501ca7e28917c780222aac0
2020-09-24 18:20:02 +00:00
Nikki Nikkhoui
7b9695726c ActorMigration doc comment
Small addition to ActorMigration.php doc comment
to make it clear that classes should use this
instead of directly accessing db tables

Change-Id: Ibad838d35ea87f85966cda2b210f18196d50f844
2020-07-24 10:21:29 -07:00
daniel
f59bf8a22f Use @internal instead of @private per policy
https://www.mediawiki.org/wiki/Stable_interface_policy mandates the use
of @internal. The semantics of @private was never properly defined.

Bug: T247862
Change-Id: I4c7c6e7b5a80e86456965521f88d1dfa7d698f84
2020-06-26 14:14:23 +02:00
Reedy
a8467a0fd7 Fix numerous PSR12.Properties.ConstantVisibility.NotFound
Change-Id: I157220c4e9ff516283a60f06af99efa2439332e3
2020-05-12 18:41:43 +00:00
Aaron Schulz
571f4c1a21 Avoid upsert() log warning spam in ActorMigration due to unique key array format
Bug: T248147
Change-Id: Id457ce70427bba5cbf11d7706b9de371356bbf21
2020-03-20 05:31:03 -07:00
Brad Jorsch
531399f5c7 ActorMigration: Improve getWhere() handling of $users
Some callers, when provided an invalid user name, will wind up passing
null or false. This raises a PHP warning and winds up treating it as the
empty array. In this case, it seems best to DWIM and continue that
behavior without the warning.

At the same time, let's more explicitly reject other values for $users.

Bug: T239772
Bug: T207217
Change-Id: I6027481f6cad222369911d5053fecc06c92b36ea
2019-12-04 16:00:02 -05:00
Umherirrender
337ecb0514 Add missing @param and @return to documentation
Change-Id: Ibc5849cc8ea7e7c4eb30ded9c1cfa5f52187c377
2019-11-10 22:12:58 +00:00
Daimona Eaytoy
cae0110e5a Fix new phan errors, part 1
First part, mostly doc-only.

Bug: T231636
Change-Id: Id59f585740fa5bfb53c257287121f51a30de38fe
2019-10-11 15:04:04 +00:00
Brad Jorsch
c29909e59f Mostly drop old pre-actor user schemas
This removes most of the pre-actor user and user_text columns, and the
$wgActorTableSchemaMigrationStage setting that used to determine
whether the columns were used.

rev_user and rev_user_text remain in the code, as on Wikimedia wikis the
revision table is too large to alter at this time. A future change will
combine that with the removal of rev_comment, rev_content_model, and
rev_content_format (and the addition of rev_comment_id and rev_actor).

ActorMigration's constructor continues to take a $stage parameter, and
continues to have the logic for handling it, for the benefit of
extensions that might need their own migration process. Code using
ActorMigration for accessing the core fields should be updated to use
the new actor fields directly. That will be done for in a followup.

Bug: T188327
Change-Id: Id35544b879af1cd708f3efd303fce8d9a1b9eb02
2019-09-09 11:38:36 -04:00
Gergő Tisza
d18c861aa9
Improve documentation of getJoin() methods for static analysis
Change-Id: I3943b4b4a630777d06d1689714d8f36c4430cd24
2019-07-03 15:45:01 +02:00
Thiemo Kreuz
2540c29b20 Use the ?? feature instead of isset() where it makes sense
Change-Id: I3a54f36b33d99ef3ff4c63e32e7dfcbcfc296135
2019-03-24 22:40:49 +01: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
petarpetkovic
3f60fb5ad1 Remove duplicated article usages
Bug: T201491
Change-Id: I72b1e7609b49b9bf182c0872f8b780d9e9e08695
2018-08-09 10:29:38 +02:00
Brad Jorsch
27c61fb1e9 Add actor table and code to start using it
Storing the user name or IP in every row in large tables like revision
and logging takes up space and makes operations on these tables slower.
This patch begins the process of moving those into one "actor" table
which other tables can reference with a single integer field.

A subsequent patch will remove the old columns.

Bug: T167246
Depends-On: I9293fd6e0f958d87e52965de925046f1bb8f8a50
Change-Id: I8d825eb02c69cc66d90bd41325133fd3f99f0226
2018-02-23 10:06:20 -08:00