aboutsummaryrefslogtreecommitdiffstats
path: root/maintenance/importSiteScripts.php
Commit message (Collapse)AuthorAgeFilesLines
* add `use MediaWiki\Maintenance\Maintenance` to some maintenance classesNovem Linguae2024-12-041-0/+1
| | | | | | | | | | | | | F–P. Still need to do P–Z. there's a couple spots where I added `use MediaWiki\Maintenance\LoggedUpdateMaintenance;` or similar instead. some of the existing "use" blocks were in weird spots (e.g. above the copyright docblock, or too far down). i didn't move those because they are out of scope for this patch. Change-Id: I5b6a8f3eae5be85d67bccfcce31c0c2027850f45
* maintenance: add transaction round wrapper methods to MaintenanceAaron Schulz2024-11-051-14/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | These help with the basic pattern of running loop of transaction rounds, each of which should handle deferred updates and possible replication wait barriers. Add Maintenance::newBatchIterator() helper method for easily wrapping an iterator with an batching iterator. This is useful for grouping the writes in transaction rounds and avoiding the slowness of excessive waitForReplication() calls. Update some maintenance scripts to use these methods, including: * makeTestEdits.php * importSiteScripts.php * cleanupSpam.php * protect.php * undelete.php * rollbackEdits.php * namespaceDupes.php * uppercaseTitleForUnicodeTransition.php Deprecate the single-connection transaction wrappers. Bug: T373057 Change-Id: I42256f9e775bad102e6e5d47c512e0b5cc60d070
* Switch over a bunch of class_alias uses to actualsJames D. Forrester2024-10-031-0/+1
| | | | Change-Id: Id175a83e71cc910eaee5d5890a9106872a3ca3b8
* 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
* Add namespace and deprecation alias to FormatJsonEbrahim Byagowi2024-05-161-0/+1
| | | | | | | | | 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
* Namespace User under \MediaWiki\UserJames D. Forrester2023-09-191-0/+1
| | | | | Bug: T166010 Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
* 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
* Replace substr with cleaner string methodsMatěj Suchánek2023-05-201-1/+1
| | | | | | | | | | Use str_starts_with, str_ends_with or string offset where appropriate. This fixes a bug in MimeAnalyzer where the "UTF-16LE" header could not be identified because of wrong constant. This is the exact type of bug that the new functions can avoid. Change-Id: I9f30881e7e895f011db29cf5dcbe43bc4f341062
* 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
* Reorg: Move StubObject classes in includes to its own directoryAmir Sarabadani2022-10-251-0/+1
| | | | | Bug: T166010 Change-Id: Idcf0e9dc6e0841e4f132207bce0f96774dad898c
* phan: Disable null_casts_as_any_type settingUmherirrender2022-03-211-0/+1
| | | | | | | | | | | Make phan stricter about null types by setting null_casts_as_any_type to false (the default in mediawiki-phan-config) Remaining false positive issues are suppressed. The suppression and the setting change can only be done together Bug: T242536 Bug: T301991 Change-Id: I0f295382b96fb3be8037a01c10487d9d591e7e01
* Emit deprecation warnings reading from $wgUserDannyS7122021-09-151-3/+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
* Use WikiPage::doUserEditContent() instead of ::doEditContent()DannyS7122021-06-281-1/+1
| | | | | | | | Results in passing a user where previously the fallback to $wgUser was being used, mostly in tests. Bug: T255507 Change-Id: Iabe24315b23c0ad1272353186425e71974528d23
* Replace deprecated WikiPage::factory/newFromID in maintenance scriptsUmherirrender2020-11-121-3/+5
| | | | Change-Id: I5b2d4313f986484368da9b63c9a19892c2328dae
* Deprecate the Http classAryeh Gregor2019-05-061-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | All methods got moved to HttpRequestFactory or MWHttpRequest or dropped. I made the return value of the new HttpRequestFactory::request/get/post methods null on error instead of false, so that when we drop PHP 7 support, we can use a "?string" return value. This could theoretically change behavior of code that was switched from the old Http methods, but probably won't. I kept the old behavior for the deprecated methods. I changed the default value of $wgHTTPProxy from false to ''. This way it should be usable directly without a trivial wrapper method. For the benefit of anyone who might have set it to false in LocalSettings.php, I also recommend casting to string just in case. Http::$httpEngine is deprecated. Eventually it will be removed along with the curl and PHP engines, leaving only the Guzlle engine. I also added deprecation of MWHttpRequest::factory, which occurred in 1.31, to the release notes for 1.34. Now hopefully we can hard-deprecate it in another couple of versions. Bug: T214390 Change-Id: I2a316a758d793857f248bd251b90f5e9a6440e3a
* 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
* Convert all array() syntax to []Kunal Mehta2016-02-171-8/+8
| | | | | | | | | | 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-1/+1
| | | | Change-Id: I0e2aa83024b8abf5298cfea4b21bf45722ad3103
* User: Mostly remove password handlingBrad Jorsch2015-10-131-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Profile all external HTTP requests from MWChad Horohoe2015-03-031-2/+2
| | | | Change-Id: Ie980b080da2ef21ec7d9fc32f1accc55710de140
* findHooks.php, importSiteScripts.php: Use format=jsonKevin Israel2014-09-211-14/+21
| | | | | | | | * Also added query continuation support to findHooks.php. * Also fixed query continuation support in importSiteScripts.php (broken by 2b3f4d821cd4). Change-Id: I7ef62d370f5e2f598ac4c5857ac0dbf3ee4c8fa2
* Update formatting in maintenance/ (3/4)Siebrand Mazeland2014-04-231-3/+1
| | | | Change-Id: I4390c4ea12a6a626b0e6817b6446635116ca9fe3
* 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
* 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
* Cleanup of Wikidata branch.daniel2012-10-081-7/+2
| | | | | | | This cleans up several issues raised in comments to I3b2dad3a, mostly style and merge artifacts. Change-Id: I99f5e300a671db1353db151cd187ffd2e4478d03
* merged masterdaniel2012-08-291-1/+1
| | | | Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
* Revert "merged master"Daniel Kinzler2012-08-291-1/+1
| | | This reverts commit 67bfdc7a68940d901e585eadd984a2074bf0216a
* merged masterdaniel2012-08-291-1/+1
| | | | Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
* Replace usage of doEdit() with doEditContent()daniel2012-08-281-1/+2
| | | | Change-Id: I2c423744bd91044c37bbec53b35729bd1c09901b
* merging latest masterdaniel2012-08-201-2/+7
| | | | Change-Id: I36b7f2f63ab8c08f8412d521dc68ea45c8b67711
* Improve documentation of maintenance scripts.Alexandre Emsenhuber2012-07-241-15/+20
| | | | Change-Id: If0af9922ede902c2c6f18b627d5810f3e888c944
* Added missing GPLv2 headers in some places.Alexandre Emsenhuber2012-06-141-0/+16
| | | | | | Also made file/class documentation more consistent. Change-Id: I8ee0861bfc2e9ff6511ad61175f1f1273739816c
* Fix doc for maintenance/Antoine Musso2012-02-081-1/+4
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/110941
* * Use WikiPage instead of Article to call doEdit()Alexandre Emsenhuber2012-01-081-5/+12
| | | | | | | | * Pass the User doing the edit to doEdit() * Check for invalid title before fecthing content and doing the edit Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/108365
* Maintenance script to import all scripts in the MediaWiki namespace from a ↵Bryan Tong Minh2011-02-281-0/+76
local site. Useful for local debugging of broken scripts. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/82932