Commit graph

12 commits

Author SHA1 Message Date
Bartosz Dziewoński
4108bbe1af Maintenance: Print errors from StatusValue objects in a consistent way
Allow Maintenance::error() and Maintenance::fatalError() to take
StatusValue objects. They now print each error message from the
status on a separate line, in English, ignoring on-wiki message
overrides, as wikitext but after parser function expansion.

Thoughts on the previously commonly used methods:

- $status->getMessage( false, false, 'en' )->text()
  Almost the same as the new output, but it allows on-wiki message
  overrides, and if there is more than one error, it prefixes each
  line with a '*' (like a wikitext list).

- $status->getMessage( false, false, 'en' )->plain()
- $status->getWikiText( false, false, 'en' )
  As above, but these forms do not expand parser functions
  such as {{GENDER:}}.

- print_r( $status->getErrorsArray(), true )
- print_r( $status->getErrors(), true )
  These forms output the message keys instead of the message text,
  which is not very human-readable.

The error messages are now always printed using error() rather
than output(), which means they go to STDERR rather than STDOUT
and they're printed even with the --quiet flag.

Change-Id: I5b8e7c7ed2a896a1029f58857a478d3f1b4b0589
2024-06-12 00:07:02 +02:00
Gergő Tisza
cea267467a
createBotPassword: Use plain text for rights info
Follows up If3b9bce2f02806572cc6cc1194a07cb7d5b8d6da.

Change-Id: I022bb5727027e5ceb3ca1d31d431e903296e7b44
2024-02-04 18:36:46 -08:00
Samuel Guebo
15402237af Split User::getRightDescription into two methods
- Add getRightDescriptionHtml() to return HTML
  the change handles cases where the message contains wikitext
- Use the new method getRightDescriptionHtml() in createBotPassword

Bug: T312819
Change-Id: If3b9bce2f02806572cc6cc1194a07cb7d5b8d6da
2024-01-31 15:28:37 -05: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
Derick Alangi
74033c50cd maintenance: Begin using Maintenance::getServiceContainer()
Maintenance class provides a method for getting a fresh reference
of the MW services container instance. Let's make use of these in
maintenance scripts now that we have it.

NOTE: There are still some static methods like in refreshLinks.php
that makes use of services that we can't use this method for now.

Change-Id: Idba744057577896fc97c9ecf4724db27542bf01c
2023-09-04 10:39:58 +00:00
Umherirrender
d56f7e5dbc maintenance: Replace deprecated User::idFromName
Bug: T325687
Change-Id: I01c0a4ec1076ff360cd93cef86e0b40967e61f46
2022-12-21 20:12:14 +01:00
Máté Szabó
36dd10f9de Migrate use of ${var}-style string interpolation
The "${var}" and "${expr}" style string interpolations are deprecated in
PHP 8.2. Migrate usages in core to "{$var}" as appropriate.

Bug: T314096
Change-Id: I269bad3d4a68c2b251b3e71a066289d4ad9fd496
2022-07-29 02:45:09 +02:00
Alexander Vorwerk
0b0be8bd77 Use GrantsInfo and GrantsLocalization instead of MWGrants
MWGrants is deprecated and should be replaced with the GrantsInfo and
the GrantsLocalization services.

Bug: T253077
Change-Id: Ic73d98bc014ff46fc5d80e93db7de4bb18d84ae2
2022-07-10 11:49:15 +00:00
Umherirrender
2e4ee47c3d Cleanup mixed space/tab line indent
Change-Id: I833052a656b1ce419c0929f6f0514f2a33c2c4cc
2021-09-04 00:52:31 +02:00
Reedy
76249a28d2 Validate max length of bp_restrictions and bp_grants
Bug: T260631
Bug: T260633
Change-Id: Ifc35e01c711f1394f45748f693e7a46695b2d471
2020-12-05 02:10:01 +00:00
Alex Dean
8c8654cce0 Add a maintenance script to create bot passwords.
This is useful in testing environments where we want to spin up new mediawiki
instances and configure them programatically.

Change-Id: Ice94b67cb8775786a754de51010e78211954b2b0
2020-08-21 07:25:33 +00:00