aboutsummaryrefslogtreecommitdiffstats
path: root/maintenance/dumpIterator.php
Commit message (Collapse)AuthorAgeFilesLines
* Remove 2-line PHPDocs that just repeat the types from the codethiemowmde2025-01-171-2/+0
| | | | | | | | | | | | | | | | Same as Ia294bf4 did for 1-line comments. This patch removes slightly more complex 2-line PHPDoc comments that don't add any new information to the code, but literally repeat what the code already says. They say "don't document the code, code the documentation", and we are doing this more and more. We just tend to forget to remove the obsolete comments. Note I'm also removing a line of text in a few cases when it's very short and literally says the same as the method name. Again, such comments add zero new information. Change-Id: I01535404bab458c6c47e48e5456403b7a64198ed
* Remove trivial 1-line PHPDocs that just repeat the codethiemowmde2025-01-161-3/+0
| | | | | | | | | | | | | I assume these are all either auto-generated by an IDE or the language-level type declarations have been added later. In any case the comments don't add any new information to what the code already says. This is just extra clutter that makes the code harder to read, I would argue. There are many, many more comments like this. In this patch I intentionally focus on the most trivial 1-line comments. Change-Id: Ia294bf4ce0d8a77036842fe25884bc175c2b0e7d
* 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
* maintenance: Use namespaced classesUmherirrender2024-10-211-0/+1
| | | | | | | This does not include use of MediaWiki\Maintenance\Maintenance, assuming the maintenance scripts going into the same namespace Change-Id: I488f95b537ce86eb5e463be7bce3653610dd13d9
* 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
* Use namespaced classes (1)Umherirrender2024-06-161-0/+1
| | | | | | | Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: Ic4d4dd61de5ab896fb6173eb579c81f164a1e4a3
* Make Maintenance::finalSetup require a SettingsBuilderdaniel2024-01-081-1/+1
| | | | | | | | | | | | | | | Maintenance::finalSetup should have access to a SettingsBuilder so it can manipulates config settings without resorting to global variables. MaintenanceRunner will always provide a SettingsBuilder when calling this method, so implementations should be able to rely on always getting one. The $settings parameter was introduced as optional in order to maintain backwards compatibility with implementations that did not declare the parameter. But these should all have been fixed since. Depends-On: I8a3699b13bfb4dc15f3bed562731ed9d525651cc Change-Id: I334a103e02fd905faafc43c7c5b95996bc91fd18
* WikiImporter: Pass Authority for permissions instead of global contextBartosz Dziewoński2023-12-111-1/+4
| | | | | | | | | | | | | | | Pass Authority to WikiImporter constructor, instead of looking at the user from RequestContext::getMain(), and skipping this check if $wgCommandLineMode is true. Maintenance scripts now use UltimateAuthority, to match the original intent of skipping permission checks, see 2ed55f42 / r96311. The Authority parameter to WikiImporterFactory::getWikiImporter() is optional for now for backwards-compatibility. It should become required later after deprecation. Change-Id: Iea1d03dcdcbda2f9a9adbff1b0d319efd22c4d86
* Bump codesniffer to 42.0.0Amir Sarabadani2023-09-271-0/+1
| | | | | | Most noisily, this enables MediaWiki.Arrays.OneSpaceInlineArray. Change-Id: I8ab11399c67ce7e3ab1b6249b591452774393428
* maintenance: Begin using `Maintenance::getServiceContainer()`Derick Alangi2023-09-041-2/+1
| | | | | | | | | | | 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
* Remove WikiRevision::downloadSourceMatěj Suchánek2022-11-041-1/+1
| | | | | | It has been deprecated since 1.31 and it is unused. Change-Id: I695e7f5d253076829ba9b58bccd7bfc77624c393
* Fix many typos in commentsMatěj Suchánek2022-05-101-1/+1
| | | | | | Found using IntelliJ's "Typo" code inspection. Change-Id: I746220ebe6e1e39f6cb503390ec9053e6518cf16
* Use MainConfigNames instead of string literals, #5Aryeh Gregor2022-04-271-2/+3
| | | | | | | This should be the last of the usages in core, although I'm sure a few are hiding somehow. Change-Id: I7bf0b24bf23d3efb4c56a891830bbfe67945e899
* snapshot: Add @var documentation for class propertiesUmherirrender2022-03-091-1/+3
| | | | Change-Id: I80ba53bdeb730a115ab3eec4849a38a13a896cdb
* Allow config merge strategies to be bypassed.daniel2022-02-221-1/+1
| | | | | | | | | | Sometimes, we need to force an exact value and bypass the default behavior of merging config variables. This also renames setConfigValue to putConfigValue, to avoid confusion about the behavior of that method. Change-Id: I82c606632b94f974e655a44a0b63394de7a0804b
* Reapply "SettingsBuilder: allow maintenance scripts to manipulate config"Ppchelko2022-01-261-5/+11
| | | | | | | | | | This reverts commit 4f7a4a2477ceeac68011d8f550a30d005c78dfdf. Reason for revert: This change is good, just need some preparation in extensions. Depends-On: I24221be2cedfa132fc94d39d72e4a133cc3cdb12 Depends-On: I5e6119b650e581c6aa5a1132aa071b49cff8b8ca Change-Id: I5a5a9000751fa3914c9d432eb49475091b3bdb80
* Revert "SettingsBuilder: allow maintenance scripts to manipulate config"Ppchelko2022-01-261-11/+5
| | | | | | | | This reverts commit a652f306a542c0efdfa0bef33cd68c8f6587e0bc. Reason for revert: need to prepare extensions first Change-Id: Iccedf38a8dc964db7c49fd51c971912655122081
* SettingsBuilder: allow maintenance scripts to manipulate configdaniel2022-01-261-5/+11
| | | | | | | | | | | Maintenance scripts often need to manipulate configuration settings. This introduces a way to do this cleanly via SettingsBuilder, removing the need to rely on global variables. Bug: T294739 Bug: T294742 Bug: T300128 Change-Id: Ibf443fd564bbbf388cce8ab4dabba55ebca0dfa4
* WikiImporter: inject servicesZabeMath2021-05-241-1/+5
| | | | | | | | This patch injects services into WikiImporter. It also adds a WikiImporterFactory service for creating WikiImporter instances. Change-Id: I2966297e5728fca1ae8280361f1008cef6c6041b
* Merge "maintenance: Remove preprocessDump.php"jenkins-bot2021-03-041-1/+1
|\
| * maintenance: Remove preprocessDump.phpTimo Tijhof2021-01-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This script takes an offline XML dump file, containing wikitext pages, and feeds them through the Preprocessor without actually importing any content into the wiki as revisions or pages. The documented purpose of the script is to "get statistics" or "fill the cache". - I was unable to find any stats being emitted. - I did find that the called Preprocessor method indirectly writes to "preprocess-hash" cache keys, which have a TTL of 24 hours (e.g. Memcached). I could not think of a use case for populating Memcached with parse results for pages that do not exist on a given wiki. It was created in 2011 with r80466 (ad8b42449d) without a use case described or referenced. I suspect it may've been used to help inform the development of a major change to the Preprocessor around that time, but it doesn't appear to be needed for that any more, and does not appear to have been aimed at general usage by site operators. If and when something it is needed for new developments, it can be easily brought back rather than maintained as-is. Change-Id: I139aa4ee8c2f92a40e94824c709556dda7ec74ff
* | Use static closures where safe to useUmherirrender2021-02-111-1/+1
| | | | | | | | | | | | | | | | | | This is micro-optimization of closure code to avoid binding the closure to $this where it is not needed. Created by I25a17fb22b6b669e817317a0f45051ae9c608208 Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
* | DumpIterator: Replace deprecated WikiRevision::setText()Ammar Abdulhamid2021-01-251-4/+8
|/ | | | Change-Id: I4646ce4890a89df34d3f8b6d055f9cedc9bda9fc
* set revision Title before setting text, or there may be no content modelAriel T. Glenn2021-01-221-1/+1
| | | | | | | | with the reverse order, the content model of the rvision is null, and it can't be gotten from the title, so dumpIterator dies when the file option is used instead of a dump. Change-Id: Ia67097565953f00068399da3225b939fb105ba4a
* Fix bad use of `|=` PHP bit operation where `= … ||` bool is intendedUmherirrender2020-08-121-1/+1
| | | | | | | | | Do not use bit operator on bool as it does not work the same way. |= is not a short form of bool or (||) and assignment (=). It is the short form of bitwise or (|) and assignment (=) Change-Id: I64988cd3aeb8f4cbc53b0b866f1ac96f12976cca
* Narrow MediaWiki.Commenting.FunctionComment.WrongStyleReedy2020-05-201-3/+7
| | | | Change-Id: I95d1195f09a806910559a0c5106d472addd3dec4
* Fix parameter documentation for dump methods for handling revisionsDannyS7122020-05-051-4/+8
| | | | | | | | The only caller passes a WikiRevision, which does not extend the Revision class; the parameter is a WikiRevision, not a Revision Bug: T246284 Change-Id: Iaf25b692e6093eab6e12439864bae97c96a3b9db
* Set method visibility on maintenance scriptsUmherirrender2019-11-161-1/+1
| | | | Change-Id: I44c82fbe65e1d002803ce065df6563f06dd39cd4
* maintenance: Explicitly declare all used propertiesDaimona Eaytoy2019-09-091-2/+4
| | | | | | | All uses were checked with codesearch, and the visibility was chosen as strict as possible. Change-Id: I56666299cc04ccc418e05949422876583982eb3c
* build: Updating mediawiki/mediawiki-codesniffer to 22.0.0Umherirrender2018-09-161-2/+0
| | | | | | | | | Added spaces around . Removed empty return statement which are not required Removed return after phpunit markTestIncomplete, which is throwing to exit the test, no need for a return Change-Id: I2c80b965ee52ba09949e70ea9e7adfc58a1d89ce
* Use ::class to resolve class names in maintenance scriptsUmherirrender2018-01-231-2/+2
| | | | | | | This helps to find renamed or misspelled classes earlier. Phan will check the class names Change-Id: I1d4567f47f93eb1436cb98558388e48d35258666
* [WikiImporter::notice] use wfDebug instead of echo in notice()Yifei He2017-12-221-0/+3
| | | | | | | | Make the default notice implementation of notice() function to send the notice to wfDebug() instead of simply echo to prevent XSS Bug: T177997 Change-Id: I9ffb597e0642afc1603cdd15e2d09c6f2584b448
* Maintenance: add fatalError() methodBryan Davis2017-11-211-3/+3
| | | | | | | | 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
* Use IDatabase type hints in /maintenanceAaron Schulz2017-04-071-1/+1
| | | | | | Relatedly, move lockTables()/unlockTables() to IMaintainableDatabase Change-Id: Ib53e9fa948deb2f9a70f0ce16c002613d0060bf9
* Replace DatabaseBase => Database in more placesAaron Schulz2016-09-281-1/+1
| | | | Change-Id: If37a7909056bf2c31a8228cbc84f0fbbf5f1c517
* Convert all array() syntax to []Kunal Mehta2016-02-171-1/+1
| | | | | | | | | | 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
* Fix a bunch of call-time pass-by-reference errorsMax Semenik2016-02-101-1/+1
| | | | Change-Id: I3bd8e7c4d2dca465957a353cb7dc2a906699ff6a
* Use addDescription() instead of accessing mDescription directlyMax Semenik2016-01-301-2/+2
| | | | Change-Id: I0e2aa83024b8abf5298cfea4b21bf45722ad3103
* Import.php: Use Config instead of globalsKunal Mehta2014-10-221-2/+2
| | | | Change-Id: I4d1a8c443cfa360c5d388364c580d48fa7124099
* Update formatting in maintenance/ (2/4)Siebrand Mazeland2014-04-231-0/+1
| | | | Change-Id: I2b791d3bff0de464b6bdaaeae0622c065389c31c
* Pass phpcs-strict on maintenance/ (6/8)Siebrand Mazeland2014-04-231-4/+9
| | | | Change-Id: Icefd7660072aedb963fe3082ec40fb8ffcfd6286
* Fixed some @params documentation (maintenance)umherirrender2014-04-171-2/+2
| | | | | | | | | Swapped some "$var type" to "type $var" or added missing types before the $var. Changed some other types to match the more common spelling. Makes beginning of some text in captial. Also added some missing @param. Change-Id: I727deec35a712de0f0c676cc87dfa661f1ee965b
* Change URLs to mediawiki.org in comments to HTTPSLadsgroup2014-03-201-1/+1
| | | | | | | These are only documentation fixes http://www.mediawiki.org --> https://www.mediawiki.org Change-Id: I62ad42be1a3aac410cc53e98ce79389ceddd8988
* Remove underscore from classes LCStore_*Siebrand Mazeland2013-11-171-1/+1
| | | | | | | | iPart of program to remove underscores from class names. Checked core and 600+ extensions for occurrences. All uses are in core, and are updated in this change. Change-Id: I432dc249d22053728013ae7d0d56c3c398021c5e
* 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
* Fixed spacing around parenthesis in languages/tests/maintenanceumherirrender2013-04-281-3/+3
| | | | Change-Id: Idd4299d17f1fcf98ab1d635484cb4e880f35ee24
* Fixed some spacing in maintenance folderumherirrender2013-04-181-7/+9
| | | | | | | Added spaces before if, foreach Added some braces for one line statements Change-Id: I9657f72996358f8c1c154cea1ea97970d973723c
* Added/Removed spaces around string concatenationumherirrender2013-04-131-2/+2
| | | | | | | | | And added/removed spaces around some other tokens, like +, -, *, /, <, >, =, ! Fixed windows newline style Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8