[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Move updater/installer specific methods out of DatabaseBase
jenkins-bot has submitted this change and it was merged. Change subject: Move updater/installer specific methods out of DatabaseBase .. Move updater/installer specific methods out of DatabaseBase Change-Id: I995799fc15d2797ce7ab9ce2aca8beeef409447c --- M includes/db/Database.php M includes/installer/DatabaseInstaller.php M includes/installer/DatabaseUpdater.php 3 files changed, 64 insertions(+), 59 deletions(-) Approvals: Brion VIBBER: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/db/Database.php b/includes/db/Database.php index 0c357cc..6c93f6c 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -682,43 +682,6 @@ } /** -* Return a path to the DBMS-specific SQL file if it exists, -* otherwise default SQL file -* -* @param string $filename -* @return string -*/ - private function getSqlFilePath( $filename ) { - global $IP; - $dbmsSpecificFilePath = "$IP/maintenance/" . $this->getType() . "/$filename"; - if ( file_exists( $dbmsSpecificFilePath ) ) { - return $dbmsSpecificFilePath; - } else { - return "$IP/maintenance/$filename"; - } - } - - /** -* Return a path to the DBMS-specific schema file, -* otherwise default to tables.sql -* -* @return string -*/ - public function getSchemaPath() { - return $this->getSqlFilePath( 'tables.sql' ); - } - - /** -* Return a path to the DBMS-specific update key file, -* otherwise default to update-keys.sql -* -* @return string -*/ - public function getUpdateKeysPath() { - return $this->getSqlFilePath( 'update-keys.sql' ); - } - - /** * Get information about an index into an object * @param string $table Table name * @param string $index Index name @@ -3378,25 +3341,6 @@ fclose( $fp ); return $error; - } - - /** -* Get the full path of a patch file. Originally based on archive() -* from updaters.inc. Keep in mind this always returns a patch, as -* it fails back to MySQL if no DB-specific patch can be found -* -* @param string $patch The name of the patch, like patch-something.sql -* @return string Full path to patch file -*/ - public function patchPath( $patch ) { - global $IP; - - $dbType = $this->getType(); - if ( file_exists( "$IP/maintenance/$dbType/archives/$patch" ) ) { - return "$IP/maintenance/$dbType/archives/$patch"; - } else { - return "$IP/maintenance/archives/$patch"; - } } public function setSchemaVars( $vars ) { diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index 701403e..ded2bd8 100644 --- a/includes/installer/DatabaseInstaller.php +++ b/includes/installer/DatabaseInstaller.php @@ -192,7 +192,7 @@ $this->db->begin( __METHOD__ ); $error = $this->db->sourceFile( - call_user_func( [ $this->db, $sourceFileMethod ] ) + call_user_func( [ $this, $sourceFileMethod ], $this->db ) ); if ( $error !== true ) { $this->db->reportQueryError( $error, 0, '', __METHOD__ ); @@ -228,6 +228,47 @@ } /** +* Return a path to the DBMS-specific SQL file if it exists, +* otherwise default SQL file +* +* @param IDatabase $db +* @param string $filename +* @return string +*/ + private function getSqlFilePath( $db, $filename ) { + global $IP; + + $dbmsSpecificFilePath = "$IP/maintenance/" . $db->getType() . "/$filename"; + if ( file_exists( $dbmsSpecificFilePath ) ) { + return $dbmsSpecificFilePath; + } else { + return "$IP/maintenance/$filename"; + } + } + + /** +* Return a path to the DBMS-specific schema file, +* otherwise default to tables.sql +* +* @param IDatabase $db +* @return string +*/ + public function getSchemaPath( $db ) { + return $this->getSqlFilePath( $db, 'tables.sql' ); + } + + /** +* Return a path to the DBMS-specific update key file, +* otherwise default to update-keys.sql +* +* @param IDatabase $db +* @return string +*/ + public function getUpdateKeysPath( $db ) { + return $this->getSqlFilePath( $db, 'update-keys.s
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Move updater/installer specific methods out of DatabaseBase
Aaron Schulz has uploaded a new change for review. https://gerrit.wikimedia.org/r/310765 Change subject: Move updater/installer specific methods out of DatabaseBase .. Move updater/installer specific methods out of DatabaseBase Change-Id: I995799fc15d2797ce7ab9ce2aca8beeef409447c --- M includes/db/Database.php M includes/installer/DatabaseInstaller.php M includes/installer/DatabaseUpdater.php 3 files changed, 65 insertions(+), 59 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/65/310765/1 diff --git a/includes/db/Database.php b/includes/db/Database.php index 0c357cc..6c93f6c 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -682,43 +682,6 @@ } /** -* Return a path to the DBMS-specific SQL file if it exists, -* otherwise default SQL file -* -* @param string $filename -* @return string -*/ - private function getSqlFilePath( $filename ) { - global $IP; - $dbmsSpecificFilePath = "$IP/maintenance/" . $this->getType() . "/$filename"; - if ( file_exists( $dbmsSpecificFilePath ) ) { - return $dbmsSpecificFilePath; - } else { - return "$IP/maintenance/$filename"; - } - } - - /** -* Return a path to the DBMS-specific schema file, -* otherwise default to tables.sql -* -* @return string -*/ - public function getSchemaPath() { - return $this->getSqlFilePath( 'tables.sql' ); - } - - /** -* Return a path to the DBMS-specific update key file, -* otherwise default to update-keys.sql -* -* @return string -*/ - public function getUpdateKeysPath() { - return $this->getSqlFilePath( 'update-keys.sql' ); - } - - /** * Get information about an index into an object * @param string $table Table name * @param string $index Index name @@ -3378,25 +3341,6 @@ fclose( $fp ); return $error; - } - - /** -* Get the full path of a patch file. Originally based on archive() -* from updaters.inc. Keep in mind this always returns a patch, as -* it fails back to MySQL if no DB-specific patch can be found -* -* @param string $patch The name of the patch, like patch-something.sql -* @return string Full path to patch file -*/ - public function patchPath( $patch ) { - global $IP; - - $dbType = $this->getType(); - if ( file_exists( "$IP/maintenance/$dbType/archives/$patch" ) ) { - return "$IP/maintenance/$dbType/archives/$patch"; - } else { - return "$IP/maintenance/archives/$patch"; - } } public function setSchemaVars( $vars ) { diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index 701403e..ded2bd8 100644 --- a/includes/installer/DatabaseInstaller.php +++ b/includes/installer/DatabaseInstaller.php @@ -192,7 +192,7 @@ $this->db->begin( __METHOD__ ); $error = $this->db->sourceFile( - call_user_func( [ $this->db, $sourceFileMethod ] ) + call_user_func( [ $this, $sourceFileMethod ], $this->db ) ); if ( $error !== true ) { $this->db->reportQueryError( $error, 0, '', __METHOD__ ); @@ -228,6 +228,47 @@ } /** +* Return a path to the DBMS-specific SQL file if it exists, +* otherwise default SQL file +* +* @param IDatabase $db +* @param string $filename +* @return string +*/ + private function getSqlFilePath( $db, $filename ) { + global $IP; + + $dbmsSpecificFilePath = "$IP/maintenance/" . $db->getType() . "/$filename"; + if ( file_exists( $dbmsSpecificFilePath ) ) { + return $dbmsSpecificFilePath; + } else { + return "$IP/maintenance/$filename"; + } + } + + /** +* Return a path to the DBMS-specific schema file, +* otherwise default to tables.sql +* +* @param IDatabase $db +* @return string +*/ + public function getSchemaPath( $db ) { + return $this->getSqlFilePath( $db, 'tables.sql' ); + } + + /** +* Return a path to the DBMS-specific update key file, +* otherwise default to update-keys.sql +* +* @param IDatabase $db +* @return string +*/ + public function getUpdateKeysPath( $db ) { + return $t