From d8a3470eb06535b91f141e27834e8b98ba2dd806 Mon Sep 17 00:00:00 2001 From: Pantelis Roditis Date: Mon, 21 Dec 2015 10:41:40 +0200 Subject: [PATCH] Fix bug that introduced by the change in model()->deleteAll. The old model didnt respect the join conditions so we had to re-write the delete operation by hand. --- htdocs/protected/modules/syslog/models/Syslog.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/protected/modules/syslog/models/Syslog.php b/htdocs/protected/modules/syslog/models/Syslog.php index 6ec23f1..ca0f497 100644 --- a/htdocs/protected/modules/syslog/models/Syslog.php +++ b/htdocs/protected/modules/syslog/models/Syslog.php @@ -187,7 +187,10 @@ public function search() if($this->acknowledge!==false) { - $cmd = Yii::app()->db->createCommand("DELETE syslog.* FROM syslog LEFT JOIN host ON host.id=syslog.host WHERE ".$criteria->condition); + if($criteria->condition!="") + $cmd = Yii::app()->db->createCommand("DELETE syslog.* FROM syslog LEFT JOIN host ON host.id=syslog.host WHERE ".$criteria->condition); + else + $cmd = Yii::app()->db->createCommand("DELETE syslog.* FROM syslog"); foreach($criteria->params as $key=>$val) $cmd->bindParam($key,$val); $cmd->execute(); // Syslog::model()->deleteAll($criteria->condition,$criteria->params);