X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Finstaller%2FDatabaseUpdater.php;h=6a702e9fbb18d9245ec4ad6d13c187a622e9b639;hb=000a3e1581d71760c089abbf9dbcfd79897159b1;hp=0d0da080fa826ea8a4340177f21ef2658b6a0e1b;hpb=cae4aae3b5892cea4e969e4247eb7579c61f93be;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 0d0da080fa..6a702e9fbb 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -20,6 +20,7 @@ * @file * @ingroup Deployment */ +use MediaWiki\MediaWikiServices; require_once __DIR__ . '/../../maintenance/Maintenance.php'; @@ -56,7 +57,7 @@ abstract class DatabaseUpdater { /** * Handle to the database subclass * - * @var DatabaseBase + * @var Database */ protected $db; @@ -76,6 +77,7 @@ abstract class DatabaseUpdater { PopulateBacklinkNamespace::class, FixDefaultJsonContentPages::class, CleanupEmptyCategories::class, + AddRFCAndPMIDInterwiki::class, ]; /** @@ -100,11 +102,11 @@ abstract class DatabaseUpdater { /** * Constructor * - * @param DatabaseBase $db To perform updates on + * @param Database $db To perform updates on * @param bool $shared Whether to perform updates on shared tables * @param Maintenance $maintenance Maintenance object which created us */ - protected function __construct( DatabaseBase &$db, $shared, Maintenance $maintenance = null ) { + protected function __construct( Database &$db, $shared, Maintenance $maintenance = null ) { $this->db = $db; $this->db->setFlag( DBO_DDLMODE ); // For Oracle's handling of schema files $this->shared = $shared; @@ -191,7 +193,7 @@ abstract class DatabaseUpdater { /** * Get a database connection to run updates * - * @return DatabaseBase + * @return Database */ public function getDB() { return $this->db; @@ -220,12 +222,11 @@ abstract class DatabaseUpdater { * * @since 1.17 * - * @param array $update The update to run. Format is the following: - * first item is the callback function, it also can be a - * simple string with the name of a function in this class, - * following elements are parameters to the function. - * Note that callback functions will receive this object as - * first parameter. + * @param array $update The update to run. Format is [ $callback, $params... ] + * $callback is the method to call; either a DatabaseUpdater method name or a callable. + * Must be serializable (ie. no anonymous functions allowed). The rest of the parameters + * (if any) will be passed to the callback. The first parameter passed to the callback + * is always this object. */ public function addExtensionUpdate( array $update ) { $this->extensionUpdates[] = $update; @@ -456,6 +457,8 @@ abstract class DatabaseUpdater { * @param bool $passSelf Whether to pass this object we calling external functions */ private function runUpdates( array $updates, $passSelf ) { + $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); + $updatesDone = []; $updatesSkipped = []; foreach ( $updates as $params ) { @@ -470,7 +473,7 @@ abstract class DatabaseUpdater { flush(); if ( $ret !== false ) { $updatesDone[] = $origParams; - wfGetLBFactory()->waitForReplication(); + $lbFactory->waitForReplication(); } else { $updatesSkipped[] = [ $func, $params, $origParams ]; } @@ -630,7 +633,11 @@ abstract class DatabaseUpdater { * @param string $filename File name to open */ public function copyFile( $filename ) { - $this->db->sourceFile( $filename, false, false, false, + $this->db->sourceFile( + $filename, + null, + null, + __METHOD__, [ $this, 'appendLine' ] ); }