public function testConfiguration() { $cpanel = new Cpanel($options = array('host' => 'https://127.0.0.1:2087', 'username' => 'root', 'password' => 'password', 'auth_type' => 'password')); $this->assertEquals($options['host'], $cpanel->getHost()); $this->assertEquals($options['username'], $cpanel->getUsername()); $this->assertEquals($options['password'], $cpanel->getPassword()); $this->assertEquals($options['auth_type'], $cpanel->getAuthType()); }
private function change_dns_ip($subdomain, $real_ip, $line, $serial_number) { $response = $this->cpanel->execute_action(2, 'ZoneEdit', 'edit_zone_record', $this->config->user, array('name' => $subdomain, 'class' => "IN", 'line' => $line, 'ttl' => "14400", 'type' => 'A', 'domain' => $this->config->domain, 'address' => $real_ip, "serialnum" => (string) $serial_number)); if ($response !== false && !strpos($response, 'could not')) { CpanelDnsUpdaterLogger::log($this->messages["DNS_IP_UPDATED_MESSAGE"] . $real_ip); } else { CpanelDnsUpdaterLogger::log($this->messages["UNKNOW_UPDATE_ERROR_MESSAGE"]); } }
/** * This method override its parent method 'runQuery()' * * @see parent::runQuery * @param string $action function name that will be called. * @param string $arguments list of parameters that will be attached. * @return array results of API call * @since v1.0.0 */ protected function runQuery($action, $arguments) { $this->setAuthorization(config('cpanel-whm.username'), config('cpanel-whm.auth'))->setHost(config('cpanel-whm.host'))->setAuthType(config('cpanel-whm.auth_type', 'hash')); return parent::runQuery($action, $arguments); }