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

Vote_Sizing_Steve’s picture

This 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.

greg.harvey’s picture

VBO 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! =/

Vote_Sizing_Steve’s picture

Isn'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?

greg.harvey’s picture

Project: Rules » Views Bulk Operations (VBO)
Version: 6.x-1.x-dev » 6.x-1.9
Component: Rules Engine » Actions
Category: feature » support

Wow, 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'.

infojunkie’s picture

greg.harvey’s picture

Thanks 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! =)

infojunkie’s picture

Status: Active » Postponed
greg.harvey’s picture

Version: 6.x-1.9 » 6.x-1.10
Status: Postponed » Active

Ok, 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?

Itangalo’s picture

Oh, 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. :-/

greg.harvey’s picture

Sorry to start off the comment with 'yeah, possible' and ending it with two problems that could be major. :-/

LOL, np. Thanks for stepping in with ideas. Will investigate further. I'd love to provide a solution for this that works for anyone! =)

drib’s picture

Status: Closed (fixed) » Active

Is there any solution using "Rules and Integration Views" module?

_____________________
Descoperiti carti bune!

geek-merlin’s picture

sub

infojunkie’s picture

Status: Active » Closed (fixed)

Haven't heard back from posters so I assume this is fixed.

greg.harvey’s picture

I 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!

infojunkie’s picture

Status: Closed (fixed) » Postponed
bojanz’s picture

Status: Postponed » Closed (fixed)

Closing 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).

Status: Active » Closed (fixed)