X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Finstaller%2FOracleInstaller.php;h=659a1d7cc6628fc12d6a07fc3ced9315f94fd18a;hp=05f078fab7bddc1cc1aa595151849e4a156ae313;hb=8269ed4dfd5e4395e25945b1fa2ed391684606ed;hpb=fbf0b6be6a01ac935a71298216d0088124ac3cac diff --git a/includes/installer/OracleInstaller.php b/includes/installer/OracleInstaller.php index 05f078fab7..659a1d7cc6 100644 --- a/includes/installer/OracleInstaller.php +++ b/includes/installer/OracleInstaller.php @@ -165,35 +165,30 @@ class OracleInstaller extends DatabaseInstaller { } public function openConnection() { - $status = Status::newGood(); - try { - $db = new DatabaseOracle( - $this->getVar( 'wgDBserver' ), - $this->getVar( '_InstallUser' ), - $this->getVar( '_InstallPassword' ), - $this->getVar( '_InstallDBname' ), - 0, - $this->getVar( 'wgDBprefix' ) - ); - $status->value = $db; - } catch ( DBConnectionError $e ) { - $this->connError = $e->db->lastErrno(); - $status->fatal( 'config-connection-error', $e->getMessage() ); - } - - return $status; + return $this->doOpenConnection(); } public function openSYSDBAConnection() { + return $this->doOpenConnection( DatabaseOracle::DBO_SYSDBA ); + } + + /** + * @param int $flags + * @return Status Status with DatabaseOracle or null as the value + */ + private function doOpenConnection( $flags = 0 ) { $status = Status::newGood(); try { - $db = new DatabaseOracle( - $this->getVar( 'wgDBserver' ), - $this->getVar( '_InstallUser' ), - $this->getVar( '_InstallPassword' ), - $this->getVar( '_InstallDBname' ), - DBO_SYSDBA, - $this->getVar( 'wgDBprefix' ) + $db = Database::factory( + 'oracle', + [ + 'host' => $this->getVar( 'wgDBserver' ), + 'user' => $this->getVar( '_InstallUser' ), + 'password' => $this->getVar( '_InstallPassword' ), + 'dbname' => $this->getVar( '_InstallDBname' ), + 'tablePrefix' => $this->getVar( 'wgDBprefix' ), + 'flags' => $flags + ] ); $status->value = $db; } catch ( DBConnectionError $e ) { @@ -335,11 +330,11 @@ class OracleInstaller extends DatabaseInstaller { * @return bool Whether the connection string is valid. */ public static function checkConnectStringFormat( $connect_string ) { - // @@codingStandardsIgnoreStart Long lines with regular expressions. + // phpcs:disable Generic.Files.LineLength // @todo Very long regular expression. Make more readable? $isValid = preg_match( '/^[[:alpha:]][\w\-]*(?:\.[[:alpha:]][\w\-]*){0,2}$/', $connect_string ); // TNS name $isValid |= preg_match( '/^(?:\/\/)?[\w\-\.]+(?::[\d]+)?(?:\/(?:[\w\-\.]+(?::(pooled|dedicated|shared))?)?(?:\/[\w\-\.]+)?)?$/', $connect_string ); // EZConnect - // @@codingStandardsIgnoreEnd + // phpcs:enable return (bool)$isValid; } }