Commit graph

626 commits

Author SHA1 Message Date
Umherirrender
07db7102cc Replace deprecated LogFormatter::newFromRow/newFromEntry
Change-Id: I453ce3148a46fcb9cc5c685cee92274e0cb4f98a
2024-07-29 22:26:41 +02:00
jenkins-bot
3fc5ec3616 Merge "RecentChange: Replace use of legacy error arrays" 2024-07-10 11:40:11 +00:00
Daimona Eaytoy
6469955810 Replace User, Title, and WikiPage in more signatures
Change-Id: I04e408e734edc5498c32c4433f02da613bbfafa6
2024-07-10 01:25:57 +02:00
Bartosz Dziewoński
252bacff34 RecentChange: Replace use of legacy error arrays
Replace uses of soon-to-be-deprecated methods:
* ApiBase::errorArrayToStatus
* PermissionStatus::toLegacyErrorArray

Deprecate and replace uses of:
* RecentChange::doMarkPatrolled

Change-Id: I2311d1fa3772ba6be378ad6f497ed4c0df9b7aa8
2024-07-09 21:48:34 +00:00
jenkins-bot
01c517be20 Merge "Add namespace and deprecation alias to WatchedItem" 2024-05-17 10:42:01 +00:00
Ebrahim Byagowi
03dc841a08 Add namespace and deprecation alias to WatchedItem
This patch introduces a namespace declaration for the
MediaWiki\Watchlist to WatchedItem and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: Id2a582b624f21867240def2541c98ce5b1bd12b4
2024-05-17 13:26:36 +03:30
Ebrahim Byagowi
29bb97dd30 Add namespace and deprecation alias to RCFeed
This patch introduces a namespace declaration for the
MediaWiki\RCFeed to RCFeed and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I2e63e05901a75d8cf8a1e9d874dc916c0a5749a4
2024-05-17 13:18:07 +03:30
Ebrahim Byagowi
a717db8e60 Add namespace and deprecation alias to FormatJson
This patch introduces a namespace declaration for the
MediaWiki\Json to FormatJson and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I5e1311e4eb7a878a7db319b725ae262f40671c32
2024-05-16 16:28:01 +03:30
Timo Tijhof
b432fd2f20 Move various job classes to relevant component directories
Motivation:

* Remove need to hardcode out-of-component files in various places.
  Especially for Gerrit queries, this not only reduces effort but
  also makes these files more likely to show up in the first place.
* Clarify component boundaries and ownership, e.g. when filing tasks
  with a stack trace.
* Now rather than later, to avoid need for multiple class renames and
  aliases when PSR-4 namespaces are applied later (T166010).

Background:

Similar to how jobs in extensions belong to that extension, the same
is true within core. There is a distinction between the JobQueue system,
and individual jobs belonging to a specific feature or component,
likewise for deferred updates, and special pages.

To make a begin with this, I propose moving the job classes to their
respective components for cases where component boundaries are already
clear. E.g. due to exclusively being queued by that same component,
being named/introduced by the same commit, being already documented
as such in component descriptions on mediawiki.org.

Bug: T364652
Change-Id: I73d6b97c6ca9f5abd29f4277d0f845426aa23bd0
2024-05-10 20:14:00 +01:00
jenkins-bot
7d0fcccd02 Merge "Add namespace and deprecation alias to DeprecationHelper" 2024-05-05 13:56:35 +00:00
Hakan Özdemir
6c5684d41f Add namespace and deprecation alias to DeprecationHelper
This patch introduces a namespace declaration for the
MediaWiki\Debug to DeprecationHelper and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I808c6aa7836445feaa7b401624d79d01f2c70322
2024-05-05 14:16:35 +02:00
jenkins-bot
b01108102d Merge "Migrate to IReadableDatabase::newSelectQueryBuilder with queryInfo" 2024-05-05 10:48:15 +00:00
Umherirrender
d38b9e4cfa Migrate to IReadableDatabase::newSelectQueryBuilder with queryInfo
This is using SelectQueryBuilder::queryInfo to interact with legacy code

In the long term this needs refactor to get a SelectQueryBuilder from
the class instead of a query info array.

