aboutsummaryrefslogtreecommitdiff
path: root/app/models/Category.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-11-18 23:04:43 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-11-18 23:04:43 +0100
commite2d4f1a7214591a47a46272a7a62e320eea029ce (patch)
treebb028ce493c74247e771c623d0a3f13ca4981ec2 /app/models/Category.php
parent082246d13f524aa646d5aedf49ae7e3b6c621d6c (diff)
SQL : identifiant entier automatique pour les catégories et les flux
Implémentation de https://github.com/marienfressinaud/FreshRSS/issues/262 La catégorie par défaut à le numéro 1. Les numéros de catégories et de flux sont automatiques (1, 2, 3...) L'installeur semble marcher.
Diffstat (limited to 'app/models/Category.php')
-rwxr-xr-xapp/models/Category.php17
1 files changed, 6 insertions, 11 deletions
diff --git a/app/models/Category.php b/app/models/Category.php
index 6e61b5a0e..1ae324ace 100755
--- a/app/models/Category.php
+++ b/app/models/Category.php
@@ -1,7 +1,7 @@
<?php
class Category extends Model {
- private $id = false;
+ private $id = 0;
private $name;
private $color;
private $nbFeed = -1;
@@ -23,11 +23,7 @@ class Category extends Model {
}
public function id () {
- if (!$this->id) {
- return small_hash ($this->name . time () . Configuration::selApplication ());
- } else {
- return $this->id;
- }
+ return $this->id;
}
public function name () {
return $this->name;
@@ -90,11 +86,10 @@ class Category extends Model {
class CategoryDAO extends Model_pdo {
public function addCategory ($valuesTmp) {
- $sql = 'INSERT INTO ' . $this->prefix . 'category (id, name, color) VALUES(?, ?, ?)';
+ $sql = 'INSERT INTO ' . $this->prefix . 'category (name, color) VALUES(?, ?)';
$stm = $this->bd->prepare ($sql);
$values = array (
- $valuesTmp['id'],
substr($valuesTmp['name'], 0, 255),
substr($valuesTmp['color'], 0, 7),
);
@@ -196,7 +191,7 @@ class CategoryDAO extends Model_pdo {
}
public function getDefault () {
- $sql = 'SELECT * FROM ' . $this->prefix . 'category WHERE id="000000"';
+ $sql = 'SELECT * FROM ' . $this->prefix . 'category WHERE id=1';
$stm = $this->bd->prepare ($sql);
$stm->execute ();
@@ -210,11 +205,11 @@ class CategoryDAO extends Model_pdo {
}
}
public function checkDefault () {
- $def_cat = $this->searchById ('000000');
+ $def_cat = $this->searchById (1);
if ($def_cat === false) {
$cat = new Category (Translate::t ('default_category'));
- $cat->_id ('000000');
+ $cat->_id (1);
$values = array (
'id' => $cat->id (),