diff options
| author | 2014-01-01 15:08:15 +0100 | |
|---|---|---|
| committer | 2014-01-01 15:08:15 +0100 | |
| commit | a08201c41486815de25c71f5497e939631ea68b4 (patch) | |
| tree | 17a79823fa42e46aeaa46e0ff2392e2c1d867f60 | |
| parent | 50c41d9bb2b1766feac984685bb2a954ab4799f3 (diff) | |
SQL : Insère la catégorie par défaut dès la création des tables
| -rw-r--r-- | app/Models/UserDAO.php | 5 | ||||
| -rw-r--r-- | app/sql.php | 2 | ||||
| -rw-r--r-- | p/i/install.php | 5 |
3 files changed, 10 insertions, 2 deletions
diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php index afa049fb9..a25b57f89 100644 --- a/app/Models/UserDAO.php +++ b/app/Models/UserDAO.php @@ -7,7 +7,10 @@ class FreshRSS_UserDAO extends Minz_ModelPdo { $sql = sprintf(SQL_CREATE_TABLES, $db['prefix'] . $username . '_'); $stm = $this->bd->prepare($sql, array(PDO::ATTR_EMULATE_PREPARES => true)); - if ($stm && $stm->execute()) { + $values = array( + 'catName' => Minz_Translate::t('default_category'), + ); + if ($stm && $stm->execute($values)) { return true; } else { $info = $stm->errorInfo(); diff --git a/app/sql.php b/app/sql.php index 8646b4da5..5a28858a7 100644 --- a/app/sql.php +++ b/app/sql.php @@ -52,6 +52,8 @@ CREATE TABLE IF NOT EXISTS `%1$sentry` ( INDEX (`is_read`) -- v0.7 ) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB; + +INSERT INTO `%1$scategory` (name) VALUES(:catName); '); define('SQL_DROP_TABLES', 'DROP TABLES %1$sentry, %1$sfeed, %1$scategory'); diff --git a/p/i/install.php b/p/i/install.php index 0cd952fef..3316d222b 100644 --- a/p/i/install.php +++ b/p/i/install.php @@ -585,7 +585,10 @@ function checkBD () { $sql = sprintf(SQL_CREATE_TABLES, $_SESSION['bd_prefix_user']); $stm = $c->prepare($sql, array(PDO::ATTR_EMULATE_PREPARES => true)); - $ok = $stm->execute(); + $values = array( + 'catName' => _t('default_category'), + ); + $ok = $stm->execute($values); } catch (PDOException $e) { $error = true; } |
