Ejemplo n.º 1
0
/**
 * @param $threads_id
 * @param $ocsservers_id
 * @param $thread_nbr
 * @param $threadid
 * @param $fields
 * @param $config
**/
function SecondPass($threads_id, $ocsservers_id, $thread_nbr, $threadid, $fields, $config)
{
    $server = new PluginOcsinventoryngServer();
    $ocsserver = new PluginOcsinventoryngOcsServer();
    if (!PluginOcsinventoryngOcsServer::checkOCSconnection($ocsservers_id)) {
        echo "\tThread #" . $threadid . ": cannot contact server\n\n";
        return false;
    }
    if (!$ocsserver->getFromDB($ocsservers_id)) {
        echo "\tThread #" . $threadid . ": cannot get OCS server information\n\n";
        return false;
    }
    if (!$server->getFromDBbyOcsServer($ocsservers_id)) {
        echo "\tThread #" . $threadid . ": cannot get server information\n\n";
        return false;
    }
    $cfg_ocs = PluginOcsinventoryngOcsServer::getConfig($ocsservers_id);
    return plugin_ocsinventoryng_importFromOcsServer($threads_id, $cfg_ocs, $server, $thread_nbr, $threadid, $fields, $config);
}
Ejemplo n.º 2
0
 function cleanDBonPurge()
 {
     $link = new PluginOcsinventoryngOcslink();
     $link->deleteByCriteria(array('plugin_ocsinventoryng_ocsservers_id' => $this->fields['id']));
     $admin = new PluginOcsinventoryngOcsAdminInfosLink();
     $admin->deleteByCriteria(array('plugin_ocsinventoryng_ocsservers_id' => $this->fields['id']));
     $server = new PluginOcsinventoryngServer();
     $server->deleteByCriteria(array('plugin_ocsinventoryng_ocsservers_id' => $this->fields['id']));
     unset($_SESSION["plugin_ocsinventoryng_ocsservers_id"]);
     // ocsservers_id for RuleImportComputer, OCS_SERVER for RuleImportEntity
     Rule::cleanForItemCriteria($this);
     Rule::cleanForItemCriteria($this, 'OCS_SERVER');
 }