X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FMaintenance.php;h=478a0c41ae88d638198441e6ecb18c6eb2898ebc;hb=558b28003fc234f9c7ab3dfd83c8364f4e7260bc;hp=62dc36c18d43bf1c5f67c1e0a914508d9ab3be58;hpb=fd24918228d5f5790be2e0f4db6cf3b55c679ced;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 62dc36c18d..478a0c41ae 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 @@ -36,9 +38,11 @@ define( 'DO_MAINTENANCE', RUN_MAINTENANCE_IF_MAIN ); // original name, harmless $maintClass = false; +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 @@ -105,7 +109,7 @@ abstract class Maintenance { /** * Used by getDB() / setDB() - * @var Database + * @var IMaintainableDatabase */ private $mDb = null; @@ -205,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, @@ -1242,7 +1246,7 @@ abstract class Maintenance { * @param integer $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 ) ) { @@ -1255,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; @@ -1317,7 +1321,7 @@ abstract class Maintenance { /** * Lock the search index - * @param Database &$db + * @param IMaintainableDatabase &$db */ private function lockSearchindex( $db ) { $write = [ 'searchindex' ]; @@ -1335,7 +1339,7 @@ abstract class Maintenance { /** * Unlock the tables - * @param Database &$db + * @param IMaintainableDatabase &$db */ private function unlockSearchindex( $db ) { $db->unlockTables( __CLASS__ . '::' . __METHOD__ ); @@ -1344,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 ); @@ -1355,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 ) { @@ -1391,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 */