/** * Check if this attachment is used by any other campaigns and remove if not */ public function removeIfOrphaned() { $result = phpList::DB()->query(sprintf('SELECT messageid FROM %s WHERE attachmentid = %d', Config::getTableName('message_attachment'), $this->id)); if ($result->rowCount() == 0) { //remove from disk @unlink($this->remotefile); } }
/** * Update a bounce rule in the database */ public function update() { $prep_statement = phpList::DB()->prepare(sprintf('UPDATE %s SET regex = :regex, action = "%s", listorder = %d, admin = %d, comment = :comment, status = :status) WHERE id = %d', Config::getTableName('bounceregex'), $this->action, $this->listorder, $this->admin, $this->id)); $prep_statement->execute(array(":regex" => $this->regex, ":status" => $this->status, ":comment" => $this->comment)); }