Fixing issue with notification cron

* Updated getAllActive to search by type
This commit is contained in:
Sebastian Grewe 2013-06-09 16:44:32 +02:00
parent 3bc5c68403
commit 6eeff19ff5
2 changed files with 4 additions and 4 deletions

View File

@ -38,7 +38,7 @@ if (empty($aWorkers)) {
} }
// We notified, lets check which recovered // We notified, lets check which recovered
$aNotifications = $notification->getAllActive(); $aNotifications = $notification->getAllActive('idle_worker');
if (!empty($aNotifications)) { if (!empty($aNotifications)) {
foreach ($aNotifications as $aNotification) { foreach ($aNotifications as $aNotification) {
$aData = json_decode($aNotification['data'], true); $aData = json_decode($aNotification['data'], true);

View File

@ -50,10 +50,10 @@ class Notification extends Mail {
/** /**
* Get all active notifications * Get all active notifications
**/ **/
public function getAllActive() { public function getAllActive($strType) {
$this->debug->append("STA " . __METHOD__, 4); $this->debug->append("STA " . __METHOD__, 4);
$stmt =$this->mysqli->prepare("SELECT id, data FROM $this->table WHERE active = 1 LIMIT 1"); $stmt =$this->mysqli->prepare("SELECT id, data FROM $this->table WHERE active = 1 AND type = ?");
if ($stmt && $stmt->execute() && $result = $stmt->get_result()) if ($stmt && $stmt->bind_param('s', $strType) && $stmt->execute() && $result = $stmt->get_result())
return $result->fetch_all(MYSQLI_ASSOC); return $result->fetch_all(MYSQLI_ASSOC);
// Catchall // Catchall
return false; return false;