aboutsummaryrefslogtreecommitdiffstats
path: root/maintenance/deleteEqualMessages.php
Commit message (Collapse)AuthorAgeFilesLines
* add `use MediaWiki\Maintenance\Maintenance` to some maintenance classesNovem Linguae2024-11-121-0/+1
| | | | | | | A–F. Still need to do F–Z. Bug: T353458 Change-Id: Ieb4bad0658b9cddc9403c6a55ef3bd1245aa08ae
* Exclude boilerplate maintenance code from code coverage reportsDreamy Jazz2024-08-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * Maintenance scripts in core have bolierplate code that is added before and after the class to allow directly running the maintenance script. * Running the maintenance script directly has been deprecated since 1.40, so this boilerplate code is only to support a now deprecated method of running maintenance scripts. * This code cannot also be marked as covered, due to PHPUnit not recognising code coverage for files. * Therefore, it is best to ignore this boilerplate code in code coverage reports as it cannot be marked as covered and also is for deprecated code. What: * Wrap the boilerplate code (requiring Maintenance.php and then later defining the maintenance script class and running if the maintenance script was called directly) with @codeCoverageIgnore comments. * Some files use a different boilerplate code, however, these should also be marked as ignored for coverage for the same reason that coverage is not properly reported for files. Bug: T371167 Change-Id: I32f5c6362dfb354149a48ce9c28da9a7fc494f7c
* Consistent spelling of "subpage"Amir E. Aharoni2024-08-061-1/+1
| | | | | | | | Also: 1. Other minor fixes in comments touched by this patch. 2. Add a separate test for subpage with spaces. Change-Id: I267f19027098e5778b1cd491826e1741fc7ee794
* maintenance: Introduce getReplicaDB() and getPrimaryDB()Amir Sarabadani2024-01-181-2/+2
| | | | | | | | | | | | And start using them instead of wfGetDB(), LB/LBF connection methods or worse, $this->getDB(). $this->getDB() reuses the database object regardless of whether you're calling a replica or primary, leading to returning a replica on a primary and other way around. Bug: T330641 Change-Id: I9e2cf85ca277022284fc26b9f37db57bd12aaa81
* Fix typo in maintenance scriptNiklas Laxström2023-12-131-1/+1
| | | | Change-Id: Ia8ea294b7bc961fe34dd4457a8eabc27f41c4056
* Namespace User under \MediaWiki\UserJames D. Forrester2023-09-191-0/+1
| | | | | Bug: T166010 Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
* Namespace 'special' Pagers under \MediaWiki\PagerJames D. Forrester2023-09-181-0/+1
| | | | | | | | | | 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
* Merge "maintenance: Replace usages of deprecated WikiPage::doDeleteArticleReal"jenkins-bot2023-09-111-5/+4
|\
| * maintenance: Replace usages of deprecated WikiPage::doDeleteArticleRealDaimona Eaytoy2021-11-081-5/+4
| | | | | | | | | | | | Use DeletePage instead. Change-Id: Icf064d6f8ce609d1119b45377af037ed03e464a4
* | maintenance: Begin using `Maintenance::getServiceContainer()`Derick Alangi2023-09-041-3/+2
| | | | | | | | | | | | | | | | | | | | | | 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
* | Reorg: Namespace the Title classJames D. Forrester2023-03-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is moderately messy. Process was principally: * xargs rg --files-with-matches '^use Title;' | grep 'php$' | \ xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1' * rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \ xargs rg --files-with-matches 'Title\b' | \ xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1' * composer fix Then manual fix-ups for a few files that don't have any use statements. Bug: T166010 Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
* | Use LanguageNameUtils::AUTONYMS/SUPPORTED instead of hard coded valueUmherirrender2022-12-291-1/+2
| | | | | | | | | | | | Easier to spot the documentation what happen with this option Change-Id: I6764dff8f79a6e667a0f4f61336f6280c7f13ed2
* | Various doc fixes about false on method arguments/return typesUmherirrender2022-11-101-1/+1
| | | | | | | | | | | | Doc-only changes Change-Id: I5177f582ae7ee70c357e9389fed14819faf79463
* | Merge "maintenance: Use $this->waitForReplication()"jenkins-bot2022-10-271-2/+1
|\ \
| * | maintenance: Use $this->waitForReplication()Amir Sarabadani2022-10-241-2/+1
| |/ | | | | | | | | | | | | This adds reconfiguring db pools in case a replica gets depooled Bug: T298485 Change-Id: Id052ce8ed45c51e51b071778858d27b48605bf93
* / Reorg: Move StubObject classes in includes to its own directoryAmir Sarabadani2022-10-251-0/+1
|/ | | | | Bug: T166010 Change-Id: Idcf0e9dc6e0841e4f132207bce0f96774dad898c
* Emit deprecation warnings reading from $wgUserDannyS7122021-09-151-2/+1
| | | | | | | | | | | | | | | | | | 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
* Hard deprecate User group methodsvladshapik2021-07-231-1/+2
| | | | | | | | | | | | | | | | 1) The following methods were hard deprecated: - User::addAutopromoteOnceGroups - User::getEffectiveGroups - User::getAutomaticGroups - User::getFormerGroups 2) User ::getGroups, ::getGroupMemberships, ::addGroup, ::removeGroup were replaced in the production code, but they were not hard deprecated because of conflict with UserRightsProxy class. Bug: T275148 Change-Id: Ia69598316f5dc5dd9511f6112b5b13e1aa07575a
* Replace uses of DB_MASTER with DB_PRIMARYJames D. Forrester2021-04-291-1/+1
| | | | | | Just an auto-replace from codesniffer for now. Change-Id: I5240dc9ac5929d291b0ef1c743ea2bfd3f428266
* Merge "Inject services into SpecialAllMessages"jenkins-bot2020-11-201-1/+5
|\
| * Inject services into SpecialAllMessagesUmherirrender2020-11-021-1/+5
| | | | | | | | | | | | | | | | | | | | | | This covers only directly used services by this special page and pager Services used by the base class are not part of this patch set Have to change the signature of one static function to avoid global state and changed the caller as well Bug: T259960 Change-Id: I9502c6cfd718b6edb074a50931094fcdbf2c48de
* | Replace deprecated WikiPage::factory/newFromID in maintenance scriptsUmherirrender2020-11-121-5/+6
|/ | | | Change-Id: I5b2d4313f986484368da9b63c9a19892c2328dae
* Replace wfWaitForSlaves() with LBFactory::waitForReplication()Reedy2020-05-021-1/+2
| | | | Change-Id: I337147d61e2ec686a8672d0340dff4b6783f78cd
* Maintenance: Change ::doDeleteArticle to WikiPage::doDeleteArticleRealDannyS7122020-03-251-7/+7
| | | | | Bug: T248000 Change-Id: I48bcf68e90209c5cfc2b7fedbf70fdffc374ec64
* Remove usages of deprecated Language methodsPetr Pchelko2020-02-161-3/+6
| | | | Change-Id: Iad3375b141b1d87c890baec6ecd16ed92f93e699
* Mass conversion of $wgContLang to serviceAryeh Gregor2018-08-111-8/+9
| | | | | | | Brought to you by vim macros. Bug: T200246 Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
* Use ::class to resolve class names in maintenance scriptsUmherirrender2018-01-231-1/+1
| | | | | | | This helps to find renamed or misspelled classes earlier. Phan will check the class names Change-Id: I1d4567f47f93eb1436cb98558388e48d35258666
* Maintenance: add fatalError() methodBryan Davis2017-11-211-2/+2
| | | | | | | | Deprecate the second argument to Maintenance::error() in favor of a new Maintenance::fatalError() method. This is intended to make it easier to review flow control in maintenance scripts. Change-Id: I75699008638f7e99b11210c7bb9e2e131fca7c9e
* Convert all array() syntax to []Kunal Mehta2016-02-171-7/+7
| | | | | | | | | | Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Notes: * Disabled CallTimePassByReference due to false positives (T127163) Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
* Use addDescription() instead of accessing mDescription directlyMax Semenik2016-01-301-2/+2
| | | | Change-Id: I0e2aa83024b8abf5298cfea4b21bf45722ad3103
* Update wfGetDB calls in Maintenance scripts to use getDB()Reedy2016-01-021-1/+1
| | | | Change-Id: I9ad6745d84506b736dae94747256caac89715899
* User: Mostly remove password handlingBrad Jorsch2015-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AuthManager is coming, which will make it easier to add alternative methods of authentication. But in order to do that, we need to finally get around to ripping the password-related bits out of the User class. The password expiration handling isn't used anywhere in core or extensions in Gerrit beyond testing for expired passwords on login and resetting the expiry date on password change. Those bits have been inlined and the functions removed; AuthManager will allow each "authentication provider" to handle its own password expiration. The methods for fetching passwords, including the fact that mPassword and other fields are public, has also been removed. This is already broken in combination with basically any extension that messes with authentication, and the major use outside of that was in creating system users like MassMessage's "MediaWiki message delivery" user. Password setting methods are silently deprecated, since most of the replacements won't be available until AuthManager. But uses in unit testing can be replaced with TestUser::setPasswordForUser() immediately. User::randomPassword() and User::getPasswordFactory() don't really belong in User either. For the former a new PasswordFactory method has been created, while the latter should just be replaced by the two lines to create a PasswordFactory via its constructor. Bug: T47716 Change-Id: I2c736ad72d946fa9b859e6cd335fa58aececc0d5
* maintenance: Handle errors in deleteEqualMessages.phpTimo Tijhof2015-08-261-3/+8
| | | | | | Follows-up 49107fcc2. Change-Id: I1b4b3f89a383a9b010d557ae0c6cbd767be60fb0
* deleteEqualMessages.php: Avoid "Transaction already in progress" warningKevin Israel2015-08-261-2/+3
| | | | | | | | | | | Set the $commit parameter of WikiPage::doDeleteArticle() to true so the transaction it starts is explicitly committed. Also fixed similar bugs in two other maintenance scripts. Follows-up 02f17b579060. Bug: T110189 Change-Id: Ifde98066e25cb616f23c8998f9461ebf7a2073d6
* Fix up php syntax that accidentally became part of a string literalTimo Tijhof2014-08-271-6/+6
| | | | | | | | | | | | Follows-up d15f1cc5e1d6db78. Previous output: > 474 pages in the MediaWiki namespace ' . > 'override messages. > 4 pages are equal to the default message ' . > '(+ 0 talk pages). Change-Id: I6104f716f7dc32d638a2f5a7c37c3a507efad7dd
* Add missing @param to function docsumherirrender2014-08-181-0/+1
| | | | Change-Id: Ib26407bc55dff7969d8a3b1e2ae51751b202d8fb
* Break some long lines in maintenance, skins, testsumherirrender2014-07-241-7/+13
| | | | Change-Id: I5d86ad3e0c90e09440268a670f5af3e2bf080612
* Capitalise Message in SpecialAllMessages filesReedy2014-06-161-1/+1
| | | | | | No internal changes to Special:Allmessage etc made Change-Id: I21a164af0b6ec123bf654cd1e4e7085b1192f067
* Removed begin/commit calls that result in error spamAaron Schulz2014-05-211-2/+0
| | | | | | | * The delete calls already try to start transactions. Also CLI scripts run in autocommit mode anyway. Change-Id: I433691b3e4e578983e4e15334248f029e0b0d277
* Update formatting in maintenance/ (2/4)Siebrand Mazeland2014-04-231-0/+2
| | | | Change-Id: I2b791d3bff0de464b6bdaaeae0622c065389c31c
* deleteEqualMessages: Exclude messages that are empty by defaultTimo Tijhof2013-10-091-1/+7
| | | | | | | | | | | The main purpose of this script is to purge local overrides to avoid them from blocking an i18n update in the future. However empty messages should remain empty and often have a richer edit history (e.g. Sitenotice) and may not stay empty for long. Change-Id: I5b416cda25a3641862df9919c46ae59ad5d5d6e0
* phpcs: More require/include is not a functionTimo Tijhof2013-05-211-1/+1
| | | | | | | | | | | | | Follows-up I1343872de7, Ia533aedf63 and I2df2f80b81. Also updated usage in text in documentation and the installer LocalSettingsGenerator. Most of them were handled by this regex: - find: (require|include|require_once|include_once)\s*\(\s*(.+?)\s*\)\s*;$ - replace: $1 $2; Change-Id: I6b38aad9a5149c9c43ce18bd8edbab14b8ce43fa
* Move the global to the place it is needed.Platonides2013-05-201-1/+2
| | | | | | Follow-up 8be2e118 Change-Id: Ic72a8f24fdcbafcb689370c845dcf6df4f864493
* deleteEqualMessages: Refactor to support all langcode subpagesTimo Tijhof2013-05-171-32/+64
| | | | | | | | | | | | | | | | | Previously it ran for either the base pages (comparing against content language) or 1 lang-code subpage. And the latter was actually broken as it forgot to add the subpage back on, thus resulting in incorrect deletions (deleting MediaWiki:Foo instead of MediaWiki:Foo/nl). Also fixed a bug where it used the subpage lang-code to create a Language object and call ucfirst(). Page titles should only be capitalized by content language. Bug: 48050 Bug: 43917 Change-Id: I2680413c276365a44c935a6f6fdd740daa86341e
* phpcs: Fix WhiteSpace.LanguageConstructSpacing warningsTimo Tijhof2013-05-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Squiz.WhiteSpace.LanguageConstructSpacing: Language constructs must be followed by a single space; expected "require_once expression" but found "require_once(expression)" It is a keyword (e.g. like `new`, `return` and `print`). As such the parentheses don't make sense. Per our code conventions, we use a space after keywords like these. We appeared to have an unwritten exception for `require` that doesn't make sense. About 60% of require/include usage was missing the space and/or had superfluous parentheses. It is as silly as print("foo") or return("foo"), it works because keywords have no significance for whitespace between it and the expression that follows, and since experessions can be wrapped in parentheses for clarity (e.g. when doing string concatenation or mathematical operations) the parenthesis before and after basiclaly just ignored. Change-Id: I2df2f80b8123714bea7e0771bf94b51ad5bb4b87
* deleteEqualMessages: Include list of pages in dry runTimo Tijhof2013-05-031-6/+17
| | | | | | | | | | Also clarify that the talk page number is in addition to the other number. So it says "10 pages are equal (+ 2 talk pages)" instead of "10 pages are equal (2 talk pages)". Document better that the default is a dry run. Change-Id: I95edb08d7b92c393ed226bef2575e52a6135f8df
* (bug 43915) Implement deleteEqualMessages.phpTimo Tijhof2013-01-311-0/+143
Change-Id: I97529b775d4db4f996c40395c891a0049d2e43c5