Commit 362728dc authored by Attila Hajtos's avatar Attila Hajtos

Remote API: new API call: server_get_php_versions.

parent 2ccc5f84
......@@ -222,6 +222,38 @@ class remoting_server extends remoting {
return false;
}
}
public function server_get_php_versions($session_id, $server_id, $php)
{
global $app;
if(!$this->checkPerm($session_id, 'server_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
}
if (!empty($session_id) && !empty($server_id) && !empty($php)) {
$php_versions = array();
$web_config[$server_id] = $app->getconf->get_server_config($server_id, 'web');
$server_type = !empty($web_config[$server_id]['server_type']) ? $web_config[$server_id]['server_type'] : 'apache';
if ($php === 'php-fpm' || ($php === 'hhvm' && $server_type === 'nginx')) {
$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0)", $server_id);
foreach ($php_records as $php_record) {
$php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
$php_versions[] = $php_version;
}
}
if ($php === 'fast-cgi') {
$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ? AND (client_id = 0)", $server_id);
foreach ($php_records as $php_record) {
$php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
$php_versions[] = $php_version;
}
}
return $php_versions;
} else {
return false;
}
}
}
?>
......@@ -197,6 +197,7 @@
<p><a href="openvz_vm_update.html" target="content">openvz_vm_update</a></p>
<h3>S</h3>
<p><a href="server_get.html" target="content">server_get</a></p>
<p><a href="server_get_php_versions.html" target="content">server_get_php_versions</a></p>
<p><a href="server_get_serverid_by_ip.html" target="content">server_get_serverid_by_ip</a></p>
<p><a href="sites_aps_available_packages_list.html" target="content">sites_aps_available_packages_list</a></p>
<p><a href="sites_aps_get_package_details.html" target="content">sites_aps_get_package_details</a></p>
......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title>ISPCOnfig 3 remote API documentation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="definitionen.css">
<style type="text/css">
</style></head>
<body>
<div style="padding:40px">
<h1>server_get_php_versions(<span class="var">$session_id</span>, <span class="var">$server_id</span>, <span class="var">$php</span>);</h1>
<br>
<b>Description: </b>
<p class="margin"> Returns the available PHP versions of the given server.</p><br>
<b>Input Variables: </b>
<p class="margin"> <span class="var">$session_id</span>, <span class="var">$server_id</span>, <span class="var">$php</span></p>
<b>Output: </b>
<p class="margin"> Returns an array with the available PHP versions.</p>
</div>
</body></html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment