aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Context.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-10-15 14:58:40 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-10-15 14:58:40 +0200
commit56f66f4b6168276ca449d18a440b6958c6817088 (patch)
tree4e4a948929136532073019a0c03a85eb6605768d /app/Models/Context.php
parent98a038926232511fdabc1cfaf5dfb220508047aa (diff)
Remove superflous category request
A category request was systematically done, although it is not always needed.
Diffstat (limited to 'app/Models/Context.php')
-rw-r--r--app/Models/Context.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/app/Models/Context.php b/app/Models/Context.php
index 889ddab1e..fe4fa6281 100644
--- a/app/Models/Context.php
+++ b/app/Models/Context.php
@@ -48,9 +48,6 @@ class FreshRSS_Context {
// Init configuration.
self::$system_conf = Minz_Configuration::get('system');
self::$user_conf = Minz_Configuration::get('user');
-
- $catDAO = new FreshRSS_CategoryDAO();
- self::$categories = $catDAO->listCategories();
}
/**
@@ -142,6 +139,11 @@ class FreshRSS_Context {
$id = substr($get, 2);
$nb_unread = 0;
+ if (empty(self::$categories)) {
+ $catDAO = new FreshRSS_CategoryDAO();
+ self::$categories = $catDAO->listCategories();
+ }
+
switch($type) {
case 'a':
self::$current_get['all'] = true;
@@ -203,11 +205,16 @@ class FreshRSS_Context {
/**
* Set the value of $next_get attribute.
*/
- public static function _nextGet() {
+ private static function _nextGet() {
$get = self::currentGet();
// By default, $next_get == $get
self::$next_get = $get;
+ if (empty(self::$categories)) {
+ $catDAO = new FreshRSS_CategoryDAO();
+ self::$categories = $catDAO->listCategories();
+ }
+
if (self::$user_conf->onread_jump_next && strlen($get) > 2) {
$another_unread_id = '';
$found_current_get = false;