Check MySQL version when installing on console

Related to #364.
This commit is contained in:
Franz Liedke 2015-09-01 08:02:07 +02:00
parent d3e57d77b4
commit 753a846e7a

View File

@ -16,6 +16,7 @@ use Flarum\Core\Users\User;
use Flarum\Core\Groups\Group;
use Flarum\Core\Groups\Permission;
use Illuminate\Contracts\Foundation\Application;
use PDO;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
@ -139,7 +140,13 @@ class InstallCommand extends Command
$this->info('Testing config');
$this->application->instance('flarum.config', $config);
$this->application->make('flarum.db');
/* @var $db \Illuminate\Database\ConnectionInterface */
$db = $this->application->make('flarum.db');
$version = $db->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION);
if (version_compare($version, '5.5.0', '<')) {
throw new Exception('MySQL version too low. You need at least MySQL 5.5.');
}
$this->info('Writing config');