Commit graph

9759 commits

Author SHA1 Message Date
Samuel Guebo
a8db81dc71 Add script to delete a user email's address
Can be used for a variety of operations
including preservation of users privacy.

Bug: T290099
Change-Id: Iad75810310c95e96b5f8998b201ed04ace5af656
2021-09-27 18:02:11 +00:00
jenkins-bot
07f3f8053b Merge "UndeletePage cleanup, part 1" 2021-09-27 14:24:53 +00:00
jenkins-bot
5c570f46da Merge "Move code from PageArchive to a new UndeletePage command" 2021-09-27 14:22:05 +00:00
jenkins-bot
a6e125c109 Merge "Chinese Conversion Table Update 2021-2" 2021-09-25 18:11:37 +00:00
Umherirrender
769bdbf091 docs: Fix nullable documentation for class properties
Change-Id: I6d0577124d852103f485ffdc819876a13f6641c3
2021-09-24 00:54:53 +00:00
Reedy
62181c53ac sql.php: Fix typos
Change-Id: I8de1d70039390a3e204dddac9d445187b4bf554d
2021-09-23 23:12:28 +00:00
Daimona Eaytoy
c0f64981bf UndeletePage cleanup, part 1
Bug: T290021
Change-Id: Idaf25a209a65b9a36a0a24473c76523ee3a17e8d
2021-09-21 18:13:57 +02:00
Daimona Eaytoy
beadd4454f Move code from PageArchive to a new UndeletePage command
This is just moving code verbatim, removing now-unneeded stuff, and
duplicating tests as well.

Bug: T290021
Change-Id: I540ddaaa11dfabcf0b87b608b151b5e34d199fd8
2021-09-21 16:11:29 +00:00
Chiefwei
d1989b857f Chinese Conversion Table Update 2021-2
Update the Chinese conversion table routinely to fix bugs reported at
https://zh.wikipedia.org/wiki/Wikipedia:字词转换/修复请求.

It is only data changes and only works for Chinese WikiProjects.

Change-Id: I14fc68ae8f6792e24127aaa93f6fe7aa1f786a26
2021-09-20 12:31:57 +08:00
jenkins-bot
bdd87c9753 Merge "objectcache: Avoid getCurrentTime() call in MapCacheLRU::has()" 2021-09-17 14:39:01 +00:00
jenkins-bot
76ba780e41 Merge "WikiExporter: inject services" 2021-09-16 17:04:04 +00:00
DannyS712
a2b20b63d7 Emit deprecation warnings reading from $wgUser
With this patch deprecation warnings will be emitted
if $wgUser is accessed or written into. The only pattern
of usage still allowed is

$oldUser = $wgUser;
$wgUser = $newUser;
// Do something
$wgUser = $oldUser;

Once there is no deprecation warnings, we know that nothing
legitimately depends on $wgUser being set, so we can safely
remove the code that's still allowed as well.

Bug: T267861
Change-Id: Ia1c42b3a32acd0e2bb9b0e93f1dc3c82640dcb22
2021-09-15 20:17:04 -07:00
Timo Tijhof
5873c937d2 objectcache: Avoid getCurrentTime() call in MapCacheLRU::has()
== Background

During a parse request [1] for a popular Wikipedia article, there
are 180,949 calls to MapCacheLRU::has and 188,542 calls to
::getCurrentTime via ::getAge. (Note, getCurrentTime has more calls
than ::has, as there are also calls via ::set and ::setField).

In a one-off XHGui profile, these calls had 246ms wall-time or 258ms
cpu-time attributed to them, which is 0.25s of a 12s parse or 2%.

In a day's worth of index.php samples [2] [3], there is 1.1% cpu-time
or 1.4% wall-time attributed to MapCacheLRU, of which ~0.3% in
getCurrentTime() alone.

== Change

Most uses of MapCacheLRU are without any in-process TTL, and thus have
$maxAge at its default of INF. Avoid calling getAge and getCurrentTime
in that case.

I think long-term it might make sense to deprecate the TTL feature
in MapCacheLRU, as it is very very rarely used, and still adds
significant overhead to all uses MapCacheLRU and its set() code path.
For cases where in-process TTLs are really needed, the HashBagOStuff
class could be used instead. I can't find any complex uses of
get/setFields, let alone with per-sub field TTL, but a theoretical
or third-party use case could potentially use HashBagOStuff with
sub-fields either as their own key, or refactor to put arrays under
a single key and TTL, or re-create it in their own code base if really
needed.

== Difference

I've added a benchmark since generating random values and populating
MapCacheLRU seems non-trivial enough to be worth a re-usable bench.

Using `benchmarkLruHash.php --method get --count 1000`, before:

