/** * Overload Sprig::update() to save revision change * @param bump whether to bump the version number */ public function update($bump = TRUE) { Kohana::$log->add(Kohana::DEBUG, 'Executing Versioned_Sprig::update'); $updated = FALSE; foreach ($this->_fields as $field => $object) { if ($object instanceof Sprig_Field_Tracked and $this->changed($field)) { $this->comment = UTF8::ucwords($object->label) . ' changed from "' . $this->_original[$field] . '" to "' . $this->_changed[$field] . '".'; } if ($object instanceof Sprig_Field_Versioned and $this->changed($field) and $bump) { $diff = ''; if ($this->version != 0) { $diff = Versioned::diff($this->_original[$field], $this->_changed[$field]); $diff = Versioned::clean_array($diff); $diff = serialize($diff); } $this->version++; $revision = Sprig::factory($this->_model . '_revision'); $revision->values(array('entry' => $this->id, 'version' => $this->version, 'editor' => $this->editor, 'diff' => $diff)); $revision->comments = $this->comments; $revision->create(); $updated = TRUE; $this->comments = array(); } } if (!$updated and count($this->comments) > 0) { $revision = Sprig::factory($this->_model . '_revision'); $revision->entry = $this->id; $revision->version = $this->version; $revision->load(); $revision->comments = array_merge($revision->comments, $this->comments); $revision->update(); } return parent::update(); }
public function update() { // Make sure there are no twig syntax errors try { $test = Kohanut_Twig::render($this->code); } catch (Twig_SyntaxError $e) { $e->setFilename('code'); throw new Kohanut_Exception("There was a Twig Syntax error: " . $e->getMessage()); } catch (Exception $e) { throw new Kohanut_Exception("There was an error: " . $e->getMessage() . " on line " . $e->getLine()); } parent::update(); }
public function update() { // Create a new token each time the token is saved $this->token = $this->create_token(); return parent::update(); }
public function update() { $this->_cache_content(); parent::update(); }
public function update() { $this->gc(); return parent::update(); }