diff options
| author | 2019-11-04 17:45:15 +0100 | |
|---|---|---|
| committer | 2019-11-04 17:45:15 +0100 | |
| commit | 7819a43197d34ef7a6c5626e9e48d7db075c37c9 (patch) | |
| tree | c53735a350f01292642125fcb8686e2121afc38e /app/Models/UserDAO.php | |
| parent | 67fc72fb618558f352acc7e098163d05294a6a66 (diff) | |
Default or custom OPML (#2627)
* Default or custom OPML
Fix https://github.com/FreshRSS/FreshRSS/issues/2075
Replaces https://github.com/FreshRSS/FreshRSS/pull/2515
https://github.com/FreshRSS/FreshRSS/issues/2514
Uses the local ./data/opml.xml if it exists, otherwise
./opml.default.xml
* Better message
* Move to controller
Diffstat (limited to 'app/Models/UserDAO.php')
| -rw-r--r-- | app/Models/UserDAO.php | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php index 4e824cf01..266c8bc0e 100644 --- a/app/Models/UserDAO.php +++ b/app/Models/UserDAO.php @@ -1,34 +1,21 @@ <?php class FreshRSS_UserDAO extends Minz_ModelPdo { - public function createUser($insertDefaultFeeds = false) { + public function createUser() { require(APP_PATH . '/SQL/install.sql.' . $this->pdo->dbType() . '.php'); try { $sql = $SQL_CREATE_TABLES . $SQL_CREATE_TABLE_ENTRYTMP . $SQL_CREATE_TABLE_TAGS; $ok = $this->pdo->exec($sql) !== false; //Note: Only exec() can take multiple statements safely. - if ($ok && $insertDefaultFeeds) { - $default_feeds = FreshRSS_Context::$system_conf->default_feeds; - $stm = $this->pdo->prepare($SQL_INSERT_FEED); - foreach ($default_feeds as $feed) { - $parameters = [ - ':url' => $feed['url'], - ':name' => $feed['name'], - ':website' => $feed['website'], - ':description' => $feed['description'], - ]; - $ok &= ($stm && $stm->execute($parameters)); - } - } } catch (Exception $e) { - Minz_Log::error('Error while creating database for user: ' . $e->getMessage()); + Minz_Log::error('Error while creating database for user ' . $this->current_user . ': ' . $e->getMessage()); } if ($ok) { return true; } else { $info = empty($stm) ? $this->pdo->errorInfo() : $stm->errorInfo(); - Minz_Log::error(__METHOD__ . ' error: ' . $info[2]); + Minz_Log::error(__METHOD__ . ' error: ' . json_encode($info)); return false; } } |
