Permalink
Browse files

API: add onBeforeRollback() and onAfterRollback() hooks.

  • Loading branch information...
1 parent 7871e5a commit 5238e9cf48251f77f3fda095724990da3bee6803 @wilr wilr committed Apr 6, 2013
Showing with 4 additions and 0 deletions.
  1. +4 −0 model/Versioned.php
View
@@ -1077,8 +1077,12 @@ public function writeToStage($stage, $forceInsert = false) {
* @param $version Either the string 'Live' or a version number
*/
public function doRollbackTo($version) {
+ $this->extend('onBeforeRollback', $version);
$this->publish($version, "Stage", true);
+
$this->owner->writeWithoutVersion();
+
+ $this->extend('onAfterRollback', $version);
}
/**

4 comments on commit 5238e9c

@chillu
Member
chillu commented on 5238e9c Apr 6, 2013

@wilr Tsk tsk ;) e2b42ca

@wilr
Member
wilr commented on 5238e9c Apr 6, 2013

That's what rebase is for :)

@wilr
Member
wilr commented on 5238e9c Apr 6, 2013

Didn't @simonwelsh have a patch to magic over $this->owner? Thought that it's redundant.

@simonwelsh
Contributor

I did, and it’s hacked into our Extension.php. Never got around to writing tests and all that.

Please sign in to comment.