Esempio n. 1
0
function tool_main_set_annotation($domain_id, $shard_id, $annotation)
{
    global $db;
    global $nel_user;
    global $AS_Name, $AS_ShardName;
    $annotation = htmlentities(trim($annotation), ENT_QUOTES);
    $data = tool_main_get_lock($domain_id, $shard_id);
    if ($data['lock_domain_id']) {
        // its a domain lock
        $shard_list = tool_main_get_domain_shard_list($domain_id);
        $shard_list = array_values($shard_list);
        $sql = "DELETE FROM " . NELDB_ANNOTATION_TABLE . " WHERE annotation_shard_id IN (" . implode(',', $shard_list) . ")";
        $db->sql_query($sql);
        $annotation_data = tool_main_get_annotation($domain_id, 0);
        if ($annotation_data) {
            nt_log("Domain Annotation (Domain: '" . $AS_Name . "') by '" . $nel_user['user_name'] . "' : " . $annotation);
            $sql = "UPDATE " . NELDB_ANNOTATION_TABLE . " SET annotation_data='" . $annotation . "',annotation_user_name='" . $nel_user['user_name'] . "',annotation_date=" . time() . " WHERE annotation_id=" . $annotation_data['annotation_id'];
            $db->sql_query($sql);
        } else {
            nt_log("Domain Annotation (Domain: '" . $AS_Name . "') by '" . $nel_user['user_name'] . "' : " . $annotation);
            $sql = "INSERT INTO " . NELDB_ANNOTATION_TABLE . " (`annotation_domain_id`,`annotation_data`,`annotation_user_name`,`annotation_date`) VALUES ";
            $sql .= "(" . $domain_id . ",'" . $annotation . "','" . $nel_user['user_name'] . "'," . time() . ")";
            $db->sql_query($sql);
        }
    } else {
        // its a shard lock
        $annotation_data = tool_main_get_annotation(0, $shard_id);
        if ($annotation_data) {
            nt_log("Shard Annotation (Domain: '" . $AS_Name . "' - Shard: '" . $AS_ShardName . "') by '" . $nel_user['user_name'] . "' : " . $annotation);
            $sql = "UPDATE " . NELDB_ANNOTATION_TABLE . " SET annotation_data='" . $annotation . "',annotation_user_name='" . $nel_user['user_name'] . "',annotation_date=" . time() . " WHERE annotation_id=" . $annotation_data['annotation_id'];
            $db->sql_query($sql);
        } else {
            nt_log("Shard Annotation (Domain: '" . $AS_Name . "' - Shard: '" . $AS_ShardName . "') by '" . $nel_user['user_name'] . "' : " . $annotation);
            $sql = "INSERT INTO " . NELDB_ANNOTATION_TABLE . " (`annotation_shard_id`,`annotation_data`,`annotation_user_name`,`annotation_date`) VALUES ";
            $sql .= "(" . $shard_id . ",'" . $annotation . "','" . $nel_user['user_name'] . "'," . time() . ")";
            $db->sql_query($sql);
        }
    }
}
Esempio n. 2
0
 case 'lock domain':
     if (tool_admin_applications_check('tool_main_lock_domain')) {
         tool_main_set_lock_domain($view_domain_id);
         $tool_lock_info = tool_main_get_lock($view_domain_id, $view_shard_id);
     }
     break;
 case 'unlock shard':
     if (is_array($tool_lock_info) && $tool_lock_info['lock_user_name'] == $nel_user['user_name']) {
         tool_main_delete_lock_shard($view_shard_id);
         $tool_lock_info = tool_main_get_lock($view_domain_id, $view_shard_id);
     }
     break;
 case 'unlock domain':
     if (is_array($tool_lock_info) && $tool_lock_info['lock_user_name'] == $nel_user['user_name']) {
         tool_main_delete_lock_domain($view_domain_id);
         $tool_lock_info = tool_main_get_lock($view_domain_id, $view_shard_id);
     }
     break;
 case 'update annotation':
     if (is_array($tool_lock_info) && $tool_lock_info['lock_user_name'] == $nel_user['user_name']) {
         $tool_annotation = $NELTOOL['POST_VARS']['annotation'];
         tool_main_set_annotation($view_domain_id, $view_shard_id, $tool_annotation);
         $tool_annotation_info = tool_main_get_annotation($view_domain_id, $view_shard_id);
     }
     break;
 case 'restart sequence':
     if (is_array($tool_lock_info) && $tool_lock_info['lock_user_name'] == $nel_user['user_name'] && tool_admin_applications_check('tool_main_easy_restart')) {
         $restart_ws_state = $NELTOOL['POST_VARS']['restart_ws_state'];
         $restart_first_step = 0;
         // if restart_ws_state == '' means that i didn't find a shard_id
         // which means the shard has been shutdown completely including AES and RAS