diff --git a/root/srv/ttrss-configure-db.php b/root/srv/ttrss-configure-db.php index 062ec1d..adc155c 100644 --- a/root/srv/ttrss-configure-db.php +++ b/root/srv/ttrss-configure-db.php @@ -9,8 +9,8 @@ $conffile = $confpath . '/config.php'; $ename = 'DB'; $eport = 5432; -$db_type = env('DB_TYPE','pgsql'); -if ($db_type == 'mysql'){ +$db_type = env('DB_TYPE', 'pgsql'); +if ($db_type == 'mysql') { $eport = 3306; } @@ -18,7 +18,7 @@ echo 'Configuring database for: ' . $conffile . PHP_EOL; // check DB_NAME, which will be set automatically for a linked "db" container if (!env($ename . '_PORT', '')) { - error('The env ' . $ename .'_PORT does not exist. Make sure to run with "--link mypostgresinstance:' . $ename . '"'); + error('The env ' . $ename . '_PORT does not exist. Make sure to run with "--link mypostgresinstance:' . $ename . '"'); } $config = array(); @@ -70,17 +70,8 @@ try { echo 'Resetting theme to default ...' . PHP_EOL; $pdo->query("UPDATE ttrss_user_prefs SET value = '' WHERE pref_name = 'USER_CSS_THEME'"); } -} -catch (PDOException $e) { - echo 'Database table not found, applying schema... ' . PHP_EOL; - - $schema = file_get_contents($confpath . '/schema/ttrss_schema_' . $config['DB_TYPE'] . '.sql'); - $schema = preg_replace('/--(.*?);/', '', $schema); - $schema = preg_replace('/[\r\n]/', ' ', $schema); - $schema = trim($schema, ' ;'); - foreach (explode(';', $schema) as $stm) { - $pdo->exec($stm); - } +} catch (PDOException $e) { + echo 'Database table not found, there is no schema anymore lets continue and see what will happen... ' . PHP_EOL; unset($pdo); }