diff options
| author | 2024-03-14 22:44:51 +0100 | |
|---|---|---|
| committer | 2024-03-14 22:44:51 +0100 | |
| commit | cf29ca19c029f6af8dc413f7001bd104ca17999d (patch) | |
| tree | f31ba3325271dfb9f445b3d68689df3f544deb5d | |
| parent | c0db581f2b8cf7bcf8aa43b5a51599a56544d864 (diff) | |
Fix crash during update of existing install (#6205)
fix https://github.com/FreshRSS/FreshRSS/issues/6204
Mess due to https://github.com/FreshRSS/FreshRSS/pull/5511
| -rw-r--r-- | app/Models/SystemConfiguration.php | 8 | ||||
| -rw-r--r-- | app/Models/UserConfiguration.php | 8 | ||||
| -rw-r--r-- | app/install.php | 4 |
3 files changed, 14 insertions, 6 deletions
diff --git a/app/Models/SystemConfiguration.php b/app/Models/SystemConfiguration.php index 3c9cc116d..522e475ea 100644 --- a/app/Models/SystemConfiguration.php +++ b/app/Models/SystemConfiguration.php @@ -30,9 +30,13 @@ declare(strict_types=1); */ final class FreshRSS_SystemConfiguration extends Minz_Configuration { - /** @throws Minz_ConfigurationNamespaceException */ + /** @throws Minz_FileNotExistException */ public static function init(string $config_filename, ?string $default_filename = null): FreshRSS_SystemConfiguration { parent::register('system', $config_filename, $default_filename); - return parent::get('system'); + try { + return parent::get('system'); + } catch (Minz_ConfigurationNamespaceException $ex) { + FreshRSS::killApp($ex->getMessage()); + } } } diff --git a/app/Models/UserConfiguration.php b/app/Models/UserConfiguration.php index 7ccaa2671..0b02960c4 100644 --- a/app/Models/UserConfiguration.php +++ b/app/Models/UserConfiguration.php @@ -75,10 +75,14 @@ declare(strict_types=1); final class FreshRSS_UserConfiguration extends Minz_Configuration { use FreshRSS_FilterActionsTrait; - /** @throws Minz_ConfigurationNamespaceException */ + /** @throws Minz_FileNotExistException */ public static function init(string $config_filename, ?string $default_filename = null): FreshRSS_UserConfiguration { parent::register('user', $config_filename, $default_filename); - return parent::get('user'); + try { + return parent::get('user'); + } catch (Minz_ConfigurationNamespaceException $ex) { + FreshRSS::killApp($ex->getMessage()); + } } /** diff --git a/app/install.php b/app/install.php index 3ad69c071..5a9d6730c 100644 --- a/app/install.php +++ b/app/install.php @@ -293,7 +293,7 @@ function freshrss_already_installed(): bool { $system_conf = null; try { $system_conf = FreshRSS_SystemConfiguration::init($conf_path); - } catch (Minz_ConfigurationNamespaceException $e) { + } catch (Minz_FileNotExistException $e) { return false; } @@ -301,7 +301,7 @@ function freshrss_already_installed(): bool { $current_user = $system_conf->default_user; try { FreshRSS_UserConfiguration::init(USERS_PATH . '/' . $current_user . '/config.php'); - } catch (Minz_ConfigurationNamespaceException $e) { + } catch (Minz_FileNotExistException $e) { return false; } |
