function removeOldEvents($maxEvent, $currentSyncId) { if ($maxEvent <= 0) { return; } $eventManager = new Event(); $nbLines = $eventManager->rowCount(array('feed' => $this->id, 'unread' => 0, 'favorite' => 0)); $limit = $nbLines - $maxEvent; if ($limit <= 0) { return; } $tableEvent = '`' . MYSQL_PREFIX . "event`"; $query = "\n DELETE FROM {$tableEvent} WHERE feed={$this->id} AND favorite!=1 AND unread!=1 AND syncId!={$currentSyncId} ORDER BY pubdate ASC LIMIT {$limit}\n "; ///@TODO: escape the variables inside mysql $this->customExecute($query); }