Fix environment script to not explode when default option isn't in array.
This commit is contained in:
parent
d0ad3ad2f0
commit
5a95a3a044
1 changed files with 18 additions and 9 deletions
|
@ -130,40 +130,49 @@ class UpdateEnvironment extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_null($this->option('driver'))) {
|
if (is_null($this->option('driver'))) {
|
||||||
$this->line('If you chose redis as your cache driver backend, you *must* have a redis server configured already.');
|
$options = [
|
||||||
$variables['CACHE_DRIVER'] = $this->choice('Which cache driver backend would you like to use?', [
|
|
||||||
'memcached' => 'Memcache',
|
'memcached' => 'Memcache',
|
||||||
'redis' => 'Redis (recommended)',
|
'redis' => 'Redis (recommended)',
|
||||||
'apc' => 'APC',
|
'apc' => 'APC',
|
||||||
'array' => 'PHP Array',
|
'array' => 'PHP Array',
|
||||||
], config('cache.default', 'memcached'));
|
];
|
||||||
|
$default = (in_array($options, config('cache.default', 'memcached'))) ? config('cache.default', 'memcached') : 'memcached';
|
||||||
|
|
||||||
|
$this->line('If you chose redis as your cache driver backend, you *must* have a redis server configured already.');
|
||||||
|
$variables['CACHE_DRIVER'] = $this->choice('Which cache driver backend would you like to use?', $options, $default);
|
||||||
} else {
|
} else {
|
||||||
$variables['CACHE_DRIVER'] = $this->option('driver');
|
$variables['CACHE_DRIVER'] = $this->option('driver');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_null($this->option('session-driver'))) {
|
if (is_null($this->option('session-driver'))) {
|
||||||
$this->line('If you chose redis as your cache driver backend, you *must* have a redis server configured already.');
|
$options = [
|
||||||
$variables['SESSION_DRIVER'] = $this->choice('Which session driver backend would you like to use?', [
|
|
||||||
'database' => 'MySQL (recommended)',
|
'database' => 'MySQL (recommended)',
|
||||||
'redis' => 'Redis',
|
'redis' => 'Redis',
|
||||||
'file' => 'File',
|
'file' => 'File',
|
||||||
'cookie' => 'Cookie',
|
'cookie' => 'Cookie',
|
||||||
'apc' => 'APC',
|
'apc' => 'APC',
|
||||||
'array' => 'PHP Array',
|
'array' => 'PHP Array',
|
||||||
], config('session.driver', 'database'));
|
];
|
||||||
|
$default = (in_array($options, config('session.driver', 'database'))) ? config('cache.default', 'database') : 'database';
|
||||||
|
|
||||||
|
$this->line('If you chose redis as your cache driver backend, you *must* have a redis server configured already.');
|
||||||
|
$variables['SESSION_DRIVER'] = $this->choice('Which session driver backend would you like to use?', $options, $default);
|
||||||
} else {
|
} else {
|
||||||
$variables['SESSION_DRIVER'] = $this->option('session-driver');
|
$variables['SESSION_DRIVER'] = $this->option('session-driver');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_null($this->option('queue-driver'))) {
|
if (is_null($this->option('queue-driver'))) {
|
||||||
$this->line('If you chose redis as your cache driver backend, you *must* have a redis server configured already.');
|
$options = [
|
||||||
$variables['QUEUE_DRIVER'] = $this->choice('Which cache driver backend would you like to use?', [
|
|
||||||
'database' => 'Database (recommended)',
|
'database' => 'Database (recommended)',
|
||||||
'redis' => 'Redis',
|
'redis' => 'Redis',
|
||||||
'sqs' => 'Amazon SQS',
|
'sqs' => 'Amazon SQS',
|
||||||
'sync' => 'Sync',
|
'sync' => 'Sync',
|
||||||
'null' => 'None',
|
'null' => 'None',
|
||||||
], config('queue.driver', 'database'));
|
];
|
||||||
|
$default = (in_array($options, config('queue.driver', 'database'))) ? config('queue.driver', 'database') : 'database';
|
||||||
|
|
||||||
|
$this->line('If you chose redis as your cache driver backend, you *must* have a redis server configured already.');
|
||||||
|
$variables['QUEUE_DRIVER'] = $this->choice('Which cache driver backend would you like to use?', $options, $default);
|
||||||
} else {
|
} else {
|
||||||
$variables['QUEUE_DRIVER'] = $this->option('queue-driver');
|
$variables['QUEUE_DRIVER'] = $this->option('queue-driver');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue