src/Dev/Install/InstallRequirements.php
public function checkDatabase($databaseConfig)
    {
        // Check if support is available
        if (!$this->requireDatabaseFunctions(
            $databaseConfig,
            array(
                "Database Configuration",
                "Database support",
                "Database support in PHP",
                $this->getDatabaseTypeNice($databaseConfig['type'])
            )
        )
        ) {
            return false;
        }

        $path = empty($databaseConfig['path']) ? null : $databaseConfig['path'];
        $server = empty($databaseConfig['server']) ? null : $databaseConfig['server'];

        // Check if the server is available
        $usePath = $path && empty($server);
        if (!$this->requireDatabaseServer(
            $databaseConfig,
            array(
                "Database Configuration",
                "Database server",
                $usePath
                    ? "I couldn't write to path '{$path}'"
                    : "I couldn't find a database server on '{$server}'",
                $usePath
                    ? $path
                    : $server
            )
        )
        ) {
            return false;
        }

        // Check if the connection credentials allow access to the server / database
        if (!$this->requireDatabaseConnection(
            $databaseConfig,
            array(
                "Database Configuration",
                "Database access credentials",
                "That username/password doesn't work"
            )
        )
        ) {
            return false;
        }

        // Check the necessary server version is available
        if (!$this->requireDatabaseVersion(
            $databaseConfig,
            array(
                "Database Configuration",
                "Database server version requirement",
                '',
                'Version ' . $this->getDatabaseConfigurationHelper($databaseConfig['type'])->getDatabaseVersion($databaseConfig)
            )
        )
        ) {
            return false;
        }

        // Check that database creation permissions are available
        if (!$this->requireDatabaseOrCreatePermissions(
            $databaseConfig,
            array(
                "Database Configuration",
                "Can I access/create the database",
                "I can't create new databases and the database '$databaseConfig[database]' doesn't exist"
            )
        )
        ) {
            return false;
        }

        // Check alter permission (necessary to create tables etc)
        if (!$this->requireDatabaseAlterPermissions(
            $databaseConfig,
            array(
                "Database Configuration",
                "Can I ALTER tables",
                "I don't have permission to ALTER tables"
            )
        )
        ) {
            return false;
        }

        // Success!
        return true;
    }
public function checkDatabase($databaseConfig)
    {
        // Check if support is available
        if (!$this->requireDatabaseFunctions(
            $databaseConfig,
            array(
                "Database Configuration",
                "Database support",
                "Database support in PHP",
                $this->getDatabaseTypeNice($databaseConfig['type'])
            )
        )
        ) {
            return false;
        }

        $path = empty($databaseConfig['path']) ? null : $databaseConfig['path'];
        $server = empty($databaseConfig['server']) ? null : $databaseConfig['server'];

        // Check if the server is available
        $usePath = $path && empty($server);
        if (!$this->requireDatabaseServer(
            $databaseConfig,
            array(
                "Database Configuration",
                "Database server",
                $usePath
                    ? "I couldn't write to path '{$path}'"
                    : "I couldn't find a database server on '{$server}'",
                $usePath
                    ? $path
                    : $server
            )
        )
        ) {
            return false;
        }

        // Check if the connection credentials allow access to the server / database
        if (!$this->requireDatabaseConnection(
            $databaseConfig,
            array(
                "Database Configuration",
                "Database access credentials",
                "That username/password doesn't work"
            )
        )
        ) {
            return false;
        }

        // Check the necessary server version is available
        if (!$this->requireDatabaseVersion(
            $databaseConfig,
            array(
                "Database Configuration",
                "Database server version requirement",
                '',
                'Version ' . $this->getDatabaseConfigurationHelper($databaseConfig['type'])->getDatabaseVersion($databaseConfig)
            )
        )
        ) {
            return false;
        }

        // Check that database creation permissions are available
        if (!$this->requireDatabaseOrCreatePermissions(
            $databaseConfig,
            array(
                "Database Configuration",
                "Can I access/create the database",
                "I can't create new databases and the database '$databaseConfig[database]' doesn't exist"
            )
        )
        ) {
            return false;
        }

        // Check alter permission (necessary to create tables etc)
        if (!$this->requireDatabaseAlterPermissions(
            $databaseConfig,
            array(
                "Database Configuration",
                "Can I ALTER tables",
                "I don't have permission to ALTER tables"
            )
        )
        ) {
            return false;
        }

        // Success!
        return true;
    }
public function checkDatabase ( $ databaseConfig ) { // Check if support is available if ( ! $ this -> requireDatabaseFunctions ( $ databaseConfig , array ( "Database Configuration" , "Database support" , "Database support in PHP" , $ this -> getDatabaseTypeNice ( $ databaseConfig [ 'type' ] ) ) ) ) { return false ; } $ path = empty ( $ databaseConfig [ 'path' ] ) ? null : $ databaseConfig [ 'path' ] ; $ server = empty ( $ databaseConfig [ 'server' ] ) ? null : $ databaseConfig [ 'server' ] ; // Check if the server is available $ usePath = $ path && empty ( $ server ) ; if ( ! $ this -> requireDatabaseServer ( $ databaseConfig , array ( "Database Configuration" , "Database server" , $ usePath ? "I couldn't write to path '{$path}'" : "I couldn't find a database server on '{$server}'" , $ usePath ? $ path : $ server ) ) ) { return false ; } // Check if the connection credentials allow access to the server / database if ( ! $ this -> requireDatabaseConnection ( $ databaseConfig , array ( "Database Configuration" , "Database access credentials" , "That username/password doesn't work" ) ) ) { return false ; } // Check the necessary server version is available if ( ! $ this -> requireDatabaseVersion ( $ databaseConfig , array ( "Database Configuration" , "Database server version requirement" , '' , 'Version ' . $ this -> getDatabaseConfigurationHelper ( $ databaseConfig [ 'type' ] ) -> getDatabaseVersion ( $ databaseConfig ) ) ) ) { return false ; } // Check that database creation permissions are available if ( ! $ this -> requireDatabaseOrCreatePermissions ( $ databaseConfig , array ( "Database Configuration" , "Can I access/create the database" , "I can't create new databases and the database '$databaseConfig[database]' doesn't exist" ) ) ) { return false ; } // Check alter permission (necessary to create tables etc) if ( ! $ this -> requireDatabaseAlterPermissions ( $ databaseConfig , array ( "Database Configuration" , "Can I ALTER tables" , "I don't have permission to ALTER tables" ) ) ) { return false ; } // Success! return true ; }
Check the database configuration. These are done one after another
starting with checking the database function exists in PHP, and
continuing onto more difficult checks like database permissions.

@param array $databaseConfig The list of database parameters
@return boolean Validity of database configuration details
Check the database configuration . These are done one after another starting with checking the database function exists in PHP and continuing onto more difficult checks like database permissions .