aboutsummaryrefslogtreecommitdiff
path: root/app/Models/UserDAO.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-10-24 20:29:08 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-10-24 20:29:08 +0200
commit1182129ce5f07892afed190ffbb2ea4c7fc28967 (patch)
tree969df97e334667b9e76d9b0a387486959b1da700 /app/Models/UserDAO.php
parent879af85d3ce1223cc5642e9beb6ec05d1097e43a (diff)
CLI option no-default-feeds
https://github.com/FreshRSS/FreshRSS/issues/1095
Diffstat (limited to 'app/Models/UserDAO.php')
-rw-r--r--app/Models/UserDAO.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php
index 597182693..a95ee6bc4 100644
--- a/app/Models/UserDAO.php
+++ b/app/Models/UserDAO.php
@@ -1,7 +1,7 @@
<?php
class FreshRSS_UserDAO extends Minz_ModelPdo {
- public function createUser($username, $new_user_language) {
+ public function createUser($username, $new_user_language, $insertDefaultFeeds = true) {
$db = FreshRSS_Context::$system_conf->db;
require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php');
@@ -28,6 +28,22 @@ class FreshRSS_UserDAO extends Minz_ModelPdo {
}
}
}
+ if ($insertDefaultFeeds) {
+ if (defined('SQL_INSERT_FEEDS')) { //E.g. MySQL
+ $sql = sprintf(SQL_INSERT_FEEDS, $bd_prefix_user);
+ $stm = $userPDO->bd->prepare($sql);
+ $ok &= $stm && $stm->execute();
+ } else { //E.g. SQLite
+ global $SQL_INSERT_FEEDS;
+ if (is_array($SQL_INSERT_FEEDS)) {
+ foreach ($SQL_INSERT_FEEDS as $instruction) {
+ $sql = sprintf($instruction, $bd_prefix_user);
+ $stm = $userPDO->bd->prepare($sql);
+ $ok &= ($stm && $stm->execute());
+ }
+ }
+ }
+ }
} catch (Exception $e) {
Minz_Log::error('Error while creating user: ' . $e->getMessage());
}