Bug: T344971
Depends-On: I5dff80a2819bba4e923654ef31816a54269354b3
Change-Id: Ibf44e7de30e71fe8dd6447f77dfd0bf726be0a9b
2024-05-04 19:56:11 +00:00
Samwalton9
65ab070b89 Update documentation for rc_new
Per the recentchanges table documentation, rc_new should be replaced with rc_source, which replaced rc_type.

Bug: T36320
Change-Id: Ie89e29b2363f36fe6080816c65d96394f6817fd9
2024-05-04 16:22:11 +03:00
James D. Forrester
3ed6668745 Formally deprecate code marked with @deprecated
Some of these have been marked in-code as deprecated for a long while,
but haven't ever been announced in the RELEASE-NOTES (and later,
HISTORY) file, so let's mark them up now so we can get the ball rolling
at least.

Per Gergo, the AuthManager one was 'born deprecated' and should only
have been used by humans also reading the deprecation notice given in
the code, and indeed no uses are known to code search, so also emit
deprecation warnings there immediately; others will have to wait until
uses have been migrated.

Change-Id: I0c1c71d8f4293623039302da35d58d2a24367e97
2024-05-03 18:25:03 +03:00
Jon Robson
b6adccbed6 Special:NewPages should generate markup consistent with other pager pages
This will allow us to style NewPages consistent with other Minerva
special pages.

Update getStartBody and getEndBody to be consistent with ContribsPager,
now that the output of the UL is output by mGroupByDate

Bug: T360843
Change-Id: I3424d8f4f7a40ff60827065e83532315ba35dfd3
2024-04-17 16:30:40 -07:00
jenkins-bot
b48017285d Merge "RecentChange: Avoid duplicate patrol log entry after patrol conflict" 2024-03-02 18:03:23 +00:00
xiplus
f7552491c4 RecentChange: Avoid duplicate patrol log entry after patrol conflict
Check the affected rows count to detect a patrol conflict, which is
when the database query succeeds, but it was a no-op because another
request (possibly from the same user, or someone else) marked it as
patrolled already.

We detect it using the `rc_patrolled` condition because without it,
affectedRows() would always return 1, as the previous update condition
could match either the patrolled or patrolled version of the row.

Bug: T196182
Change-Id: I2aa4f2f752a40657883e0a6714dbb175c9d2fdcb
2024-03-02 17:41:16 +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
060a1b1668 Replace last remaining wfGetDB() calls in core, except ResourceLoader
Bug: T330641
Change-Id: I6d30af6ff9f667e367d39befb80c2bb0bf5fb29e
2024-02-14 11:02:01 -05:00
Amir Sarabadani
ea268ddcfd Move away from wfGetDB() calls
If we are serious about getting rid of wfGetDB(), we should start
replcing callers with proper replacement.

These classes don't have any injection so it doesn't make sense to
introduce it for this specific usecase.

Bug: T330641
Change-Id: I645f67324d441288c63787c7e42390b59106c585
2024-02-12 21:23:38 +01:00
James D. Forrester
4bae64d1c7 Namespace includes/context
Bug: T353458
Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
2024-02-08 11:07:01 -05:00
James D. Forrester
0398171625 ChangesList: Switch from mixed Xml and Html classes to pure Html ones
Bug: T356544
Change-Id: Ic7c32515357610bd89d0e3965107d89a3d01f3f4
2024-02-05 21:54:21 +00:00
Arlo Breault
fc2a7030a8 Avoid misnesting div in span in OldChangesList
When OldChangesList is used, the mw-changeslist-line-inner that the
mw-changeslist-links is nested in is a span.

mw-changeslist-links is formatted as inline-block in skinStyles.less as
it is.

Bug: T275230
Change-Id: If97aa95472a73fce1f73c65dfcad961d24cf7e37
2024-01-25 17:37:25 -05:00
Daimona Eaytoy
7acfa6a0a5 Replace more instances of unchecked MWException
Most (all?) of the remaining usages are caught somewhere and will be
migrated later.

Bug: T328220
Change-Id: I5c36693a5361dd75b4f1e7a0bab5ad48626ed75c
2024-01-23 16:20:53 +00:00
Amir Sarabadani
014bc61006 Remove more indirect calls to IDBAccessObject::READ_* constants
Found via (?<!IDBAccessObject)::READ_

