Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorMatthieu Aubry <matt@piwik.org>2015-03-02 07:09:43 +0300
committerMatthieu Aubry <matt@piwik.org>2015-03-02 07:09:43 +0300
commit52a065279020cbddaa3aa1a28e41b28d08726f85 (patch)
treee2ac5a8e7059afcd16e8c7deecac2cafb4e71264 /core
parent9fcf00fa3c37cebd1758500b4ce0852a1ba62616 (diff)
parent3699f22e0410b39ff4bcb2cafdf2f38e0669b146 (diff)
Merge pull request #7283 from piwik/7274
If session is writable do not remove or add a notification
Diffstat (limited to 'core')
-rw-r--r--core/Notification/Manager.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/core/Notification/Manager.php b/core/Notification/Manager.php
index 921dc3fb82..402f1aeaf0 100644
--- a/core/Notification/Manager.php
+++ b/core/Notification/Manager.php
@@ -9,6 +9,7 @@
namespace Piwik\Notification;
use Piwik\Notification;
+use Piwik\Session;
use Piwik\Session\SessionNamespace;
/**
@@ -103,12 +104,20 @@ class Manager
private static function addNotification($id, Notification $notification)
{
+ if (!self::isEnabled()) {
+ return;
+ }
+
$session = static::getSession();
$session->notifications[$id] = $notification;
}
private static function getAllNotifications()
{
+ if (!self::isEnabled()) {
+ return array();
+ }
+
$session = static::getSession();
return $session->notifications;
@@ -116,12 +125,21 @@ class Manager
private static function removeNotification($id)
{
+ if (!self::isEnabled()) {
+ return;
+ }
+
$session = static::getSession();
if (array_key_exists($id, $session->notifications)) {
unset($session->notifications[$id]);
}
}
+ private static function isEnabled()
+ {
+ return Session::isWritable() && Session::isReadable();
+ }
+
/**
* @return SessionNamespace
*/
@@ -131,7 +149,7 @@ class Manager
static::$session = new SessionNamespace('notification');
}
- if (empty(static::$session->notifications)) {
+ if (empty(static::$session->notifications) && self::isEnabled()) {
static::$session->notifications = array();
}