aboutsummaryrefslogtreecommitdiffstats
path: root/maintenance/storage/orphanStats.php
Commit message (Collapse)AuthorAgeFilesLines
* Replace a number of uses of class aliases with the real thingsJames D. Forrester2025-03-261-0/+2
| | | | | | | Found via disabling phan's alias support for a run (and ignoring wgLang's hard-coded state of being a \Language, alas). Change-Id: I4753bcd84d72d6de111fc7ffc5841fa417bf7333
* 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: Introduce getReplicaDB() and getPrimaryDB()Amir Sarabadani2024-01-181-2/+2
| | | | | | | | | | | | And start using them instead of wfGetDB(), LB/LBF connection methods or worse, $this->getDB(). $this->getDB() reuses the database object regardless of whether you're calling a replica or primary, leading to returning a replica on a primary and other way around. Bug: T330641 Change-Id: I9e2cf85ca277022284fc26b9f37db57bd12aaa81
* maintenance: Migrate another batch to SelectQueryBuilderAmir Sarabadani2023-09-211-6/+5
| | | | | | | Around fifty-ish. Found becuase of fixed MigrateSelect. Bug: T344971 Change-Id: If85428d5a033822bfd8ee1f6ab730863bfad55bd
* 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
* maintenance: Switch simple calls of Database::select to SQBAmir Sarabadani2023-07-191-1/+4
| | | | | | | Done semi-automatically via a php parser written on top of ANTLR4. Bug: T311866 Change-Id: I33f5b6703c0aa9c80c907a21c2a770e30642edd3
* Avoid overridden getDB in maintenance script orphanStats.phpUmherirrender2022-03-071-3/+3
| | | | | | | | | The function getDB is called with DB_REPLICA and with a string (cluster), which looks broken. Found by phan strict checks Change-Id: Id3af4fec2661902590ace91c2b1631584bf8f8b6
* Pass function name to database functions (maintenance scripts)Umherirrender2020-06-071-1/+1
| | | | | | Useful for logging Change-Id: I79fe037abcd74f56c935abc118d706bef0198124
* Upgrade phan config to 0.7.1Daimona Eaytoy2019-09-041-1/+1
| | | | | | | | This allows us to remove many suppressions for phan false positives. Bug: T231636 Depends-On: I82a279e1f7b0fdefd3bb712e46c7d0665429d065 Change-Id: I5c251e9584a1ae9fb1577afcafb5001e0dcd41c7
* Convert maintenance scripts to LoadBalancer::getMaintenanceConnectionRef()Aaron Schulz2019-08-021-1/+1
| | | | Change-Id: I8944a052f51a1941ad3b76a40fc9c46d1363c426
* Normalize the code style of some ResultWrapper iteration loopsAaron Schulz2019-07-101-3/+3
| | | | Change-Id: Iced52ae65d31d1ca0cd2c64ebc9ab56b2aef9617
* Merge "Replace wfGetLBFactory"jenkins-bot2018-03-091-1/+4
|\
| * Replace wfGetLBFactoryUmherirrender2018-02-271-1/+4
| | | | | | | | | | | | @deprecated since 1.27 Change-Id: I11a7253cebe525948a55cebee183e6de128fdc39
* | Pass '' instead of false for the $conds parameter in select calls.daniel2018-03-021-1/+1
|/ | | | | | | | | Per documentation on IDatabase, $conds must be a string or an array. Passing false for conds is confusing, since it's unclear whether this should match everything or nothing. Bug: T188314 Change-Id: I8be1ac4cbdaafc41aadc2a658be8a99b754b0268
* 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-1/+1
| | | | | | | | 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
* Rename DB_SLAVE constant to DB_REPLICAAaron Schulz2016-09-051-2/+2
| | | | | | | | | This is more consistent with LoadBalancer, modern, and inclusive of master/master mysql, NDB cluster, and MariaDB galera cluster. The old constant is an alias now. Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
* Convert all array() syntax to []Kunal Mehta2016-02-171-3/+3
| | | | | | | | | | 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-2/+2
| | | | Change-Id: I0e2aa83024b8abf5298cfea4b21bf45722ad3103
* Update wfGetDB calls in Maintenance scripts to use getDB()Reedy2016-01-021-1/+1
| | | | Change-Id: I9ad6745d84506b736dae94747256caac89715899
* Update formatting in maintenance/ (4/4)Siebrand Mazeland2014-04-231-3/+4
| | | | Change-Id: I6b58d014a4bfd6600e4e6f80188fdcfce18482ca
* Pass phpcs-strict on maintenance/storage/Siebrand Mazeland2014-04-221-2/+8
| | | | Change-Id: Ia39b316e01797ddedd71885c2f05fe57ba4b89e9
* 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
* Improve documentation of maintenance scripts.Alexandre Emsenhuber2012-09-211-2/+9
| | | | Change-Id: Id86d06d3c22a69f7e378bf6e75b5c78ef8b47c51
* 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
* Make OrphanStats::getDB()'s signature compatible with parent.Alexandre Emsenhuber2012-08-181-1/+1
| | | | | | | | Was throwing Strict Standards: Declaration of OrphanStats::getDB() should be compatible with that of Maintenance::getDB() in maintenance/storage/orphanStats.php on line 25 Change-Id: I7451ada12a8c45aa37883b4b3803fbf505eec15b
* Cannot make method visibility lower than super's.Siebrand Mazeland2012-08-181-1/+1
| | | | Change-Id: I8ed3f3bad954dd03bd80d23954e31ee5429c04fe
* 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-2/+2
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/77711
* More unused variables, whitespaceSam Reed2010-07-251-1/+0
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/69920
* Stylize maintenance folder..Sam Reed2010-05-221-3/+3
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/66751
* Move dumpRev and orphanStats to subclass Maintenance. Make orphanStats bail ↵Chad Horohoe2009-08-211-9/+34
| | | | | | | out early if blob_orphans doesn't exist. dumpRev could use a nice description. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/55403
* Avoid division by zeroTim Starling2009-01-031-2/+4
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/45355
* Stats on the blob_orphans table, to make sure we're not losing anything by ↵Tim Starling2008-12-191-0/+44
dropping the tracked orphans. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/44799