function tool_main_set_restart_mode($domain_id, $shard_id, $restart_mode = 0)
{
    global $db, $nel_user, $tpl;
    global $AS_ShardRestart, $AS_ShardDomainRestart;
    $sequence_info = tool_main_get_restart_sequence($nel_user['user_name'], $domain_id, $shard_id);
    if (!$sequence_info) {
        $sequence_info = tool_main_add_restart_sequence($nel_user['user_name'], $domain_id, $shard_id, $restart_mode);
    }
    if ($sequence_info) {
        $sql = "UPDATE " . NELDB_SHARD_TABLE . " SET shard_restart=" . $sequence_info['restart_sequence_id'] . " WHERE shard_id=" . $shard_id . " AND shard_domain_id=" . $domain_id;
        $db->sql_query($sql);
        // update shards information
        $nel_user['access']['user_shards'] = tool_admin_users_shards_get_list($nel_user['user_id']);
        $nel_user['access']['group_shards'] = tool_admin_groups_shards_get_list($nel_user['user_group_id']);
        $nel_user['access']['shards'] = tool_admin_users_groups_shards_merge();
        $tpl->assign('tool_shard_list', $nel_user['access']['shards']);
        // update shard restart information
        $AS_ShardRestart = tool_main_get_shard_data($shard_id, 'shard_restart');
        $AS_ShardDomainRestart = tool_main_get_domain_shard_restart($view_domain_id);
        $tpl->assign('tool_shard_restart_status', $AS_ShardRestart);
        $tpl->assign('tool_domain_has_shard_restart', $AS_ShardDomainRestart);
    }
    return $sequence_info;
}
Example #2
0
$tpl->assign('tool_domain_selected', $view_domain_id);
$tpl->assign('tool_shard_list', $nel_user['access']['shards']);
$tpl->assign('tool_shard_selected', $view_shard_id);
$tool_shard_filters = tool_main_get_shard_ids($view_shard_id);
$tpl->assign('tool_shard_filters', $tool_shard_filters);
$AS_Host = tool_main_get_domain_host($view_domain_id);
$AS_Port = tool_main_get_domain_port($view_domain_id);
$AS_Name = tool_main_get_domain_name($view_domain_id);
$AS_Application = tool_main_get_domain_data($view_domain_id, 'domain_application');
$AS_RingSQL = tool_main_get_domain_data($view_domain_id, 'domain_sql_string');
$AS_CsSQL = tool_main_get_domain_data($view_domain_id, 'domain_cs_sql_string');
$AS_ShardName = tool_main_get_shard_name($view_shard_id);
$AS_InternalName = tool_main_get_shard_as_id($view_shard_id);
$AS_ShardRestart = tool_main_get_shard_data($view_shard_id, 'shard_restart');
$AS_ShardDomainRestart = tool_main_get_domain_shard_restart($view_domain_id);
$AS_ShardLang = tool_main_get_shard_data($view_shard_id, 'shard_lang');
$tpl->assign('tool_shard_restart_status', $AS_ShardRestart);
$tpl->assign('tool_domain_has_shard_restart', $AS_ShardDomainRestart);
$tool_no_domain_lock = false;
if ($AS_InternalName == '*' && $AS_ShardDomainRestart > 0) {
    $tool_no_domain_lock = true;
    $tpl->assign('tool_no_domain_lock', $tool_no_domain_lock);
}
$tpl->assign('tool_page_title', $AS_Name . ($AS_ShardName != '' ? ' / ' . $AS_ShardName : ''));
$tool_annotation_info = tool_main_get_annotation($view_domain_id, $view_shard_id);
$tool_lock_info = tool_main_get_lock($view_domain_id, $view_shard_id);
// we check if the last activity on the lock is too old, in which case we unlock
// and only if there are no restart sequence going on (prevent loosing lock when inactive for too long during restart sequence - patch ...)
if (LOCK_TIMEOUT > 0 && is_array($tool_lock_info) && $AS_ShardRestart == 0 && !$tool_no_domain_lock) {
    $now = time();
    if ($tool_lock_info['lock_update'] + LOCK_TIMEOUT < $now) {