We are planning to deprecate and remove implementing IDBAccessObject
interface just to use the constants.

Bug: T354194
Change-Id: I89d442fa493b8e5332ce118e5bf13f13b8dd3477
2024-01-23 15:42:38 +01:00
Bartosz Dziewoński
e4c7272976 Change uses of getDBLoadBalancerFactory() to getConnectionProvider()
Update cases where one of the IConnectionProvider methods is called
immediately.

This doesn't really change anything, but I hope it helps promote
getConnectionProvider() as the common way to do this.

Follow-up to 8604c384f6.

Change-Id: Id0e7d02bab0c570343c2b1f03c70b44ee39db112
2024-01-22 22:27:45 +01:00
Dogu
f73d342b29 Replace deprecated MWException with InvalidArgumentException
Change-Id: I14391c156f66e9686f82b93d55e0bbcd951f8057
2024-01-07 06:18:13 +00:00
Dogu
43fcf91171 Consolidate duplicate branch in 'switch' statement
Merged duplicate branches in the switch statement related to the
RecentChange::SRC_NEW case, combining them with existing cases
for RecentChange::SRC_EDIT and RecentChange::SRC_CATEGORIZE.

Change-Id: If09288dcfdf40b4cf095a568eacac3621956e063
2024-01-04 00:48:16 +00:00
Amir Sarabadani
a778d3fea7 Inline once-called short private methods to its caller, part 1
This makes the code easier to read to avoid jumps and improves
encapsulation by not allowing the rest of the class having access to the
logic. Of course, if needed then some code can be refactored out again
but for now let's not do YAGNI.

Change-Id: Ic37524e386fc04fd67e33768417ff8425f85b0ca
2023-12-18 23:43:32 +00:00
James D. Forrester
67217d08df Namespace remaining files under includes/deferred
Bug: T166010
Change-Id: Ibd40734b96fd2900e3ce12239d09becfb4150059
2023-11-22 10:08:53 -05:00
Amir Sarabadani
2e1cd74ad2 Migrate off wfGetDB() in more places to ICP
This function is uber-deprecated, meaning even its replacement is
deprecated, We have already migrated in static functions and more.

In this batch, all calls have been migrated that there is already a call
to MediaWikiServices::getInstance() making the migration easier. Of
course in most cases, they should eventually turn into proper service
injection but this at least makes it clear what services should be
injected.

Also removing "category" group since we are removing all groups except a
handful from mw (see T263127 for more information).

Bug: T330641
Change-Id: I90cd35ee45a37eb6e6bf7a531cc8f75effbd0328
2023-11-20 14:40:28 +01:00
Amir Sarabadani
136fa38a4a Migrate to IConnectionProvider methods in more places
Getting rid of uber-deprecated wfGetDb() and recently deprecated
LB::getConnection.

Bug: T330641
Change-Id: Ifd4b4e01f2a120ad6db517cc8fd2eb6b11b72bc9
2023-10-05 19:51:20 +02:00
James D. Forrester
98f50660cb Drop RecentChange::getPerformer(), deprecated since 1.36
Change-Id: I10cd61f6088da3069d7e29e5fe4355747e83236e
2023-09-27 22:41:21 +00:00
Amir Sarabadani
f5abfb8d58 Bump codesniffer to 42.0.0
Most noisily, this enables MediaWiki.Arrays.OneSpaceInlineArray.

Change-Id: I8ab11399c67ce7e3ab1b6249b591452774393428
2023-09-27 15:06:32 -04:00
James D. Forrester
c1599c91b3 Namespace Config-related classes under \MediaWiki\Config
Bug: T166010
Change-Id: I4066885a7ea071d22497abcdb3f95e73e154d08c
2023-09-21 05:41:58 +00:00
James D. Forrester
468e69bccc Namespace Sanitizer under \MediaWiki\Parser
Bug: T166010
Change-Id: Id13dcbf7a0372017495958dbc4f601f40c122508
2023-09-21 05:39:23 +00:00
James D. Forrester
3851805f64 Namespace remaining User-related classes under \MediaWiki\User
Bug: T166010
Change-Id: Ibda1e8be0f23c6262a32b607f8260cad36f188fc
2023-09-20 09:12:08 +01:00
James D. Forrester
1d0b7ae1e2 Namespace User under \MediaWiki\User
Bug: T166010
Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
2023-09-19 19:18:16 +00:00
James D. Forrester
459cbb0494 Namespace remaining 'specialpage' files under \MediaWiki\SpecialPage
SpecialPageFactory is already here, but none of the others were yet.

