I fixed some edge cases in the script that migrates to SQB and it
managed to fix these now.
Bug: T344971
Change-Id: I00cc9a6660d9bd4c64c976121b2121ccd7aae1f0
wfGetDB() has been deprecated since 1.39 (or more?) and it's better to
inject LBF and call ::getReplicaDatabase() or ::getPrimaryDatabase()
which is not straightforward in classes but for static functions, there
is no way to inject the method so we can simply call
MediaWikiServices::getInstance()->getDBLoadBalancerFactory()
While I was here, I migrated one call to SelectQueryBuilder.
Bug: T330641
Change-Id: Idd2278cef647035dce05a2d461a620e145fe1167
This class is used heavily basically everywhere, moving it to Utils
wouldn't make much sense. Also with this change, we can move
StatusValue to MediaWiki\Status as well.
Bug: T321882
Depends-On: I5f89ecf27ce1471a74f31c6018806461781213c3
Change-Id: I04c1dcf5129df437589149f0f3e284974d7c98fa
Using a php parser written on top of ANTLR4, done semi-automatically.
I checked everything and made adjustments.
Bug: T311866
Change-Id: I6150c6909bce8f3dbd745a26380cc0af9d9c547f
Not use RevisionRecord constants for LogPage or File,
even the number are the same, the context should be the match
Change-Id: Icf50f48fa63144c5ac798e7453faf9cd0a1b706a
Not used anywhere else as a method. It really is just a constant.
This goes along with Icf50f48. Can be merged in any order.
Change-Id: I8270df212193c10ad35e0b735cca67b2307e535e
This follows up change I608566700c, which was mainly generated by a
script. Most of the clean up here is fixing cases where it seems the
script for some reason collapsed multi-line arrays into single-line ones
and/or removed spaces after commas. A handful of other improvements are
included too (split merged conditions into ->where()->andWhere(), use
buildComparison()). In RevDelArchiveItem, a comment is restored that I
assume was removed accidentally (perhaps because the script didn’t
expect comments inside the conditions).
Bug: T330640
Change-Id: If27bafb12fdaa05d3dc1ae6da820e1630ae2742e
Follows-Up: I608566700c6d737ee986bf47dda87effc69614d6
I did this using a script written on top of antlr4 parser so it doesn't
have some clean ups a human would do but it's pretty nice already.
Bug: T330640
Change-Id: I608566700c6d737ee986bf47dda87effc69614d6
There is no way to express that Title::castFromPageIdentity(),
Title::castFromPageReference() and Title::castFromLinkTarget()
can only return null when the parameter is null. We need to add
Phan suppressions or explicit types almost everywhere that these
methods are used with parameters that are known to not be null.
Instead, introduce new methods Title::newFromPageIdentity() and
Title::newFromPageReference() (Title::newFromLinkTarget() already
exists), without the null-coalescing behavior, and use them when
the parameter is not null. This lets static analysis tools, and
humans, easily understand where nulls can't appear.
Do the same with the corresponding TitleFactory methods.
Change the obvious uses of castFrom*() to newFrom*() (if there is
a Phan suppression, a type check, or a method call on the result).
Change-Id: Ida4da75953cf3bca372a40dc88022443109ca0cb
* Inappropriate @inheritDoc usage. Arguably all @inheritDoc is
inappropriate but these are the ones PHPStorm flags as misleading
due to the method not being inherited.
* Doc comment type does not match actual argument/return type.
* I replaced "@return void|never" with "@return void" since never means
never, it doesn't make sense for it to be conditional. If a method
can return (even if that is unlikely) then @return contains the type
that it returns. "@return never" means that there is no such type
because the method never returns.
* Incomplete/partial/broken doc tags
Change-Id: Ide86bd6d2b44387f37d234c2b059d6fbc42ec962
Avoid code duplication and
allows to use the new styling if Icfb46d9 (T327538) gets merged
Remove duplication of span.history-deleted on Special:EditTags - before
this change a span.history-deleted element was nested inside another
span.history-deleted element and after this change it is not.
Change-Id: I2e27bd8e0bcca47a7734fcb6ee28c0d1e6bb5896
These exceptions are not documented with @throws and they're really not
meant to be caught.
Bug: T86704
Change-Id: I07f32e42c6fd4bc8785bac91547858f15a9fc2a8
so that extensions (i.e. CheckUser) can implement their own comment
store without having a lot of code duplication
basically the comment store version of I3a6486532f2ef36
Bug: T233004
Change-Id: Ib40f99e00a514d41776ce521baf113e46d37e9cd
Sorting on log_id must not give a result in time order,
because maintenance scripts can insert newer ids with older timestamps.
When only sorting for log_timestamp the result is not stable,
because for items with same timestamp the order is not defined.
For Special:Log the same timestamp gives problems on pagination
Bug: T305590
Change-Id: Ic0c2ebd19ee6a8aa570c5a12a92b31008135491c
When revdel/suppress a log entry the change tags should be shown
as shown on Special:Log for the same log entry.
Bug: T109041
Change-Id: Ia2c89869008593ff765f06e61e0186b78539c18c
The function deprecatePublicPropertyFallback is needed when the
deprecated class property no longer exists.
Just store the PageIdentity and fallback to title if needed.
Change-Id: I48f81e80c3cdd91f34da9d71344660ab5d27bda2
This covers all occurrences of /onfig->.*get( '/ in includes/.
Undoubtedly there are still plenty more to go.
Change-Id: I33196c4153437778496f40436bcde399638ac361
The functions returning null or the class property is set explict null
Found by phan strict checks
Change-Id: I4a271093fb6526564d8083a08249c64cb21f2453
It turns out this gets rid of a bunch of suppressed
"SecurityCheck-DoubleEscaped" that appear to have been accurate
warnings.
There seems to have been some confusion about how ::truncateForVisual()
is supposed to be used; in particular it is to be passed *unescaped*
output, because it is not (generally speaking) safe to truncate
HTML-escaped strings. The goal of ::truncateForVisual() is to have
a specific number of codepoints in the output for display purposes,
the encoding of those codepoints is not an issue (htmlspecialchars
can be applied to the *return value*.) If you need a specific number
of *bytes* you should be using ::truncateForDatabase(). If you want
a certain number of *HTML bytes* then the ::truncateHtml() method
is probably what you want.
Slightly refactor some code in RevDelLogItem to avoid a false positive.
Bug: T301205
Bug: T290624
Change-Id: I893362e049aedfa699043fcf27caf4815196f748
Those "$comment ?? ''" are a bit ugly, but the other way around is
changing the return values of some ::getDescription implementations,
which is dangerous, at least.
Change-Id: I07e6b58258c256d19b058c56280150b70a46b407