Current File : //etc/zpanel/panel/configure_domains_if_not_exists.php |
<?php
require('/etc/sentora/panel/cnf/db.php');
require_once('/etc/sentora/panel/dryden/db/driver.class.php');
include_once('/etc/sentora/panel/dryden/debug/logger.class.php');
include_once('/etc/sentora/panel/dryden/ctrl/options.class.php');
include_once('/etc/sentora/panel/inc/dbc.inc.php');
$con = mysqli_connect($host, $user, $pass,$dbname) or die("Could not connect: " . mysqli_connect_error());
// mysql_select_db($dbname);
try
{
$tomcat_sql="SELECT * from x_java_version";
$result_tomcat= mysqli_query($con,$tomcat_sql);
if (mysqli_num_rows($result_tomcat) > 0)
{
$row_tomcat = mysqli_fetch_assoc($result_tomcat);
$TomcatPath = $row_tomcat['x_file_path'];
}
$query="SELECT vh.vh_directory_vc, vh.vh_name_vc, xa.ac_user_vc FROM x_vhosts as vh LEFT JOIN x_accounts as xa ON vh.vh_acc_fk=xa.ac_id_pk where vh.vh_deleted_ts IS NULL";
$result = mysqli_query($con,$query);
if (mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_assoc($result))
{
$username = $row['ac_user_vc'];
$domain_name=$row['vh_name_vc'];
$path = $row['vh_directory_vc'];
$vhost_path = rtrim((ctrl_options::GetSystemOption('hosted_dir') . $username . "/".ltrim($path,"/")), "/")."/";
$get_sh_path=shell_exec("whereis sh | awk '{print $2}'");
$get_sh_path=str_replace("\n","",$get_sh_path);
$get_sh_path=str_replace('\n',"",$get_sh_path);
$cmd="$get_sh_path /scripts/add_domain_java_only.sh $domain_name $vhost_path $TomcatPath";
shell_exec($cmd);
}
}
}
catch(Exception $e)
{
echo 'Message: ' .$e->getMessage();
}
?>