X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FMaintenance.php;h=89e8089fbfb3abd23d4e26c1db2831d51eb1d937;hb=e7720b8f8e09287384ddee271641d1b1721318bb;hp=a8080c50be843ada985af088c1ef9f8f39d69c68;hpb=3a621c1a40b2ac6356aee994f5a5305d03e1f8d3;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index a8080c50be..89e8089fbf 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -25,6 +25,8 @@ require_once __DIR__ . '/../includes/PHPVersionCheck.php'; wfEntryPointCheck( 'cli' ); +use Wikimedia\Rdbms\DBReplicationWaitError; + /** * @defgroup MaintenanceArchive Maintenance archives * @ingroup Maintenance @@ -40,6 +42,7 @@ use Wikimedia\Rdbms\IDatabase; use MediaWiki\Logger\LoggerFactory; use MediaWiki\MediaWikiServices; use Wikimedia\Rdbms\LBFactory; +use Wikimedia\Rdbms\IMaintainableDatabase; /** * Abstract maintenance class for quickly writing and churning out @@ -106,7 +109,7 @@ abstract class Maintenance { /** * Used by getDB() / setDB() - * @var Database + * @var IMaintainableDatabase */ private $mDb = null; @@ -206,7 +209,7 @@ abstract class Maintenance { * @param string $description The description of the param to show on --help * @param bool $required Is the param required? * @param bool $withArg Is an argument required with this option? - * @param string $shortName Character to use as short name + * @param string|bool $shortName Character to use as short name * @param bool $multiOccurrence Can this option be passed multiple times? */ protected function addOption( $name, $description, $required = false, @@ -341,7 +344,7 @@ abstract class Maintenance { * @return mixed */ protected function getStdin( $len = null ) { - if ( $len == Maintenance::STDIN_ALL ) { + if ( $len == self::STDIN_ALL ) { return file_get_contents( 'php://stdin' ); } $f = fopen( 'php://stdin', 'rt' ); @@ -454,7 +457,7 @@ abstract class Maintenance { * @return int */ public function getDbType() { - return Maintenance::DB_STD; + return self::DB_STD; } /** @@ -1240,10 +1243,10 @@ abstract class Maintenance { * If not set, wfGetDB() will be used. * This function has the same parameters as wfGetDB() * - * @param integer $db DB index (DB_REPLICA/DB_MASTER) + * @param int $db DB index (DB_REPLICA/DB_MASTER) * @param array $groups; default: empty array * @param string|bool $wiki; default: current wiki - * @return Database + * @return IMaintainableDatabase */ protected function getDB( $db, $groups = [], $wiki = false ) { if ( is_null( $this->mDb ) ) { @@ -1256,7 +1259,7 @@ abstract class Maintenance { /** * Sets database object to be returned by getDB(). * - * @param IDatabase $db Database object to be used + * @param IDatabase $db */ public function setDB( IDatabase $db ) { $this->mDb = $db; @@ -1318,7 +1321,7 @@ abstract class Maintenance { /** * Lock the search index - * @param Database &$db + * @param IMaintainableDatabase &$db */ private function lockSearchindex( $db ) { $write = [ 'searchindex' ]; @@ -1336,7 +1339,7 @@ abstract class Maintenance { /** * Unlock the tables - * @param Database &$db + * @param IMaintainableDatabase &$db */ private function unlockSearchindex( $db ) { $db->unlockTables( __CLASS__ . '::' . __METHOD__ ); @@ -1345,7 +1348,7 @@ abstract class Maintenance { /** * Unlock and lock again * Since the lock is low-priority, queued reads will be able to complete - * @param Database &$db + * @param IMaintainableDatabase &$db */ private function relockSearchindex( $db ) { $this->unlockSearchindex( $db ); @@ -1356,7 +1359,7 @@ abstract class Maintenance { * Perform a search index update with locking * @param int $maxLockTime The maximum time to keep the search index locked. * @param string $callback The function that will update the function. - * @param Database $dbw + * @param IMaintainableDatabase $dbw * @param array $results */ public function updateSearchIndex( $maxLockTime, $callback, $dbw, $results ) { @@ -1392,7 +1395,7 @@ abstract class Maintenance { /** * Update the searchindex table for a given pageid - * @param Database $dbw A database write handle + * @param IDatabase $dbw A database write handle * @param int $pageId The page ID to update. * @return null|string */