Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Following on from #366539: Rule sets on cron execution - I don't think the real feature request was ever raised. It would still be extremely useful. Here's my use case:
Feeds is being used to aggregate several feeds. The aggregated content (nodes) is then categorised manually by editorial staff. Anything uncategorised is, in effect, not wanted. I would like to delete all nodes of type "aggregated_news" older than 1 month with no categories assigned when cron runs.
I can do it easily enough with hook_cron() but it feels like something Rules could do well too. =)
Comments
Comment #1
Vote_Sizing_Steve CreditAttribution: Vote_Sizing_Steve commentedThis sounds like a job for rules & views bulk operations (http://drupal.org/project/views_bulk_operations) - but I'm not sure how. Perhaps someone else can post more instructions on how to accomplish this.
Comment #2
greg.harveyVBO was my 'back-up' solution, but it's manual. Someone has to go in and tick the boxes against the content to be deleted and hit a 'Delete' button. I want to be able to do it automatically, which is most definitely *not* something VBO does.
If you want help with VBO, you should post a 'support request' in the VBO issue queue, not ask for help in an unrelated Rules module feature request! =/
Comment #3
Vote_Sizing_Steve CreditAttribution: Vote_Sizing_Steve commentedIsn't this manually checking only necessary on exposed filters?
I've got a somewhat more complicated situation where instead of a 'simple' bulk operation like deleting, I'm trying to update fields - is there any documentation on (Execute a VBO programmatically ->) Operation arguments?
Comment #4
greg.harveyWow, I see what you mean. I didn't know VBO could do that.
Docs are here, but it's not 100% clear:
http://drupal.org/node/335694
I need to play with this.
Regardless, this discussion should not be in Rules. Moving it to a VBO 'support request'.
Comment #5
infojunkie CreditAttribution: infojunkie commentedThis might help: http://thereisamoduleforthat.com/content/event-driven-bulk-updates-using...
Comment #6
greg.harveyThanks for the follow-up, I will try this on one of my client sites as they want something like this, hence my Rules module feature request!
Ps - nice blog title! =)
Comment #7
infojunkie CreditAttribution: infojunkie commentedComment #8
greg.harveyOk, I'm not getting this at all. I've got Rules and VBO installed. I've created a VBO view that shows me a list of published property nodes that have a 'sold' date of more than two weeks ago. There is only one configured operation, 'Unpublish'. This works fine.
I need this to run on cron so the VBO view is fired and the nodes are unpublished. That's the missing link! It doesn't seem possible? Can anyone help me?
Comment #9
Itangalo CreditAttribution: Itangalo commentedOh, yes it is possible!
There's a Rules event 'Cron is being run' (or similar) to trigger on. They you'll need the action 'Use a node object to run a VBO programmatically' (or any other object).
[Hm. There might be a problem here... I'll get back to that.]
When configuring that Rules action, name the view you want to call, and the VBO action you wish to run. All listed nodes should be unpublished, and everyone should be happy. You won't have to enter any arguments or so for the VBO, unless you want to.
Now, for the problem:
1) I think VBO since the last few months might require an object present to call the VBO. At least the actions are called 'Use a node/user/whatever object to run a VBO programmatically'. The point of this is that you can use information in the node/user/whatever when executing the VBO -- pretty useful if you want to send along a NID as argument. But pretty blocking if you don't have any objects present, which most likely is the case if you trigger Rules on a cron run. Check if you have any VBO actions available (probably at the bottom of your list of Rules actions).
2) Another problem is that when Rules is run by cron, it is considered to be an anonymous user trying to do stuff. You have probably set sane access control on your VBO, meaning that Rules can't access it. I saw a similar problem some months ago, and that resulted in a custom workaround for access -- running cron as user 1 or something. I don't have any details, just know that this may be problematic.
I hope this clears some things up. Sorry to start off the comment with 'yeah, possible' and ending it with two problems that could be major. :-/
Comment #10
greg.harveyLOL, np. Thanks for stepping in with ideas. Will investigate further. I'd love to provide a solution for this that works for anyone! =)
Comment #11
drib CreditAttribution: drib commentedIs there any solution using "Rules and Integration Views" module?
_____________________
Descoperiti carti bune!
Comment #12
geek-merlinsub
Comment #13
infojunkie CreditAttribution: infojunkie commentedHaven't heard back from posters so I assume this is fixed.
Comment #14
greg.harveyI basically paused working on this and never actually tried further. I've come across the need for the feature a few more times, but usually it was just easier to write a hook_cron() implementation. So not 'fixed', more 'postponed', but I guess fixed is as good a status as any for now!
Comment #15
infojunkie CreditAttribution: infojunkie commentedComment #16
bojanz CreditAttribution: bojanz commentedClosing this support request.
Already mentioned in other issues that scheduling operations is being solved outside of VBO so there is no point in us trying to do it as well (for now).
For actions there is http://drupal.org/project/scheduled_actions while Rules has it built in. That code can be built upon and new features can be requested there.
We can handle any VBO problems that might prevent this from working (maybe the ones Itangalo mentioned in #9) in separate issues (though in general VBO D6 issues are getting little attention since the module is already stable. D7 is where the fun is at).