summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-03-02 00:36:12 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-03-02 00:36:12 +0100
commitcae1efd552ed0618b13120e07c346cbe28cbd00a (patch)
tree173a36c7c889c45d1590f0942e5a776c65e84db0 /app/models
parent2232b03bb48a012d8d3902dd32c7612dc112e0f9 (diff)
Corrections quelques bugs + modif fichier config BDD + ajout fichier build.sh pour générer la lib Minz
Diffstat (limited to 'app/models')
-rw-r--r--app/models/Feed.php27
1 files changed, 17 insertions, 10 deletions
diff --git a/app/models/Feed.php b/app/models/Feed.php
index 2db9af40d..67874925f 100644
--- a/app/models/Feed.php
+++ b/app/models/Feed.php
@@ -84,16 +84,23 @@ class Feed extends Model {
public function load () {
if (!is_null ($this->url)) {
- $feed = new SimplePie ();
- $feed->set_feed_url ($this->url);
- $feed->set_cache_location (CACHE_PATH);
- $feed->init ();
-
- $title = $feed->get_title ();
- $this->_name (!is_null ($title) ? $title : $this->url);
- $this->_website ($feed->get_link ());
- $this->_description ($feed->get_description ());
- $this->loadEntries ($feed);
+ if (CACHE_PATH === false) {
+ throw new FileNotExistException (
+ 'CACHE_PATH',
+ MinzException::ERROR
+ );
+ } else {
+ $feed = new SimplePie ();
+ $feed->set_feed_url ($this->url);
+ $feed->set_cache_location (CACHE_PATH);
+ $feed->init ();
+
+ $title = $feed->get_title ();
+ $this->_name (!is_null ($title) ? $title : $this->url);
+ $this->_website ($feed->get_link ());
+ $this->_description ($feed->get_description ());
+ $this->loadEntries ($feed);
+ }
}
}
private function loadEntries ($feed) {