Skip to content

Instantly share code, notes, and snippets.

@sminnee
Created March 9, 2010 01:11
Show Gist options
  • Select an option

  • Save sminnee/326033 to your computer and use it in GitHub Desktop.

Select an option

Save sminnee/326033 to your computer and use it in GitHub Desktop.
Index: sapphire/core/model/SiteTree.php
===================================================================
--- sapphire/core/model/SiteTree.php (revision 100671)
+++ sapphire/core/model/SiteTree.php (working copy)
@@ -1313,6 +1313,14 @@
$this->syncLinkTracking();
+ // Check to see if we've only altered fields that shouldn't affect versioning
+ $fieldsIgnoredByVersioning = array('HasBrokenLink', 'Status', 'HasBrokenFile', 'ToDo');
+ $changedFields = array_keys($this->getChangedFields(false, 2));
+ if(!array_diff($changedFields, $fieldsIgnoredByVersioning)) {
+ // This will have the affect of preserving the version
+ $this->migrateVersion($this->Version);
+ }
+
parent::onBeforeWrite();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment