application/Espo/Core/Utils/SystemRequirements.php
protected function checkDatabaseRequirements($type, $data, array $additionalData = null)
    {
        $list = [];

        $databaseHelper = $this->getDatabaseHelper();

        $databaseParams = isset($additionalData['database']) ? $additionalData['database'] : null;
        $pdo = $databaseHelper->createPdoConnection($databaseParams);
        if (!$pdo) {
            $type = 'connection';
        }

        switch ($type) {
            case 'requiredMysqlVersion':
            case 'requiredMariadbVersion':
                $actualVersion = $databaseHelper->getPdoDatabaseVersion($pdo);
                $requiredVersion = $data;

                $acceptable = true;
                if (version_compare($actualVersion, $requiredVersion) == -1) {
                    $acceptable = false;
                }

                $list[$type] = [
                    'type' => 'version',
                    'acceptable' => $acceptable,
                    'required' => $requiredVersion,
                    'actual' => $actualVersion,
                ];
                break;

            case 'recommendedMysqlParams':
            case 'recommendedMariadbParams':
                foreach ($data as $name => $value) {
                    $requiredValue = $value;
                    $actualValue = $databaseHelper->getPdoDatabaseParam($name, $pdo);

                    $acceptable = false;

                    switch (gettype($requiredValue)) {
                        case 'integer':
                            if (Util::convertToByte($actualValue) >= Util::convertToByte($requiredValue)) {
                                $acceptable = true;
                            }
                            break;

                        case 'string':
                            if (strtoupper($actualValue) == strtoupper($requiredValue)) {
                                $acceptable = true;
                            }
                            break;
                    }

                    $list[$name] = array(
                        'type' => 'param',
                        'acceptable' => $acceptable,
                        'required' => $requiredValue,
                        'actual' => $actualValue,
                    );
                }
                break;

            case 'connection':
                    if (!$databaseParams) {
                        $databaseParams = $this->getConfig()->get('database');
                    }

                    $acceptable = true;
                    if (!$pdo instanceof \PDO) {
                        $acceptable = false;
                    }

                    $list['host'] = [
                        'type' => 'connection',
                        'acceptable' => $acceptable,
                        'actual' => $databaseParams['host'],
                    ];
                    $list['dbname'] = [
                        'type' => 'connection',
                        'acceptable' => $acceptable,
                        'actual' => $databaseParams['dbname'],
                    ];
                    $list['user'] = [
                        'type' => 'connection',
                        'acceptable' => $acceptable,
                        'actual' => $databaseParams['user'],
                    ];
                    break;
        }

        return $list;
    }
protected function checkDatabaseRequirements($type, $data, array $additionalData = null)
    {
        $list = [];

        $databaseHelper = $this->getDatabaseHelper();

        $databaseParams = isset($additionalData['database']) ? $additionalData['database'] : null;
        $pdo = $databaseHelper->createPdoConnection($databaseParams);
        if (!$pdo) {
            $type = 'connection';
        }

        switch ($type) {
            case 'requiredMysqlVersion':
            case 'requiredMariadbVersion':
                $actualVersion = $databaseHelper->getPdoDatabaseVersion($pdo);
                $requiredVersion = $data;

                $acceptable = true;
                if (version_compare($actualVersion, $requiredVersion) == -1) {
                    $acceptable = false;
                }

                $list[$type] = [
                    'type' => 'version',
                    'acceptable' => $acceptable,
                    'required' => $requiredVersion,
                    'actual' => $actualVersion,
                ];
                break;

            case 'recommendedMysqlParams':
            case 'recommendedMariadbParams':
                foreach ($data as $name => $value) {
                    $requiredValue = $value;
                    $actualValue = $databaseHelper->getPdoDatabaseParam($name, $pdo);

                    $acceptable = false;

                    switch (gettype($requiredValue)) {
                        case 'integer':
                            if (Util::convertToByte($actualValue) >= Util::convertToByte($requiredValue)) {
                                $acceptable = true;
                            }
                            break;

                        case 'string':
                            if (strtoupper($actualValue) == strtoupper($requiredValue)) {
                                $acceptable = true;
                            }
                            break;
                    }

                    $list[$name] = array(
                        'type' => 'param',
                        'acceptable' => $acceptable,
                        'required' => $requiredValue,
                        'actual' => $actualValue,
                    );
                }
                break;

            case 'connection':
                    if (!$databaseParams) {
                        $databaseParams = $this->getConfig()->get('database');
                    }

                    $acceptable = true;
                    if (!$pdo instanceof \PDO) {
                        $acceptable = false;
                    }

                    $list['host'] = [
                        'type' => 'connection',
                        'acceptable' => $acceptable,
                        'actual' => $databaseParams['host'],
                    ];
                    $list['dbname'] = [
                        'type' => 'connection',
                        'acceptable' => $acceptable,
                        'actual' => $databaseParams['dbname'],
                    ];
                    $list['user'] = [
                        'type' => 'connection',
                        'acceptable' => $acceptable,
                        'actual' => $databaseParams['user'],
                    ];
                    break;
        }

        return $list;
    }
