Skip to content

Instantly share code, notes, and snippets.

@ianlintner-wf
Created May 13, 2016 01:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianlintner-wf/e526f29f9e5065fe3239de14a4d4a94c to your computer and use it in GitHub Desktop.
Save ianlintner-wf/e526f29f9e5065fe3239de14a4d4a94c to your computer and use it in GitHub Desktop.
<?php
function delete_node_revisions_before_timestamp($nid, $timestamp) {
$node = node_load($nid);
$revisions = node_revision_list($node);
dpm($revisions);
foreach($revisions as $revision) {
if($revision->timestamp < $timestamp) {
dpm($revision->vid);
node_revision_delete($revision->vid);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment