aboutsummaryrefslogtreecommitdiffstats
path: root/maintenance/fileOpPerfTest.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
* build: Use inline ignore for Generic.CodeAnalysis.AssignmentInConditionUmherirrender2024-09-011-0/+1
| | | | | | | | | | | Avoid that new code contains this pattern. Depends-On: I7a9b5c89129fe4b555d03861f2c3ce3e9e2b2446 Depends-On: Ic2bcc7eeb16d3333dcd019bd209bd7fde843dab9 Depends-On: If20eddd8376ae2e8e29c4e56cd51f7b8eb6642b0 Depends-On: I3414f7e17f4bcb801857bc986bae8eb97aa2bfb8 Depends-On: I38b2729418e8389c681c6cd84858f5e5ed25bd3e Change-Id: I7cfd2e027edd327cf8be6471e348c137fefacda0
* 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: Print errors from StatusValue objects in a consistent wayBartosz Dziewoński2024-06-121-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* fileOpPerfTest: Fix printing statusBartosz Dziewoński2024-06-071-4/+4
| | | | | | Surely it's not supposed to print the same status 5 times. Change-Id: I7745168aeada8ef6d85f05d09648a95fe276dfa8
* Add namespace and deprecation alias to FileBackendEbrahim Byagowi2024-05-191-0/+2
| | | | | | | | | This patch introduces a namespace declaration for the Wikimedia\FileBackend to FileBackend and establishes a class alias marked as deprecated since version 1.43. Bug: T353458 Change-Id: Id897687b1d679fd7d179e3a32e617aae10ebff33
* maintenance: Begin using `Maintenance::getServiceContainer()`Derick Alangi2023-09-041-3/+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
* scripts: Use real bool in options for FileBackend::doOperationsUmherirrender2022-03-081-3/+3
| | | | | | Found by phan strict checks Change-Id: Ic528eb3110f2dc74c4e9ea85ab238b13c14f47ce
* maintenance: Cleanup use of exit in Maintenance::execute implementationUmherirrender2021-08-301-5/+5
| | | | | | | | Returning void from execute() is success. Returning true is success, false is failure with exit(1) Using fatalError also using exit(1) Change-Id: I1d40430ad6226e4aab8f0810b03ee1213282d123
* Safer autoloading with respect to file-scope codeTim Starling2021-01-111-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many files were in the autoloader despite having potentially harmful file-scope code. * Exclude all CommandLineInc maintenance scripts from the autoloader. * Introduce "NO_AUTOLOAD" tag which excludes the file containing it from the autoloader. Use it on CommandLineInc.php and a few suspicious-looking files without classes in case they are refactored to add classes in the future. * Add a test which parses all non-PSR4 class files and confirms that they do not contain dangerous file-scope code. It's slow (15s) but its results were enlightening. * Several maintenance scripts define constants in the file scope, intending to modify the behaviour of MediaWiki. Either move the define() to a later setup function, or protect with NO_AUTOLOAD. * Use require_once consistently with Maintenance.php and doMaintenance.php, per the original convention which is supposed to allow one maintenance script to use the class of another maintenance script. Using require breaks autoloading of these maintenance class files. * When Maintenance.php is included, check if MediaWiki has already started, and if so, return early. Revert the fix for T250003 which is incompatible with this safety measure. Hopefully it was superseded by splitting out the class file. * In runScript.php add a redundant PHP_SAPI check since it does some things in file-scope code before any other check will be run. * Change the if(false) class_alias(...) to something more hackish and more compatible with the new test. * Some site-related scripts found Maintenance.php in a non-standard way. Use the standard way. * fileOpPerfTest.php called error_reporting(). Probably debugging code left in; removed. * Moved mediawiki.compress.7z registration from the class file to the caller. Change-Id: I1b1be90343a5ab678df6f1b1bdd03319dcf6537f
* maintenance: Remove unneeded truthy check on dir handlingUmherirrender2020-06-251-1/+1
| | | | | | | $dir is always set and not getting null here as it is needed for closedir Change-Id: I13d6cf5ede738bdf18f9b32e63552ab2c0917d59
* Fix various MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineCommentReedy2020-05-211-1/+1
| | | | Change-Id: I50c7c93f1534e966224f98a835ca01f93eb9416d
* Convert FileBackendGroup to serviceAryeh Gregor2019-10-251-2/+5
| | | | | Bug: T234228 Change-Id: I25575f565eba122cdf971a5945572811d17fa3e1
* Have class match filename in some maintenance scriptsKunal Mehta2018-05-231-2/+2
| | | | | | | Each of these scripts had a class name that was not referenced outside of the script file itself, and are safe to rename as a result. Change-Id: Id605aca11db51ee433baeaa998a0e33184c930ca
* 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
* Remove Profiler specific code from fileOpPerfTestErik Bernhardson2016-07-011-5/+0
| | | | | | | | | | This code was referencing classes that no longer exist, so it was removed. Profiling can still be accomplished the same way normal maint scripts are profiled, by populating StartProfiler.php and passing '--profiler ProfilerOutputText', or something similar, on the maint script command line. Change-Id: Ie037f6b224ec361c86b86369e2a4fff641908053
* Convert all array() syntax to []Kunal Mehta2016-02-171-16/+16
| | | | | | | | | | 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
* Added a --profiler option to all maintenance scripts.Aaron Schulz2013-05-231-6/+4
| | | | | | | | | | | * This dumps profiling information in list or trace format as specified. * Also optimized wfProfile* function like the ProfileSection class, which also plays better with Profiler::setInstance(). * Fixed fatals due to wfDebug() calls in Profiler::instance() due to that function not yet being loaded. The calls were simply removed. * Cleaned up file performance test script a bit. Change-Id: I6b8cd8b30fefc1904eeeeacada7a30a46f62fe2a
* 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-6/+6
| | | | Change-Id: Idd4299d17f1fcf98ab1d635484cb4e880f35ee24
* Remove dead code.Platonides2013-02-261-1/+0
| | | | | | | $initialTime was never used. It was probably a clever trick for an old time where ProfilerSimple used globals. Change-Id: I34fd952127914d50ce4d12b6f9275926496aff9d
* Log profiling info from maintenance scripts.daniel2013-02-011-1/+2
| | | | | | Previously, maintenance scripts did not log profiling info. Change-Id: Ib63dd54b815cca774cd764f28505f9dbdfd02cfc
* Added "parallelize" option to file performance test script.Aaron Schulz2012-09-221-6/+12
| | | | Change-Id: I6f32b5964c44339d0fe192f9c25edee484de9dfa
* 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
* Added --quick option to file test script to use doQuickOperations.Aaron Schulz2012-08-181-10/+16
| | | | Change-Id: Iae754bac5190db8fe447663cb8cf0e3478511abf
* Improve documentation of maintenance scripts.Alexandre Emsenhuber2012-07-101-1/+6
| | | | Change-Id: I0e2869970c46f4fd14b792f2978cc1ba9d8550be
* [FileBackend] Added support for concurrent file write operations.Aaron2012-05-091-0/+135
* FS backends work via popen() and basic shell commands. * Swift backends use the custom SwiftCloudFiles async features. * Refactored storagePathsRead()/storagePathsChanged() to normalize the paths for correct dependency detection in FileOpBatch. * Cleaned up SwiftFileBackend exception handling to make debugging easier. * Added a quick and dirty performance testing script. * Updated unit tests to include a run with parallelize=implicit. * Improved file test failure output a bit. Change-Id: I6a5ed743c30c598e0dd7301dbdb3631c460332fd