X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Finstaller%2FPostgresInstaller.php;h=2cf41564f0de45425c3b974ad4b480c768911ba2;hb=fd26d27c094cc962d59a7477afdc1c232f13eb2c;hp=37471890b44406ef70dd577d932f2af0cc94b070;hpb=331bcf6ac9a5df389a0196ee71418d7620d34278;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/installer/PostgresInstaller.php b/includes/installer/PostgresInstaller.php index 37471890b4..2cf41564f0 100644 --- a/includes/installer/PostgresInstaller.php +++ b/includes/installer/PostgresInstaller.php @@ -42,8 +42,8 @@ class PostgresInstaller extends DatabaseInstaller { '_InstallUser' => 'postgres', ); - var $minimumVersion = '8.3'; - var $maxRoleSearchDepth = 5; + public $minimumVersion = '8.3'; + public $maxRoleSearchDepth = 5; protected $pgConns = array(); @@ -56,12 +56,27 @@ class PostgresInstaller extends DatabaseInstaller { } function getConnectForm() { - return $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) . + return $this->getTextBox( + 'wgDBserver', + 'config-db-host', + array(), + $this->parent->getHelpBox( 'config-db-host-help' ) + ) . $this->getTextBox( 'wgDBport', 'config-db-port' ) . Html::openElement( 'fieldset' ) . Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) . - $this->getTextBox( 'wgDBname', 'config-db-name', array(), $this->parent->getHelpBox( 'config-db-name-help' ) ) . - $this->getTextBox( 'wgDBmwschema', 'config-db-schema', array(), $this->parent->getHelpBox( 'config-db-schema-help' ) ) . + $this->getTextBox( + 'wgDBname', + 'config-db-name', + array(), + $this->parent->getHelpBox( 'config-db-name-help' ) + ) . + $this->getTextBox( + 'wgDBmwschema', + 'config-db-schema', + array(), + $this->parent->getHelpBox( 'config-db-schema-help' ) + ) . Html::closeElement( 'fieldset' ) . $this->getInstallUserBox(); } @@ -107,6 +122,7 @@ class PostgresInstaller extends DatabaseInstaller { $this->setVar( 'wgDBuser', $this->getVar( '_InstallUser' ) ); $this->setVar( 'wgDBpassword', $this->getVar( '_InstallPassword' ) ); + return Status::newGood(); } @@ -115,6 +131,7 @@ class PostgresInstaller extends DatabaseInstaller { if ( $status->isOK() ) { $this->db = $status->value; } + return $status; } @@ -142,6 +159,7 @@ class PostgresInstaller extends DatabaseInstaller { } catch ( DBConnectionError $e ) { $status->fatal( 'config-connection-error', $e->getMessage() ); } + return $status; } @@ -165,6 +183,7 @@ class PostgresInstaller extends DatabaseInstaller { $conn->commit( __METHOD__ ); $this->pgConns[$type] = $conn; } + return $status; } @@ -215,6 +234,7 @@ class PostgresInstaller extends DatabaseInstaller { $safeRole = $conn->addIdentifierQuotes( $this->getVar( 'wgDBuser' ) ); $conn->query( "SET ROLE $safeRole" ); } + return $status; default: throw new MWException( "Invalid special connection type: \"$type\"" ); @@ -267,6 +287,7 @@ class PostgresInstaller extends DatabaseInstaller { $row = $conn->selectRow( '"pg_catalog"."pg_roles"', '*', array( 'rolname' => $superuser ), __METHOD__ ); + return $row; } @@ -275,6 +296,7 @@ class PostgresInstaller extends DatabaseInstaller { if ( !$perms ) { return false; } + return $perms->rolsuper === 't' || $perms->rolcreaterole === 't'; } @@ -283,6 +305,7 @@ class PostgresInstaller extends DatabaseInstaller { if ( !$perms ) { return false; } + return $perms->rolsuper === 't'; } @@ -331,6 +354,7 @@ class PostgresInstaller extends DatabaseInstaller { } else { $msg = 'config-install-user-missing'; } + return Status::newFatal( $msg, $this->getVar( 'wgDBuser' ) ); } @@ -410,6 +434,7 @@ class PostgresInstaller extends DatabaseInstaller { } } } + return false; } @@ -454,6 +479,7 @@ class PostgresInstaller extends DatabaseInstaller { $safedb = $conn->addIdentifierQuotes( $dbName ); $conn->query( "CREATE DATABASE $safedb", __METHOD__ ); } + return Status::newGood(); } @@ -480,11 +506,13 @@ class PostgresInstaller extends DatabaseInstaller { // Select the new schema in the current connection $conn->determineCoreSchema( $schema ); + return Status::newGood(); } function commitChanges() { $this->db->commit( __METHOD__ ); + return Status::newGood(); } @@ -529,8 +557,8 @@ class PostgresInstaller extends DatabaseInstaller { function getLocalSettings() { $port = $this->getVar( 'wgDBport' ); $schema = $this->getVar( 'wgDBmwschema' ); - return -"# Postgres specific settings + + return "# Postgres specific settings \$wgDBport = \"{$port}\"; \$wgDBmwschema = \"{$schema}\";"; } @@ -560,6 +588,7 @@ class PostgresInstaller extends DatabaseInstaller { if ( $conn->tableExists( 'archive' ) ) { $status->warning( 'config-install-tables-exist' ); $this->enableLB(); + return $status; } @@ -567,6 +596,7 @@ class PostgresInstaller extends DatabaseInstaller { if ( !$conn->schemaExists( $schema ) ) { $status->fatal( 'config-install-pg-schema-not-exist' ); + return $status; } $error = $conn->sourceFile( $conn->getSchemaPath() ); @@ -581,6 +611,7 @@ class PostgresInstaller extends DatabaseInstaller { if ( $status->isOk() ) { $this->enableLB(); } + return $status; } @@ -623,6 +654,7 @@ class PostgresInstaller extends DatabaseInstaller { } else { return Status::newFatal( 'config-pg-no-plpgsql', $this->getVar( 'wgDBname' ) ); } + return Status::newGood(); } }