global $usergroups_lastsync;
$res = db_query_params("SELECT MAX(last_modified_date) AS lastmodified FROM nss_usergroups");
$row = db_fetch_array($res);
- if ($row['lastmodified'] > $usergroups_lastsync) {
+ if ($row['lastmodified'] >= $usergroups_lastsync) {
+ $usergroups_lastsync = time();
cron_reload_nscd();
cron_regen_apache_auth();
cron_reload_apache();
$hook_params = array();
plugin_hook("usergroups_sync", $hook_params);
- $usergroups_lastsync = time();
}
}
if (!$res && !db_connection_status())
db_reconnect();
while ($arr = db_fetch_array($res)) {
- usergroups_sync();
$script = systask_get_script($arr['plugin_id'], $arr['systask_type']);
if (!file_exists($script))
// Not installed on this node, skipping
$arr['systask_id']));
continue;
}
+
+ // Concurrency: ensure groups are activated in the system before starting task
if (!empty($arr['group_id']) && !is_group_active_nocache($arr['group_id'])) {
continue; // wait until project is approved
}
+ usergroups_sync();
+
db_query_params("UPDATE systasks SET status=$1, started=now() WHERE systask_id=$2",
array('WIP', $arr['systask_id']));
cron_acquire_lock($script);