Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Is it possible to run the update of existing nodes automatically? For example I need it to be run on every cron run. Or maybe I can connect it to a rule (Rules module) and if the rule is satisfied, it can trigger.
Comments
Comment #1
czigor CreditAttribution: czigor commentedMay I ask why you want to do that? You need to run the update only once, when the module is installed. Afterwards the corresponding node references are created without running the update.
Comment #2
Sinan Erdem CreditAttribution: Sinan Erdem commentedI use some importers from Feeds module to import several different content types which are connected to each other with references. For some reason, after import, the nodereferences of one of the types gets cleared. So I needed to fix it by running the update after an import.
Comment #3
czigor CreditAttribution: czigor commentedOK, I see. This is not a very common use case... Anyway, putting this in any module worked for me:
Just for the record, for D7 it looks like this:
Hope it helps.
Comment #4
Sinan Erdem CreditAttribution: Sinan Erdem commentedThank you, I appreciate your help. I will try to run this next time when the references get lost again...
Comment #5
czigor CreditAttribution: czigor commentedI forgot to say (just in case it wasn't clear): this code updates corresponding node references every time cron runs. (Which might be quite resource consuming.)
Comment #6
Sinan Erdem CreditAttribution: Sinan Erdem commentedAh yes, it is my greatest nightmare on this project :) I cannot spearate different cron jobs. I would really like to have a way to separate cron jobs and run the large ones rarely and small ones more often... I tried several cron related modules with no luck yet...
Comment #8
Sinan Erdem CreditAttribution: Sinan Erdem commentedInstead of writing it in a module, can I run this script as a standalone script? I dont want it to run on every cron run, but I want to make a line for this script in my crontab file. So my cron will run once an hour but this script will only run once a day?
Is it posible somehow?
Comment #9
domidc CreditAttribution: domidc commentedNo new features will be added. New features can be posted on http://drupal.org/project/cer which is the next evolution of cnr.