First, this modules is awesome and has saved me a lot of processing time and hassle in trying to integrate with VBO.

That said, it would be incredibly helpful to be able to bulk recalculate fields on a periodic basis (or triggered after some event). Rules integration seems like it would be be a good approach, but I'm sure that there are others.

Thanks again for the module!

Comments

frakke’s picture

Great idea with triggered or periodic updates. I will add this when the module is approved for Drupal.org :-)

sansui’s picture

This looks like an interesting module that could be really useful. I have a social site where users enter their birthday and a computed field displays their age. This works fine except I'd like to be able to filter against views, and the values must be stored in the database.

Would be pretty nifty to have those values recompute on cron, and pick up recomputing where it left off each cron

khalor’s picture

Version: » 7.x-1.x-dev

Drush integration would be a great way to have periodic recomputation (as Rules can have problems with user privileges when executing periodic tasks)

frakke’s picture

Assigned: Unassigned » frakke

Hi Khalor,
I have created a separate issue regarding the drush implementation here: #1314082: Drush implementation

punges24’s picture

Was anyone able to figure out how to use the Re-compute module to automatically re-calculate every day?

Thanks

frakke’s picture

I'm not the far away from releasing a working version.
You will be able to configure the interval and initial starting time from that interval to make sure that it is only run when it's ok.

punges24’s picture

Great! Cant wait for the new configuration.

I just wanted to say something to #2 if Sansui is still checking this thread - U have tried to use views to sort age after it being computed from of date and you still run into another problem which I am looking for a solution for. When you enter a max age if using the exposed filter between, it has a problem because the computed field saves the age as a decimal like 22.6 (it only saves as 22 if its computed on the birthday) and when you filter it if you put in 22 it will not pull up anyone older then 22.0 so 22.1 would not show up already.

sansui’s picture

You don't have to save the value of the computed field with a decimal - you can round up or down to save as a whole number yes?

lavamind’s picture

I would be very interested in helping to test cron integration.

punges24’s picture

You can round up or down and save the field as a whole number but for what I was trying it would not work. I am working on something where the people we need to be able to sort by age and if its a whole number being rounded up or down it wont be 100% accurate. I am trying to find a way around this.

Kaloyan Petrov’s picture

What's the status of the Rules or scheduling integration?

andjules’s picture

+1 following

frakke’s picture

It's still not far away from beeng ready. It just takes a little more work than I expected to get it implemented the way I would like it to be.

For now you can use the drush commands in the latest dev-release to schedule cron runs. (That is, of course, if you have access to set up cron runs on your server).

cphilli12’s picture

Just curios, I a bit new to the use of drush, if you copy the drush command you provided in the module (replace the parm of course with field name), Can I just paste that PHP command into the "Rules" module under "when cron runs" with the action "execute custom PHP" option?

Do I need the DRUSH module installed first? does drupal core understand drush commands?

Thanks so much frakke , I am so happy you created this!! just need to get it scheduled asap :)

khalor’s picture

cphilli12, drush is a command-line tool that runs on your web server, not Drupal/PHP per se. To use it you need to SSH into your server, then perform a drush command (as documented in the link in #4)

You can set up a similar (but better approach IMHO) to Rule's 'when cron runs' using drush and crontab on your web server, which will perform a drush action on a repeatable time frame. Plenty of documentation of crontab here on D.o (it's how Drupal cron should be called on most implementations), as well as drush. There's also some documentation here.

cphilli12’s picture

Thank you, i will follow your suggestion, i really appreciate the drupal community

cphilli12’s picture

PatchRanger’s picture

Assigned: frakke » PatchRanger
Status: Active » Needs review
StatusFileSize
new6.48 KB

Can't imagine how cool realization of frakke will be, no doubt it'll be great.
Here is my modest implementation of Rules integration.
For now you can set only field type in Action setting form : nor batch size, nor entity type are implemented.
Tested with cron event.
Please review.

mxwitkowski’s picture

tried applying #18 patch to the latest dev version posted on April 26 and encountered two errors in applying the patch: Hunk #3 FAILED at 129. Hunk #4 FAILED at 221.

PatchRanger’s picture

I have re-rolled the patch for the latest dev.
I do not use Computed Field Tools currently and have not touched it for a long time - so it's just a re-roll without any improvement or even thorough testing. Though the patch should do the work.
Please review.
@mxwitkowski Enjoy!))

gruppler’s picture

It seems to be working fine.

It would be great if we could specify specific entities to re-calculate. For example, by selecting a list of entities you expect to be affected by a change in another entity, you could create a loop in Rules and re-calculate the field for only those entities, rather than all entities of that type.

areikiera’s picture

I've manually applied the patch from #20 to the latest dev version, and I'm guessing that there is an incompatibility with the current dev version. Below are the details of the issue I've run into:

I've created a rule that recalculates a computed field on a cron run.

When I run cron manually, I'm first redirected to the 'Re-computing FIELD' page where I see the progress bar for the computed fields being updated, then I'm redirected to the 'Re-compute computed fields' page with messages about how many fields were recomputed and how long it took. However, when I view my 'Recent log messages', I don't see the 'Cron run completed' message.

When cron runs automatically, I believe some sort of re-direct loop occurs because in my 'Recent log messages' I get lots of the following errors:

  • Attempting to re-run cron while it is already running.
  • Warning: Cannot modify header information - headers already sent by (output started at /xxxxx/xxxxx/public_html/includes/common.inc:2700) in drupal_goto() (line 703 of /xxxxx/xxxxx/public_html/includes/common.inc).
  • PLUS, the rule I created for recomputing computed fields on cron runs gets triggered repeatedly - Rules debug information: Reacting on event Cron maintenance tasks are performed.

Any help would be greatly appreciated! And thanks for this awesome module and the patch!

areikiera’s picture

Issue summary: View changes
Status: Needs review » Active

Changing to active since the patch when applied to the current dev version might cause a pretty serious issue, as outlined in a previous comment.

areikiera’s picture

Any updates?

areikiera’s picture

Just checking in again. Really hoping that this feature will be implemented soon, be it PatchRanger's solution or the original one that frakke mentioned. In the meantime, it would be awesome if the patch could be updated to work with the current dev version.

If anyone's interested in taking this on, I may be able to put a bounty on completing this. Just contact me, if interested.

ssoulless’s picture

following!

ssoulless’s picture

By the way this feature should be an external module included in the core.

ekidman’s picture

I'd love this functionality also, except I'm on D6. Just following for future updates.

tr33m4n’s picture

Hello,

For anyone still curious about this I managed to hack my way to a solution that worked for me, see my comment here. To use this in a rule, just execute the function using Rules execute PHP action. I solved the schedule/cron issue using Ultimate Cron and setting up a cron job in my custom module. There is information on the project page for invoking a cron job from a module.

Hope this helps
Dan

delacosta456’s picture

hi

yes wee need full integration with rules please

thanks