aboutsummaryrefslogtreecommitdiff
path: root/app/Models/UserDAO.php
diff options
context:
space:
mode:
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());
}