Detect if a hook in a module is executed by Cron or UI in Drupal -


i have implemented hook_node_update in module. want programming calculations based on if hook called drupal ui or drupal cron. how can detect this?

you implement hook_cron_queue_info() , set static variable there update hook later checks.

function mymodule_cron_queue_info() {   $cron_running = &drupal_static('mymodule_cron_running');   $cron_running = true;   return array(); }  function mymodule_node_update($node) {   $cron_running = &drupal_static('mymodule_cron_running');   if ($cron_running) {     // custom logic.   } } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -