Database Interaction
use solutedns\System\db;
$db = db::get();
$db->PDO_STATEMENT
With the db
class you can directly call any PDO statement available in PHP. Depending on the namespace your in you might need to call the global PDO class by adding an backslash before the PDO class name itself.
Zone Exists
use solutedns\Dns\Zones;
$zones = new Zones();
$zones->exists(string);
Attributes:
- domainstring
- Zone name
Please note an Error Code may be returned instead of a boolean.
Slave Zone
use solutedns\Dns\Zones;
$zones = new Zones();
$zones->slave(string);
Attributes:
- domainstring
- Zone name
Please note an Error Code may be returned instead of a boolean.
Update SOA
use solutedns\Dns\Zones;
$zones = new Zones();
$zones->update(string, integer);
Attributes:
- domainstring
- Zone name
- domain idint
- Avoid an extra lookup when the domain id is known [optional]
Please note an Error Code may be returned instead of a boolean.
Records in Zone
use solutedns\Dns\Records;
$records = new Records();
$records->size(string);
Attributes:
- domainstring
- Zone name
Please note an Error Code may be returned instead of an integer or boolean.
Pre Validate
use solutedns\Dns\Validate;
$validate = new Validate();
$validate->pre(array);
Attributes:
- domainstring
- Zone name
- typestring
- Record type
- Namestring
- Record name
- contentstring
- Record content
- priointeger
- Record prioirity
- ttlinteger
- Record time to live
Please note this is an preliminary validation function. No zone checks are performed being but not limited to: unique record, zone exists and non-alias targeting checks.
Zone Backup
use solutedns\DNS\Backup;
$backup = new Backup();
$backup->backup(string);
Attributes:
- domainstring
- Zone name
Please note for this function to work you must have configured a support database.
Zone Restore
use solutedns\DNS\Backup;
$backup = new Backup();
$backup->restore(int);
Attributes:
- backup idint
- The id of the backup to recover.
Please note for this function to work you must have configured a support database.
Audit Logging
use solutedns\System\Audit;
$audit = new Audit();
Functions:
- setUser()string
- Set a username or id of who is making changes.
- setEnv()string
- Set an environment where the changes have been triggered.
Please note for this function to work you must have configured a support database.
SSH Session
use solutedns\Dns\Dnssec;
$dnssec= new Dnssec();
$dnssec->session();
All functions which use an SSH connection to the nameserver have an session parameter. This can be used to avoid the function reconnecting to the server every time it’s called. This is typically useful when performing multiple actions which require SSH access.
You can either store the session in an variable and send it along with each function call:
$session = $dnssec->session(); $dnssec->rectify('example.com', $session); $dnssec->rectify('demo.com', $session);
Or store the session in the class itself:
$dnssec->session(); $dnssec->rectify('example.com'); $dnssec->rectify('demo.com');
Support Database
To enable support functions like zone backup/restore and audit logging a support database must be connected to the SoluteDNS Core. In order to do so you have to add a PDO object to the [‘database’][‘support’] configurable.
The following tables should be created in the support database in order for SoluteDNS to function properly:
CREATE TABLE sdns_backup ( id INT AUTO_INCREMENT, domain_id INT, domain VARCHAR(255) NOT NULL, serial INT, data TEXT NOT NULL, time INT NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; CREATE INDEX domain_id_idx ON sdns_backup(domain_id); CREATE INDEX domain_idx ON sdns_backup(domain); CREATE TABLE sdns_audit ( id INT AUTO_INCREMENT, domain_id INT, domain VARCHAR(255) NOT NULL, user VARCHAR(255) NOT NULL, env VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, data TEXT NOT NULL, time INT NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; CREATE INDEX domain_id_idx ON sdns_audit(domain_id); CREATE INDEX domain_idx ON sdns_audit(domain);
config.php
return [ 'license' => 'PRO_xxxxxxxxxxxxxxxxx', 'database' => [ 'host' => '127.0.0.1', 'port' => '', 'name' => 'ns', 'user' => 'pdns', 'pass' => 'password', 'type' => 'native', # native/master 'support' => new PDO(...) ] ]