Bug: T166010
Change-Id: I9689bf0a1ab329625e23669b99f019b96295fffd
2023-09-18 18:23:13 +01:00
James D. Forrester
5088626212 Namespace 'special' Pagers under \MediaWiki\Pager
They're under 'specials' because that's where they're mostly used,
but they're just another kind of Pager (shown by their use outwith
the MediaWiki\Specials hierarchy, which is a bad code smell for us
to review later).

Bug: T166010
Change-Id: Iad3f91582b723c1e6679525aa852ffdfd8c6d5ba
2023-09-18 18:23:13 +01:00
Daimona Eaytoy
f78fd3710d Add $wgRequest to phan's globals_type_map
The base phan config uses a file_exists check to determine whether to
use the namespaced class name, but it doesn't work when running against
core because MW_INSTALL_PATH isn't set. So specify the type in the local
config, and remove @phan-var annotations added in I6bbdbbe6.

Also use `::class` instead of string literals for classes.

Change-Id: I994a0ed32ea948253ed07ee3cc8868a0eaa6d8b9
2023-09-11 23:22:12 +02:00
Amir Sarabadani
5bd33d46ef Reorg: Move WebRequest to includes\Request
This has been approved as part of RFC T166010

Bug: T321882
Change-Id: I6bbdbbe6ea48cc1f50bc568bb8780fc7c5361a6f
2023-09-11 21:44:34 +01:00
Daimona Eaytoy
3f35734ac0 Remove redundant empty() constructs
empty() only makes sense when the expression it checks is possibly
undefined, otherwise it's equivalent to a truthiness check with the
additional downside of suppressing errors when it's not wanted.

Replace it with simple truthiness checks, using strict comparison when
that seems to help with polymorphic variables.

These were caught by a bespoke phan plugin.

Change-Id: I52999e5286a0d9ad70b0da40b41b9f998ecb990e
2023-09-08 23:18:11 +02:00
Tim Starling
95bd40b25c In query builders, use insertInto() and deleteFrom() instead of insert() and delete()
The design principle for SelectQueryBuilder was to make the chained
builder calls look as much like SQL as possible, so that developers
could leverage their knowledge of SQL to understand what the query
builder is doing.

That's why SelectQueryBuilder::select() takes a list of fields, and by
the same principle, it makes sense for UpdateQueryBuilder::update() to
take a table. However with "insert" and "delete", the SQL designers
chose to add prepositions "into" and "from", and I think it makes sense
to follow that here.

In terms of natural language, we update a table, but we don't delete a
table, or insert a table. We delete rows from a table, or insert rows
into a table. The table is not the object of the verb.

So, add insertInto() as an alias for insert(), and add deleteFrom() as
an alias for delete(). Use the new methods in MW core callers where
PHPStorm knows the type.

Change-Id: Idb327a54a57a0fb2288ea067472c1e9727016000
2023-09-08 10:16:08 +10:00
Amir Sarabadani
e1b3323312 Migrate calls to wfGetDB() in static methods
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
2023-09-05 10:48:31 +02:00
jenkins-bot
a4ec56b1f2 Merge "ChangesList: Cache user links" 2023-08-24 04:17:46 +00:00
jenkins-bot
b9bc8572b0 Merge "mark various anonymous functions as static" 2023-08-23 22:59:21 +00:00
James D. Forrester
e7ff62ea22 RecentChange: Drop getEngine(), deprecated since 1.29
Change-Id: Iad19dc62c4a06ccdb553ed11b3390679c761e17e
2023-08-23 17:31:01 -04:00
Reedy
a1144dc7c5 mark various anonymous functions as static
Change-Id: Iefe896769359f0d32e52bf20aa03e1c3715d5074
2023-08-22 19:38:38 +00:00