hasAutomaticInventory($item->getID());
if (empty($a_computerextend)) {
return true;
}
echo '
';
echo '';
echo '| '.__('Remote Support').' | ';
echo '
';
echo '';
echo '';
$url = "" . $a_computerextend['remote_addr'] . "";
if ($url != ""){
echo "VNC connect : ";
echo $url;
echo "
";
}
echo ' | ';
echo '
';
echo '
';
}
static function cronRemotesupport($task) {
global $DB;
Toolbox::logInFile("remotsupport","Starting search of agents\n");
$agents = [];
$data_set = [];
foreach (getAllDataFromTable(PluginFusioninventoryAgent::getTable()) as $a) {
$data_set[] = $a["id"];
$agents[$a["id"]] = $a;
}
foreach ($data_set as $id) {
$agent = new PluginFusioninventoryAgent;
$agent->getFromDB((int)$id);
$st = $agent->getStatus();
if ($st["message"] != "noanswer")
Toolbox::logInFile("remotsupport",print_r($agents[$id],true));
$comp = new Computer();
$comp->getFromDB($agents[$id]["computers_id"]);
if ($st["message"] == "noanswer")
$comp->fields["states_id"] = NULL;
else
$comp->fields["states_id"] = 2;
$DB->update("glpi_computers", [
'states_id' => $comp->fields["states_id"] ],
[ 'id' => $agents[$id]["computers_id"] ]
);
$comp->fields["contact"]."\n";
}
return true;
}
static function cronInfo($name) {
return [
'description' => "Agent search remotesupport"];
}
}