Problem/Motivation
It can be helpful to see the title of node-revisions being deleted - so add code to node_revision_delete_cron()
Steps to reproduce
Proposed resolution
See patch - could also add as configuration option
b/web/modules/contrib/node_revision_delete/node_revision_delete.module
@@ -313,7 +313,15 @@
// Delete the revisions.
foreach ($revisions as $revision) {
+ // Get title.
+ $nid = \Drupal::database()->select('node_revision', 'nr')
+ ->fields('nr', ['nid'])
+ ->condition('vid', $revision)->execute()->fetchCol();
+ $node = $node_storage->load($nid[0]);
+
$node_storage->deleteRevision($revision);
+
+ \Drupal::logger('node_revision_delete')->notice('id =' . $revision . ' ' . $node->title->value);
}
// The node_revision_delete.last_execute state variable stores the last
// time a revision was deleted once cron run.
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
adriancidI think is better to add an option to enable and disable this functionality.
Comment #3
pick_d commentedLooks like this patch won't work with 2.0.0 alpha, sadly.
Could be an extremely good and necessary feature. Maybe I am doing something wrong, but as of now revisions get deleted on the cron run, and there are just no indications about that whatsoever, the log (/admin/reports/dblog) is clean, like nothing happened :-)
Comment #4
rp7 commentedComment #5
rp7 commentedPatch attached logs the following:
Unsure if the we really need to add the title of the revision - does it say all that much (a title can be the same for a lot of revisions).
Comment #6
johan den hollander commented#5 patch applies to 2.0.x-dev and gives the output as stated in the comment.
@adriancid is right that this needs to be configurable on the settingspage.
Comment #7
joseph.olstad#3401632: Support for Ultimate Cron
I have no idea why nrd 2.0.x does not have a hook_cron, have no idea what nrd 2.0.x does
Comment #8
joseph.olstadComment #9
adriancidWe need an option to configure if we will log or not the message, maybe some people don't want to do it.
Comment #11
adriancidComment #14
adriancid