aboutsummaryrefslogtreecommitdiffstats
path: root/maintenance/getLagTimes.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
* 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: getLagTimes migrate to StatsFactoryCole White2024-05-151-2/+15
| | | | | | | | | | | Creates two metrics, one emitting milliseconds for backwards-compatibility and another emitting seconds, aligned with Prometheus' upstream recommendations. Update test. Bug: T359382 Change-Id: Id5a22937b60a209b6ba46633879551d24cf93a45
* maintenance: show broken replicas in getLagTimesAntoine Musso2024-02-271-2/+6
| | | | | | | | | | | | | When replication is broken to a host, its lag is returned as `false` which was converted to an integer and thus yielding 0. That hides the fact the replication is broken, specially when all other replicating hosts have sub second lag. Give a meaningful message when replication is broken, same as we did for lag.php in Ibc88d2b86384a68b3cf6fe0d9739144247534821. Bug: T358484 Change-Id: I321516cf054f23940e0f0944832b57a387434721
* 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
* rdbms: fix loadbalancer.lag metrics to consistently use gauge()Aaron Schulz2023-04-031-1/+1
| | | | Change-Id: Ie3726b27f376cff17cffda4844300cbcba0ae94c
* Use namespaced IPUtils classKunal Mehta2020-01-011-1/+2
| | | | Change-Id: I047e099a93203a59093946d336a143d899d0271f
* 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
* Send integer ms to DB lag time guage instead of secondsAaron Schulz2017-04-031-20/+27
| | | | | | | | Previously, this sent the floating point value in seconds, which is not what statsd expects here. Bug: T149210 Change-Id: I8fcd58d7c9e183952df1257b1520d9426a42fd26
* Improve getLagTimes.php output and add statsD flagAaron Schulz2016-11-041-7/+17
| | | | | | | | | | | | * The script now lists all DBs in the LBFactory, not just those of the current wiki cluster. * Add a --report option to send the metrics to statsD so that the MediaWiki view of lag can be measured, rather than just the DB-level view. This avoids some noise with depooled servers. Bug: T149210 Change-Id: I6eae25e29aecf21251ad0eec53c56a86f35007f5
* Use addDescription() instead of accessing mDescription directlyMax Semenik2016-01-301-1/+1
| | | | Change-Id: I0e2aa83024b8abf5298cfea4b21bf45722ad3103
* 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 some spacing in maintenance folderumherirrender2013-04-181-1/+1
| | | | | | | Added spaces before if, foreach Added some braces for one line statements Change-Id: I9657f72996358f8c1c154cea1ea97970d973723c
* 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
* Improve documentation of maintenance scripts.Alexandre Emsenhuber2012-07-241-0/+8
| | | | Change-Id: If0af9922ede902c2c6f18b627d5810f3e888c944
* 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
* Whitespace fixup under tha maint directory.Mark A. Hershberger2010-12-041-1/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/77711
* Stylize maintenance folder..Sam Reed2010-05-221-4/+4
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/66751
* 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
* Don't put \n on the end of every error() call, just do it in error() itself. ↵Chad Horohoe2009-08-021-1/+1
| | | | | | | Still have to use on output(), because people like "Something...done" stuff. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/54240
* Merge maintenance-work branch (now with less errors!):Chad Horohoe2009-08-021-17/+42
| | | | | | | | | | | * 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-27/+16
| | | | | | | | 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-16/+27
| | | | | | | | | | | | * (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
* WARNING: HUGE COMMITAlexandre Emsenhuber2008-05-201-0/+4
| | | | | | | | | | | | | | | | | | 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
* * Introduced LBFactory -- an abstract class for configuring database load ↵Tim Starling2008-03-301-3/+5
| | | | | | | | | | | | | | | | | | | balancers and connecting to foreign DBs. * Wrote two concrete implementations. LBFactory_Simple is for general installations. LBFactory_Multi will replace the runtime configuration used on Wikimedia and allow load-balanced connections to any DB. * Ported Special:Userrights, CentralAuth and OAI audit to the LBFactory system. * Added ForeignDBViaLBRepo, a file repository which uses LBFactory. * Removed $wgLoadBalancer and $wgAlternateMaster * Improved the query group concept to allow failover and lag control * Improved getReaderIndex(), it will now try all servers before waiting, instead of waiting after each. * Removed the $fail parameter to getConnection(), obsolete. * Removed the useless force() function. * Abstracted the replication position interface to allow for future non-MySQL support. * Rearranged Database.php. Added a few debugging features. * Removed ancient benet-specific hack from waitForSlave.php Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/32578
* Remove ?>'s from files. They're pointless, and just asking for people to ↵Aryeh Gregor2007-06-291-1/+0
| | | | | | | 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
* Apply most of the code tweaks from the live site:Brion Vibber2007-01-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | | * use configured cache servers for mctest.php * bucket details in mcc.php * fix input validation and remove debugging code in compressOld * full ID range for moveToExternal * fix resolveStubs.php for compatibility with older serialized data * maximum line length for bar graphs in getLagTimes.php * recognize specieswiki in rebuildInterwiki.inc * --purge option to do additional parser-cache purging for purgeList.php * default changed in MiniDonation extension * profile unicode cleanup in Xml * log slow parses in Article.php * profile wfMsgReal * log mkdir failures * profile AutoLoader * rebuild empty DjVu metadata containing '' * security fix for DjVu metadata retrieval Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/19364
* add cute barchartBrion Vibber2006-12-051-1/+2
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/18171
* * silly script to dump lag time for each databaseBrion Vibber2006-12-051-0/+22
Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/18170