diff options
| author | 2019-09-11 18:40:17 +0200 | |
|---|---|---|
| committer | 2019-09-11 18:40:17 +0200 | |
| commit | 7b4cd3abae88bf1b8a04642489b68a741e4d2c6a (patch) | |
| tree | d9c46df4256d27f7925703cbd8476d6d61e8c817 /app/install.php | |
| parent | 84f9311fd53f5fa58ae55986ece9bfa7dac455c1 (diff) | |
add: Allow admins to configure default feeds (#2515)
* Homogenize SQL_INSERT_FEEDS across database types
* Extract default feeds into system configuration
* Adapt default feeds init during installation
Diffstat (limited to 'app/install.php')
| -rw-r--r-- | app/install.php | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/app/install.php b/app/install.php index a4d1d0af9..a92394d2a 100644 --- a/app/install.php +++ b/app/install.php @@ -346,13 +346,13 @@ function checkDbUser(&$dbOptions) { try { $c = new PDO($str, $dbOptions['user'], $dbOptions['password'], $driver_options); if (defined('SQL_CREATE_TABLES')) { - $sql = sprintf(SQL_CREATE_TABLES . SQL_CREATE_TABLE_ENTRYTMP . SQL_CREATE_TABLE_TAGS . SQL_INSERT_FEEDS, + $sql = sprintf(SQL_CREATE_TABLES . SQL_CREATE_TABLE_ENTRYTMP . SQL_CREATE_TABLE_TAGS, $dbOptions['prefix_user'], _t('gen.short.default_category')); $stm = $c->prepare($sql); $ok = $stm && $stm->execute(); } else { - global $SQL_CREATE_TABLES, $SQL_CREATE_TABLE_ENTRYTMP, $SQL_CREATE_TABLE_TAGS, $SQL_INSERT_FEEDS; - $instructions = array_merge($SQL_CREATE_TABLES, $SQL_CREATE_TABLE_ENTRYTMP, $SQL_CREATE_TABLE_TAGS, $SQL_INSERT_FEEDS); + global $SQL_CREATE_TABLES, $SQL_CREATE_TABLE_ENTRYTMP, $SQL_CREATE_TABLE_TAGS; + $instructions = array_merge($SQL_CREATE_TABLES, $SQL_CREATE_TABLE_ENTRYTMP, $SQL_CREATE_TABLE_TAGS); $ok = !empty($instructions); foreach ($instructions as $instruction) { $sql = sprintf($instruction, $dbOptions['prefix_user'], _t('gen.short.default_category')); @@ -360,6 +360,25 @@ function checkDbUser(&$dbOptions) { $ok &= $stm && $stm->execute(); } } + + Minz_Configuration::register( + 'system', + join_path(DATA_PATH, 'config.php'), + join_path(FRESHRSS_PATH, 'config.default.php') + ); + $system_conf = Minz_Configuration::get('system'); + $default_feeds = $system_conf->default_feeds; + foreach ($default_feeds as $feed) { + $sql = sprintf(SQL_INSERT_FEED, $dbOptions['prefix_user']); + $stm = $c->prepare($sql); + $parameters = array( + ':url' => $feed['url'], + ':name' => $feed['name'], + ':website' => $feed['website'], + ':description' => $feed['description'], + ); + $ok &= ($stm && $stm->execute($parameters)); + } } catch (PDOException $e) { $ok = false; $dbOptions['error'] = $e->getMessage(); |