> MapCacheLRU::get with 500 keys
>    count: 100
>     rate:     28.5/s
>     mean:    35.06ms

... and after:

>   count: 100
>    rate:     35.6/s
>    mean:    28.10ms

[1] POST en.wikipedia.org /w/api.php?action=parse&title=Barack_Obama&text={{:Barack_Obama}}
[2] https://performance.wikimedia.org/arclamp/svgs/daily/2021-09-06.excimer.index.reversed.svgz
[3] https://performance.wikimedia.org/arclamp/svgs/daily/2021-09-06.excimer-wall.index.reversed.svgz

Bug: T275673
Change-Id: Id8c747f0d0a9454274c296090a2ca80e440f97bb
2021-09-10 02:18:00 +00:00
Umherirrender
44fd53fee3 Using @return never documentation on always-throw-function
This helps phan to detect unreachable code and also impossible types
after the functions.
It helps phan to avoid false positives for array keys
when the keys are checked before

Bug: T240141
Change-Id: I895f70e82b3053a46cd44135b15437e6f82a07b2
2021-09-07 17:29:03 +02:00
Umherirrender
07b499fbcf build: Update mediawiki/mediawiki-phan-config to 0.11.0
Addition and remove of suppression needs to be done with the version
update.

Change-Id: I3288b3cefa744b507eadebb67b8ab08c86517c1c
2021-09-07 17:19:05 +02:00
jenkins-bot
c574766a8a Merge "Remove unreachable code after exception/die/exit" 2021-09-07 09:15:48 +00:00
Alexander Vorwerk
2fbf13812a WikiExporter: inject services
This patch injects services into WikiExporter. It also adds a
WikiExporterFactory service for creating WikiExporter instances.

Change-Id: Ib1547defea54c309865c116bc83d617c21568843
2021-09-06 10:03:37 +00:00
jenkins-bot
93edb608e1 Merge "renameRestrictions.php: Update protected_titles as well" 2021-09-06 05:41:43 +00:00
Martin Urbanec
3137f9404a renameRestrictions.php: Update protected_titles as well
Restriction names are used in two tables, we should update
both.

Bug: T290398
Change-Id: Ic5e77ee451f12acfd0c69afe9a5c498885ffeaa5
2021-09-05 21:02:18 +02:00
jenkins-bot
1e76c7bfb0 Merge "Remove unneeded variable assignment" 2021-09-04 23:48:21 +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
Umherirrender
a7bb7cc5c5 Remove unreachable code after exception/die/exit
Change-Id: Ia81903fb2a8157625fbe63115097eccc1161b5db
2021-09-03 23:14:28 +00:00
Umherirrender
2e4ee47c3d Cleanup mixed space/tab line indent
Change-Id: I833052a656b1ce419c0929f6f0514f2a33c2c4cc
2021-09-04 00:52:31 +02:00
Umherirrender
032b03dc7a Remove unneeded variable assignment
The variable already has the value

Change-Id: I75f25cc944e30d91a65e1d2bb0abce7d671b19b8
2021-09-03 22:51:22 +00:00
James D. Forrester
eeaec4ce6b ExternalStoreDB: Rename getMaster to getPrimary
Bug: T282894
Change-Id: I6d6361a0b84f7130a27df6a6c75a983c73e5dd95
2021-09-03 13:44:04 -07:00
James D. Forrester
df1e801cca Miscellaneous master -> primary switches for private functions and variables
Change-Id: I5c90822f1da6af7354ee7e2d67d579bd72bce8c3
2021-09-03 20:14:41 +00:00
jenkins-bot
f5ff92586b Merge "tables.json: add a missing space after period" 2021-09-02 21:26:07 +00:00
DannyS712
c3bc90da22 tables.json: add a missing space after period
Change-Id: Ia0b4fc6cf4c0e5f481461c383a66e68fe111f653
2021-09-02 21:00:20 +00:00
James D. Forrester
109cf7b25c IDatabase: Rename masterPosWait to primaryPosWait
Hard-deprecating immediately as no known users in git outside of mainteance scripts.

Bug: T282894
Change-Id: I072f3d93a9598df719f76f635bfd477737097ad9
2021-09-02 11:59:06 -07:00
James D. Forrester
5ad7ca7eba ILoadBalancer/ILBFactory: Rename commitMasterChanges() to commitPrimaryChanges()
Bug: T282894
Change-Id: I0d80be56e683924254c4e38d05e1109ea74eeab5
2021-09-02 11:27:10 -07:00
jenkins-bot
f63b804c1c Merge "fixMergeHistoryCorruption.php: use DB_REPLICA" 2021-08-31 17:09:55 +00:00
jenkins-bot
e2bcd5b878 Merge "Add typehints to several methods" 2021-08-31 16:50:57 +00:00
Daimona Eaytoy
9cca05a8e8 Add typehints to several methods
These not only make the code more robust, but also help a lot when
writing unit tests: if a method is return-typehinted and its class is
mocked, the mock method will automatically return a mock of its declared
return type. Otherwise it will return null, and developers are forced to
manually mock the method if the return value is used by the SUT in a way
that doesn't accept null.

