diff options
| author | 2017-02-28 21:12:47 +0100 | |
|---|---|---|
| committer | 2017-02-28 21:12:47 +0100 | |
| commit | 17296f99d26ef3eb5a2e73428e3d67e418846ab7 (patch) | |
| tree | c117adeace6196d11c257385bc5f92de230a9b14 /cli | |
| parent | 777fb7125fa8eb2915f4382b2c2faa0caeee3b57 (diff) | |
Fix CLI install bug with SQLite
And improve requirements check
https://github.com/FreshRSS/FreshRSS/issues/1443
Diffstat (limited to 'cli')
| -rwxr-xr-x | cli/do-install.php | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/cli/do-install.php b/cli/do-install.php index c2f5b286d..16d03daaf 100755 --- a/cli/do-install.php +++ b/cli/do-install.php @@ -37,25 +37,6 @@ if (empty($options['default_user'])) { fwrite(STDERR, 'FreshRSS install…' . "\n"); -$requirements = checkRequirements(); -if ($requirements['all'] !== 'ok') { - $message = 'FreshRSS install failed requirements:' . "\n"; - foreach ($requirements as $requirement => $check) { - if ($check !== 'ok' && $requirement !== 'all') { - $message .= '• ' . $requirement . "\n"; - } - } - fail($message); -} - -if (!FreshRSS_user_Controller::checkUsername($options['default_user'])) { - fail('FreshRSS invalid default username (must be ASCII alphanumeric): ' . $options['default_user']); -} - -if (isset($options['auth_type']) && !in_array($options['auth_type'], array('form', 'http_auth', 'none'))) { - fail('FreshRSS invalid authentication method (auth_type must be one of { form, http_auth, none }: ' . $options['auth_type']); -} - $config = array( 'salt' => generateSalt(), 'db' => FreshRSS_Context::$system_conf->db, @@ -80,6 +61,28 @@ foreach ($dBparams as $dBparam) { } } +$requirements = checkRequirements($config['db']['type']); +if ($requirements['all'] !== 'ok') { + $message = 'FreshRSS install failed requirements:' . "\n"; + foreach ($requirements as $requirement => $check) { + if ($check !== 'ok' && !in_array($requirement, array('all', 'pdo', 'message'))) { + $message .= '• ' . $requirement . "\n"; + } + } + if (!empty($requirements['message'])) { + $message .= '• ' . $requirements['message'] . "\n"; + } + fail($message); +} + +if (!FreshRSS_user_Controller::checkUsername($options['default_user'])) { + fail('FreshRSS invalid default username (must be ASCII alphanumeric): ' . $options['default_user']); +} + +if (isset($options['auth_type']) && !in_array($options['auth_type'], array('form', 'http_auth', 'none'))) { + fail('FreshRSS invalid authentication method (auth_type must be one of { form, http_auth, none }: ' . $options['auth_type']); +} + if (file_put_contents(join_path(DATA_PATH, 'config.php'), "<?php\n return " . var_export($config, true) . ";\n") === false) { fail('FreshRSS could not write configuration file!: ' . join_path(DATA_PATH, 'config.php')); } |
