aboutsummaryrefslogtreecommitdiffstats
path: root/maintenance/undelete.php
Commit message (Collapse)AuthorAgeFilesLines
* add `use MediaWiki\Maintenance\Maintenance` to some maintenance classesNovem Linguae2024-12-051-0/+1
| | | | | | | | | this patch changes P–Z. still need to do subfolders in one file, I also deleted an errant line break that was disconnecting the class docblock from the class. Change-Id: I3b60c2a5817f12c47490e78e36cc18bfeeb98af9
* maintenance: add transaction round wrapper methods to MaintenanceAaron Schulz2024-11-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* 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
* maintenance: Replace deprecated PageArchive::undeleteAsUserUmherirrender2024-07-211-5/+9
| | | | | Bug: T339394 Change-Id: I49795be36c8b75ad2e6dc8caa2eb97e134530dfa
* Namespace User under \MediaWiki\UserJames D. Forrester2023-09-191-0/+1
| | | | | Bug: T166010 Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
* 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/+2
| | | | | Bug: T166010 Change-Id: Idcf0e9dc6e0841e4f132207bce0f96774dad898c
* Move code from PageArchive to a new UndeletePage commandDaimona Eaytoy2021-09-211-1/+1
| | | | | | | | This is just moving code verbatim, removing now-unneeded stuff, and duplicating tests as well. Bug: T290021 Change-Id: I540ddaaa11dfabcf0b87b608b151b5e34d199fd8
* 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
* maintenance scripts: Reduce direct references to $wgUserDannyS7122020-06-051-6/+8
| | | | | | | | Only use `wgUser` when setting or retrieving the global, not for the user object that it is set to Bug: T243708 Change-Id: Ie962192f1dbc066ba71b9abb48dc9d522d472c78
* Make use of PageArchive::undeleteAsUserDannyS7122020-03-181-1/+1
| | | | | Bug: T247188 Change-Id: I1dc38d039aa375fc607463360ed4d007b4cf16d5
* maintenance: Deprecate Maintenance::hasArg/getArg with no paramThiemo Kreuz2019-03-291-1/+1
| | | | | | | | | | | | | | | | | | | Benefit of keeping the parameter optional: - In maintenance scripts that really only have one parameter, it's a little more convenient to be able to ask for *the* parameter via an empty getArg(). Disadvantages: - It's unclear what getArg() means when there is no indication *which* argument the code asks for. This might as well return the last argument, or an array of all arguments. - In scripts with two or more arguments, it's confusing to see getArg( 1 ) next to an empty getArg(). - The methods are more complex and a bit more complicated to use with the extra feature of this parameter being optional. Users need to look up what the default is to be able to use it safely. Change-Id: I22a43bfdfc0f0c9ffdb468c13aba73b888d1f15e
* 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-2/+2
| | | | | | | | | | 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-2/+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
* SpecialUndelete/PageArchive: Use Config instead of globalsKunal Mehta2014-08-061-1/+1
| | | | Change-Id: Ic025412ed74d9cffad48a3ab04788d46ab43befb
* 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
* Use __DIR__ instead of dirname( __FILE__ )jeroendedauw2012-08-271-1/+1
| | | | | | We can now do this since we finally switched to PHP 5.3 for MW 1.20 and get rid of the silly dirname(__FILE__) stuff :) Change-Id: Id9b2c9cd2e678197aa81c78adced5d1d31ff57b1
* (bug 26854) Invalid user names go unchecked. Applied most of the patch ↵Roan Kattouw2011-11-201-0/+3
| | | | | | | submitted by Søren Løvborg, checking for null return values from User::newFromName() Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/103745
* Update undelete.php to use short option aliases.Alexandre Emsenhuber2011-04-141-4/+4
| | | | | | | People using --u and --r will need to change either to -u or --user for --u and to -r or --reason for --r. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/86067
* Fix concern raised by Brion in r74108 (but has really existed since the ↵Chad Horohoe2011-01-131-1/+1
| | | | | | | | | | | maintenance rewrite). Right now, including a maintenance script causes it to execute. This is bad when you want to reuse the particular class but not have it start executing all by itself. Until now, we relied on setting MW_NO_SETUP which was a) hacky, b) irreversable, and c) likely to be forgotten if you didn't use one of the wrappers like runChild(). Instead, move the freaky magic to doMaintenance and have *it* check if it's in a specific call stack that indicates this is being run from the file scope and should be executed. Rename DO_MAINTENANCE to RUN_MAINTENANCE_IF_MAIN so it's nice and clear what magic happens behind the require_once(). Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/80205
* Part of bug 26280: added license headers to PHP files in maintenanceAlexandre Emsenhuber2010-12-161-0/+15
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/78508
* Stylize maintenance folder..Sam Reed2010-05-221-1/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/66751
* Redo addArgs() as addArg() so we can actually do useful things with ↵Chad Horohoe2009-08-181-1/+1
| | | | | | | arguments like descriptions and proper requirement checks, similar to addOption() Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/55287
* Revert r54244 which was stupid and fix this properly. Require ↵Chad Horohoe2009-08-031-1/+1
| | | | | | | commandLine.inc/Maintenance.php using the full path every time. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/54312
* Merge maintenance-work branch (now with less errors!):Chad Horohoe2009-08-021-25/+26
| | | | | | | | | | | * Docs have been updated to indicate the standard on how to write maintenance scripts (MW.org docs will follow) Have ported vast majority of maintenance scripts to new format. Remaining ones (mostly FiveUpgrade-related) are a bit more tricky. commandLine.inc is untouched for now. Many have gotten code-style updates as well. Deleted .inc files were only used by their .php counterparts, and have been merged into single files. * (bug 11867) Lock error on redirect table when running orphans.php * (bug 16322) Allow maintenance scripts to accept DB user/pass over input or params * (bug 18566) Maintenance script to un/protect pages * initStats overhaul, now uses class SiteStatsInit. Also fixes bug 18930 Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/54225
* Revert r52336 "Merge maintenance-work branch:"Brion Vibber2009-06-241-26/+25
| | | | | | | | Seems to have broken a bunch of stuff. Don't commit giant non-critical changes that break Setup.php and all maint scripts. Thanks! Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/52340
* Merge maintenance-work branch:Chad Horohoe2009-06-241-25/+26
| | | | | | | | | | | | * (bug 16322) Allow maint scripts to accept DB user/pass over input or params if no AdminSettings.php * (bug 18768) Remove AdminSettings.php from MediaWiki core * (bug 19157) createAndPromote error on bad password * (bug 14201) Create AdminSettings.php during wiki installation, in the same way as LocalSettings.php * Introduce new Maintenance class framework and port a good number of scripts over; the ones that are left are a little more complicated. Read the docs. * Not deleting "unused" files yet, don't want to break everything at once :) Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/52336
* Fix 12384 : comment on maintenance/*php filesAntoine Musso2008-07-191-1/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/37845
* WARNING: HUGE COMMITAlexandre Emsenhuber2008-05-201-0/+6
| | | | | | | | | | | | | | | | | | Doxygen documentation update: * Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group. * Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file. * Removed some empty comments * Removed some ?> Added following groups: * ExternalStorage * JobQueue * MaintenanceLanguage One more thing: there are still a lot of warnings when generating the doc. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/35098
* Remove ?>'s from files. They're pointless, and just asking for people to ↵Aryeh Gregor2007-06-291-1/+1
| | | | | | | mess with the files and add trailing whitespace. (Yes, I looked over every one and reverted those that were bogus. Slash-enter a million times in less worked well enough, although it was a bit mind-numbing.) Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/23531
* Fix Parse error: syntax error, unexpected T_LNUMBERAntoine Musso2007-06-031-2/+2
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/22681
* Script to undelete a pageTim Starling2007-06-031-0/+33
Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/22679