Depends-On: I628fcb1807133390c7b9b47984f512f5b1ae58d0
Depends-On: I7080bc505f5838b2f51a368da562104e206063b0
Change-Id: I59068cfed10aabf6c6002f9e9312a6ef6e7e9441
2021-08-31 16:19:13 +00:00
Tim Starling
4b6fd791f7 fixMergeHistoryCorruption.php: use DB_REPLICA
Use the replica DB for read queries.

Bug: T263340
Change-Id: I5ab5706390dfc012c86bc18094c5baf457b8cbe8
2021-08-31 10:53:42 +10:00
Umherirrender
94792e97be maintenance: Cleanup use of exit in Maintenance::execute implementation
Returning void from execute() is success.
Returning true is success, false is failure with exit(1)
Using fatalError also using exit(1)

Change-Id: I1d40430ad6226e4aab8f0810b03ee1213282d123
2021-08-30 19:48:27 +00:00
jenkins-bot
5c4cd08943 Merge "Create new UserGroupManager::addUserToMultipleGroups method" 2021-08-30 16:52:00 +00:00
TChin
1f673d8e8f Create new UserGroupManager::addUserToMultipleGroups method
Bug: T287247
Change-Id: I40f560a2143a2c0fda8cb7233d9954dc645749a3
2021-08-30 10:24:46 -04:00
DannyS712
492d91175e resourceloader: Define mw.loader in its own JS file
Remove primary IIFE when setting mw.loader, which reduces
indentation by an extra level. Futher cleanup will be done
to the code for mw.loader.store in a follow-up.

The fnv132() function, which is only used in the loader, was
among the extra bits that were moved.

Should have no effect on the functionality.

Change-Id: Ie475879727e4170eb47f3fc78048379c7190844d
2021-08-29 04:55:14 +01:00
jenkins-bot
5e7b476dd1 Merge "Avoid Status/StatusValue mismatch in syncFileBackend maintenance script" 2021-08-28 18:38:54 +00:00
jenkins-bot
132f05f1df Merge "docs: Use interface instead of real types in documentation" 2021-08-28 18:33:48 +00:00
Umherirrender
af2c5156f2 docs: Use interface instead of real types in documentation
Change-Id: Ie555efd6f70762f4e085957d59306623570459a5
2021-08-26 23:57:31 +00:00
Umherirrender
b06465a901 Avoid Status/StatusValue mismatch in syncFileBackend maintenance script
FileBackend::doQuickOperations is documented to return StatusValue,
but syncFileBatch is documented to return Status.

Change-Id: I5e9dc48bf43e96a18619a2290dd7995d5fdc7f0a
2021-08-27 01:02:42 +02:00
Umherirrender
3674452b0c export: Fix false/null handling for fread in TextPassDumper
fread cannot return null, it returns false instead
Avoid using null in a string concat

Change-Id: Iae0ac52040335b1b39af7cace82e76f6cfd89ef0
2021-08-27 00:55:25 +02:00
jenkins-bot
9ca18a249d Merge "benchmarks: Remove old bench, document perf -e instructions" 2021-08-26 09:18:49 +00:00
jenkins-bot
9f8cfab28d Merge "benchmarks: Set a default file in benchmarkJSMinPlus.php" 2021-08-26 09:18:43 +00:00
Tim Starling
4c5de97a9b benchmarks: Remove old bench, document perf -e instructions
<https://gerrit.wikimedia.org/r/c/mediawiki/core/+/713031>

Change-Id: I60ec9a263a66747a1a5177584d3d04692f011e49
2021-08-26 05:53:49 +00:00
Timo Tijhof
7d087c2819 benchmarks: Set a default file in benchmarkJSMinPlus.php
This makes it easier to run, but more importantly, makes it obvious
that the file in /data/jsmin is still conceptually in use.

Change-Id: Iaf10c9bd2f6643bcb0bae95eaf22ec92de15950d
2021-08-26 04:40:02 +01:00
jenkins-bot
c818f29a4c Merge "Add benchmark for Linker::formatComment() in preparation for refactor" 2021-08-26 03:24:38 +00:00
jenkins-bot
ae8522b34c Merge "Same code style and formatting for exists-style SQL queries" 2021-08-24 17:44:17 +00:00
jenkins-bot
62a1c353bc Merge "Fix class name of InvalidateUserSessions" 2021-08-24 11:27:34 +00:00