Remote API: Updating DB but not entry in interface

Discussion in 'Developers' Forum' started by MaddinXx, Apr 12, 2013.

  1. MaddinXx

    MaddinXx Member

    Hi

    Today I've written a small script to check mailserver availability. If it's down, it runs a php script which connect's to the remote API.

    Code:
    <?php
    
    // login credentials
    $username = 'XXX;
    $password = 'XXX';
    
    // CP URLs
    $soap_location = 'https://XXX/remote/index.php';
    $soap_uri = 'https://XXX/remote/';
    
    // remote API client
    $client = new SoapClient(
    	null,
    	array(
    		'location' => $soap_location,
    		'uri' => $soap_uri,
    		'trace' => 1,
    		'exceptions' => 1
    	)
    );
    
    
    try
    {
    	// login to ISPConfig
    	if($session_id = $client->login($username,$password)) {
    		echo "Logged successfull. Session ID:". $session_id;
    	}
    
    	// DNS record ID
    	$id = XXX;
    	$client_id = 1;
    
    	// get the DNS record
    	$dns_record = $client->dns_cname_get($session_id, $id);
    
    	// new value
    	if ($dns_record['data'] != 'XXX')
    	{
    		$dns_record['data'] = 'XXX';
    
    		// update the DNS record
    		$affected_rows = $client->dns_cname_update($session_id, $client_id, $id, $dns_record);
    
    		echo "Number of records that have been changed in the database: ". $affected_rows;
    	}
    
    	// logout
    	if($client->logout($session_id)) {
    		echo 'Logged out.<br />';
    	}
    }
    catch (SoapFault $e)
    {
    	die('SOAP Error: '.$e->getMessage());
    	echo "Please contact the server administator";
    }
    It's created a job within ISPConfig queue and the DB changes as well. However, the interface shows the old entry and it also does not seem to fire the server's event to update the BIND files.

    E.g. the changes are written to DB - and that's it.

    Do I have to add something else?

    Thanks a lot!
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    You have to run a update on the zone itself after updatng the cname were you increment the serial by 1.
     
  3. MaddinXx

    MaddinXx Member

    Great, thanks till. Have a good WE :)
     

Share This Page