fix: try db fix
Some checks failed
web/docker-ttrss/pipeline/head There was a failure building this commit
Some checks failed
web/docker-ttrss/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user