summaryrefslogtreecommitdiff
path: root/app/Models
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-02-11 15:30:52 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-02-11 15:30:52 +0100
commit18403d9720c7b3d26881bb6291bf6eb2a9df05d9 (patch)
tree69ad948821cde78d1edfd7f654940370bd63f529 /app/Models
parentcd8e245523b54b19004ff3202f0fe412e70f130b (diff)
SQL : Supprime c.color
Implémente décision https://github.com/marienfressinaud/FreshRSS/issues/295 Install.php pourrait peut-être être mis à jour pour supprimer automatiquement la colonne, mais ce n'est pas fait dans ce patch.
Diffstat (limited to 'app/Models')
-rw-r--r--app/Models/Category.php14
-rw-r--r--app/Models/CategoryDAO.php13
2 files changed, 4 insertions, 23 deletions
diff --git a/app/Models/Category.php b/app/Models/Category.php
index 8e1e44ef8..328bae799 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -3,14 +3,12 @@
class FreshRSS_Category extends Minz_Model {
private $id = 0;
private $name;
- private $color;
private $nbFeed = -1;
private $nbNotRead = -1;
private $feeds = null;
- public function __construct ($name = '', $color = '#0062BE', $feeds = null) {
+ public function __construct ($name = '', $feeds = null) {
$this->_name ($name);
- $this->_color ($color);
if (isset ($feeds)) {
$this->_feeds ($feeds);
$this->nbFeed = 0;
@@ -28,9 +26,6 @@ class FreshRSS_Category extends Minz_Model {
public function name () {
return $this->name;
}
- public function color () {
- return $this->color;
- }
public function nbFeed () {
if ($this->nbFeed < 0) {
$catDAO = new FreshRSS_CategoryDAO ();
@@ -68,13 +63,6 @@ class FreshRSS_Category extends Minz_Model {
public function _name ($value) {
$this->name = $value;
}
- public function _color ($value) {
- if (preg_match ('/^#([0-9a-f]{3}|[0-9a-f]{6})$/i', $value)) {
- $this->color = $value;
- } else {
- $this->color = '#0062BE';
- }
- }
public function _feeds ($values) {
if (!is_array ($values)) {
$values = array ($values);
diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php
index 1cc616ac0..5355228a5 100644
--- a/app/Models/CategoryDAO.php
+++ b/app/Models/CategoryDAO.php
@@ -2,12 +2,11 @@
class FreshRSS_CategoryDAO extends Minz_ModelPdo {
public function addCategory ($valuesTmp) {
- $sql = 'INSERT INTO `' . $this->prefix . 'category` (name, color) VALUES(?, ?)';
+ $sql = 'INSERT INTO `' . $this->prefix . 'category` (name) VALUES(?)';
$stm = $this->bd->prepare ($sql);
$values = array (
substr($valuesTmp['name'], 0, 255),
- substr($valuesTmp['color'], 0, 7),
);
if ($stm && $stm->execute ($values)) {
@@ -20,12 +19,11 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {
}
public function updateCategory ($id, $valuesTmp) {
- $sql = 'UPDATE `' . $this->prefix . 'category` SET name=?, color=? WHERE id=?';
+ $sql = 'UPDATE `' . $this->prefix . 'category` SET name=? WHERE id=?';
$stm = $this->bd->prepare ($sql);
$values = array (
$valuesTmp['name'],
- $valuesTmp['color'],
$id
);
@@ -89,7 +87,6 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {
public function listCategories ($prePopulateFeeds = true, $details = false) {
if ($prePopulateFeeds) {
$sql = 'SELECT c.id AS c_id, c.name AS c_name, '
- . ($details ? 'c.color AS c_color, ' : '')
. ($details ? 'f.* ' : 'f.id, f.name, f.url, f.website, f.priority, f.error, f.cache_nbEntries, f.cache_nbUnreads ')
. 'FROM `' . $this->prefix . 'category` c '
. 'LEFT OUTER JOIN `' . $this->prefix . 'feed` f ON f.category = c.id '
@@ -130,7 +127,6 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {
$values = array (
'id' => $cat->id (),
'name' => $cat->name (),
- 'color' => $cat->color ()
);
$this->addCategory ($values);
@@ -203,7 +199,6 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {
// End of the current category, we add it to the $list
$cat = new FreshRSS_Category (
$previousLine['c_name'],
- isset($previousLine['c_color']) ? $previousLine['c_color'] : '',
FreshRSS_FeedDAO::daoToFeed ($feedsDao, $previousLine['c_id'])
);
$cat->_id ($previousLine['c_id']);
@@ -220,7 +215,6 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {
if ($previousLine != null) {
$cat = new FreshRSS_Category (
$previousLine['c_name'],
- isset($previousLine['c_color']) ? $previousLine['c_color'] : '',
FreshRSS_FeedDAO::daoToFeed ($feedsDao, $previousLine['c_id'])
);
$cat->_id ($previousLine['c_id']);
@@ -239,8 +233,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {
foreach ($listDAO as $key => $dao) {
$cat = new FreshRSS_Category (
- $dao['name'],
- $dao['color']
+ $dao['name']
);
$cat->_id ($dao['id']);
$list[$key] = $cat;