Merge "Fix changes list misaligned arrow"
[lhc/web/wiklou.git] / includes / installer / PostgresInstaller.php
index bd7cfb3..cb1b47e 100644 (file)
@@ -22,6 +22,8 @@
  */
 
 use Wikimedia\Rdbms\Database;
+use Wikimedia\Rdbms\DBQueryError;
+use Wikimedia\Rdbms\DBConnectionError;
 
 /**
  * Class for setting up the MediaWiki database using Postgres.
@@ -44,7 +46,8 @@ class PostgresInstaller extends DatabaseInstaller {
                '_InstallUser' => 'postgres',
        ];
 
-       public $minimumVersion = '8.3';
+       public static $minimumVersion = '8.3';
+       protected static $notMiniumumVerisonMessage = 'config-postgres-old';
        public $maxRoleSearchDepth = 5;
 
        protected $pgConns = [];
@@ -122,8 +125,9 @@ class PostgresInstaller extends DatabaseInstaller {
 
                // Check version
                $version = $conn->getServerVersion();
-               if ( version_compare( $version, $this->minimumVersion ) < 0 ) {
-                       return Status::newFatal( 'config-postgres-old', $this->minimumVersion, $version );
+               $status = static::meetsMinimumRequirement( $conn->getServerVersion() );
+               if ( !$status->isOK() ) {
+                       return $status;
                }
 
                $this->setVar( 'wgDBuser', $this->getVar( '_InstallUser' ) );
@@ -592,7 +596,7 @@ class PostgresInstaller extends DatabaseInstaller {
                        return $status;
                }
 
-               /** @var $conn DatabasePostgres */
+               /** @var DatabasePostgres $conn */
                $conn = $status->value;
 
                if ( $conn->tableExists( 'archive' ) ) {
@@ -635,7 +639,7 @@ class PostgresInstaller extends DatabaseInstaller {
 
        public function setupPLpgSQL() {
                // Connect as the install user, since it owns the database and so is
-               // the user that needs to run "CREATE LANGAUGE"
+               // the user that needs to run "CREATE LANGUAGE"
                $status = $this->getPgConnection( 'create-schema' );
                if ( !$status->isOK() ) {
                        return $status;