protected function checkDatabaseRequirements ( $ type , $ data , array $ additionalData = null ) { $ list = [ ] ; $ databaseHelper = $ this -> getDatabaseHelper ( ) ; $ databaseParams = isset ( $ additionalData [ 'database' ] ) ? $ additionalData [ 'database' ] : null ; $ pdo = $ databaseHelper -> createPdoConnection ( $ databaseParams ) ; if ( ! $ pdo ) { $ type = 'connection' ; } switch ( $ type ) { case 'requiredMysqlVersion' : case 'requiredMariadbVersion' : $ actualVersion = $ databaseHelper -> getPdoDatabaseVersion ( $ pdo ) ; $ requiredVersion = $ data ; $ acceptable = true ; if ( version_compare ( $ actualVersion , $ requiredVersion ) == - 1 ) { $ acceptable = false ; } $ list [ $ type ] = [ 'type' => 'version' , 'acceptable' => $ acceptable , 'required' => $ requiredVersion , 'actual' => $ actualVersion , ] ; break ; case 'recommendedMysqlParams' : case 'recommendedMariadbParams' : foreach ( $ data as $ name => $ value ) { $ requiredValue = $ value ; $ actualValue = $ databaseHelper -> getPdoDatabaseParam ( $ name , $ pdo ) ; $ acceptable = false ; switch ( gettype ( $ requiredValue ) ) { case 'integer' : if ( Util :: convertToByte ( $ actualValue ) >= Util :: convertToByte ( $ requiredValue ) ) { $ acceptable = true ; } break ; case 'string' : if ( strtoupper ( $ actualValue ) == strtoupper ( $ requiredValue ) ) { $ acceptable = true ; } break ; } $ list [ $ name ] = array ( 'type' => 'param' , 'acceptable' => $ acceptable , 'required' => $ requiredValue , 'actual' => $ actualValue , ) ; } break ; case 'connection' : if ( ! $ databaseParams ) { $ databaseParams = $ this -> getConfig ( ) -> get ( 'database' ) ; } $ acceptable = true ; if ( ! $ pdo instanceof \ PDO ) { $ acceptable = false ; } $ list [ 'host' ] = [ 'type' => 'connection' , 'acceptable' => $ acceptable , 'actual' => $ databaseParams [ 'host' ] , ] ; $ list [ 'dbname' ] = [ 'type' => 'connection' , 'acceptable' => $ acceptable , 'actual' => $ databaseParams [ 'dbname' ] , ] ; $ list [ 'user' ] = [ 'type' => 'connection' , 'acceptable' => $ acceptable , 'actual' => $ databaseParams [ 'user' ] , ] ; break ; } return $ list ; }
Check MySQL requirements
@param  string $type
@param  mixed $data
@return array
Check MySQL requirements