diff -urNp notify-head/notify.install notify-scheduler/notify.install --- notify-head/notify.install 2006-12-21 18:41:05.000000000 -0800 +++ notify-scheduler/notify.install 2006-12-21 18:44:49.000000000 -0800 @@ -38,4 +38,27 @@ function notify_install() { else { drupal_set_message(t('Table installation for the Notify module was unsuccessful. The tables may need to be installed by hand.'), 'error'); } + + // Set the module weight so that the cron job will be executed after + // scheduler. Unless the user has manually changed scheduler's weight, this + // will result in a weight of 10, which will also put us after most other + // modules, some of which may do their own cron-based publishing. This is + // safe to run even if scheduler isn't installed. + $weight = (int) db_result(db_query("SELECT weight FROM {system} WHERE name = 'scheduler'")); + $weight += 10; + db_query("UPDATE {system} SET weight = %d WHERE name = 'notify'", $weight); +} + +/** + * Fix for bug http://drupal.org/node/67475 + * Alter weight of module to run cron jobs after scheduler. + */ +function notify_update_1() { + $ret = array(); + $weight = (int) db_result(db_query("SELECT weight FROM {system} WHERE name = 'scheduler'")); + $weight += 10; + // update_sql doesn't take other parameters, but this is safe, since $weight is + // guaranteed to be an int. + $ret[] = update_sql("UPDATE {system} SET weight = $weight WHERE name = 'notify'"); + return $ret; }