diff options
| author | 2019-11-06 15:16:00 +0100 | |
|---|---|---|
| committer | 2019-11-06 15:16:00 +0100 | |
| commit | 22030155f8fd5cab102ddd897a914cf1a0ffd183 (patch) | |
| tree | 1af332589e778645dc80cb06de8c45261e3eecdd /cli/do-install.php | |
| parent | 12cdd2cdf6d493a8bd110d1ae310288a0a47afa0 (diff) | |
Fix database autocreate at install (#2635)
* Fix database autocreate at install
Several bugs prevented the auto-creation of the database in Web and CLI
installs.
Fix
https://github.com/YunoHost-Apps/freshrss_ynh/issues/84#issuecomment-549818408
* initDb
https://github.com/FreshRSS/FreshRSS/pull/2635#discussion_r343107795
Diffstat (limited to 'cli/do-install.php')
| -rwxr-xr-x | cli/do-install.php | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/cli/do-install.php b/cli/do-install.php index dea5d235e..fa6bac8c8 100755 --- a/cli/do-install.php +++ b/cli/do-install.php @@ -82,7 +82,24 @@ if (file_put_contents(join_path(DATA_PATH, 'config.php'), fail('FreshRSS could not write configuration file!: ' . join_path(DATA_PATH, 'config.php')); } -if (!checkDb()) { +if (function_exists('opcache_reset')) { + opcache_reset(); +} + +Minz_Configuration::register('system', DATA_PATH . '/config.php', FRESHRSS_PATH . '/config.default.php'); +FreshRSS_Context::$system_conf = Minz_Configuration::get('system'); + +Minz_Session::_param('currentUser', $config['default_user']); + +$ok = false; +try { + $ok = initDb(); +} catch (Exception $ex) { + $_SESSION['bd_error'] = $ex->getMessage(); + $ok = false; +} + +if (!$ok) { @unlink(join_path(DATA_PATH, 'config.php')); fail('FreshRSS database error: ' . (empty($_SESSION['bd_error']) ? 'Unknown error' : $_SESSION['bd_error'])); } |
