protected function verifyDatabaseDetails(array $db, OutputInterface $output)
    {
        try {
            $pdo = new PDO(
                'mysql:host='.$db['servers']['write'].';dbname='.$db['name'],
                $db['username'],
                $db['password'],
                array(
                    \PDO::ATTR_PERSISTENT => false,
                    \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
                    \PDO::ATTR_TIMEOUT => 2,
                    \PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'',
                )
            );

            unset($pdo);

            return true;

        } catch (Exception $ex) {
            $output->writeln('<error>'.Lang::get('could_not_connect').'</error>');
            $output->writeln('<error>' . $ex->getMessage() . '</error>');
        }

        return false;
    }
protected function verifyDatabaseDetails(array $db, OutputInterface $output)
    {
        try {
            $pdo = new PDO(
                'mysql:host='.$db['servers']['write'].';dbname='.$db['name'],
                $db['username'],
                $db['password'],
                array(
                    \PDO::ATTR_PERSISTENT => false,
                    \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
                    \PDO::ATTR_TIMEOUT => 2,
                    \PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'',
                )
            );

            unset($pdo);

            return true;

        } catch (Exception $ex) {
            $output->writeln('<error>'.Lang::get('could_not_connect').'</error>');
            $output->writeln('<error>' . $ex->getMessage() . '</error>');
        }

        return false;
    }
protected function verifyDatabaseDetails ( array $ db , OutputInterface $ output ) { try { $ pdo = new PDO ( 'mysql:host=' . $ db [ 'servers' ] [ 'write' ] . ';dbname=' . $ db [ 'name' ] , $ db [ 'username' ] , $ db [ 'password' ] , array ( \ PDO :: ATTR_PERSISTENT => false , \ PDO :: ATTR_ERRMODE => \ PDO :: ERRMODE_EXCEPTION , \ PDO :: ATTR_TIMEOUT => 2 , \ PDO :: MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'' , ) ) ; unset ( $ pdo ) ; return true ; } catch ( Exception $ ex ) { $ output -> writeln ( '<error>' . Lang :: get ( 'could_not_connect' ) . '</error>' ) ; $ output -> writeln ( '<error>' . $ ex -> getMessage ( ) . '</error>' ) ; } return false ; }
Try and connect to MySQL using the details provided.
@param  array           $db
@param  OutputInterface $output
@return bool
Try and connect to MySQL using the details provided .