Exemple #1
0
 function getandwriteipaddress()
 {
     global $gbl, $sgbl, $login, $ghtml;
     dprint($this->nname);
     $rmt = new Remote();
     $driverapp = $gbl->getSyncClass($this->__masterserver, $this->nname, 'ipaddress');
     if (!$driverapp) {
         print "NO driverapp for ipaddress\n";
         exit;
     }
     $rmt->func = array("Ipaddress__{$driverapp}", "listSystemIps");
     $rmt->arglist = array($this->nname);
     $rmt->action = 'get';
     $rmt->slave_password = $this->realpass;
     $gbl->pserver_password = $this->realpass;
     $result = rl_exec(null, $this->nname, $rmt);
     if (!$result) {
         dprint("No Result <br> <br> \n\n\n");
     }
     //dprintr($result);
     // hack hack hack
     // Direclty call 'was' to sync the pserver. This is needed because this is an out of the way Action, to remove the ipaddress from the database before the newly got ones are added in.
     $iplist = $this->getList("ipaddress");
     if ($iplist) {
         foreach ($iplist as $ip) {
             $exclusive_client[$ip->nname] = $ip->clientname;
             $ip->dbaction = 'delete';
             $ip->write();
             $ip->dbaction = 'clean';
         }
         //$this->was();
     }
     foreach ($result as $row) {
         if (!trim($row['ipaddr'])) {
             continue;
         }
         $row['nname'] = $row['devname'] . "___" . $this->syncserver;
         $row['syncserver'] = $this->syncserver;
         $row['parent_clname'] = $this->getClName();
         if (isset($exclusive_client[$row['nname']])) {
             $row['clientname'] = $exclusive_client[$row['nname']];
         }
         $obj = new Ipaddress($this->__masterserver, $this->syncserver, $row['nname']);
         $obj->create($row);
         $obj->write();
         $obj->dbaction = 'clean';
     }
 }
Exemple #2
0
function rl_exec_set($masterserver, $slaveserver, $object)
{
    $rmt = new Remote();
    $rmt->action = 'set';
    $rmt->robject = $object;
    return rl_exec($masterserver, $slaveserver, $rmt);
}