public function getEntryMTime($template) { $this->debug->append("STA " . __METHOD__, 4); $entry = $this->getEntry($template, "modified_at, active"); if ($entry && $entry['active']) { return strtotime($entry['modified_at']); } return false; } /** * Update template in database * * @param $template - name (filepath) of the template * @param $content - content of the template * @param $active - active flag for the template **/ public function updateEntry($template, $content, $active = 0) { $this->debug->append("STA " . __METHOD__, 4); $stmt = $this->mysqli->prepare("INSERT INTO {$this->table} (`template`, `content`, `active`, `modified_at`) VALUES(?, ?, ?, CURRENT_TIMESTAMP) ON DUPLICATE KEY UPDATE content = VALUES(content), active = VALUES(active), modified_at = CURRENT_TIMESTAMP"); if ($stmt && $stmt->bind_param('ssi', $template, $content, $active) && $stmt->execute()) { return true; } $this->setErrorMessage('Database error'); $this->debug->append('Template::updateEntry failed: ' . $this->mysqli->error); return false; } } $template = new Template(); $template->setDebug($debug); $template->setMysql($mysqli);