From f4038a2160d55a7f519a3b42be1aa96e29e9a908 Mon Sep 17 00:00:00 2001 From: ftimme <ft@falkotimme.com> Date: Wed, 27 Feb 2013 09:01:40 -0500 Subject: [PATCH] - Fixed "FUNCTION databasename.CONCAT does not exist" error for older MySQL versions. --- interface/web/sites/web_domain_edit.php | 27 ++++++++++++++++++++++++--- 1 files changed, 24 insertions(+), 3 deletions(-) diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php index dfb67f8..b21b1c8 100644 --- a/interface/web/sites/web_domain_edit.php +++ b/interface/web/sites/web_domain_edit.php @@ -806,9 +806,18 @@ unset($rec); //* Update all subdomains and alias domains - $records = $app->db->queryAllRecords("SELECT domain_id FROM web_domain WHERE parent_domain_id = ".$this->id); + $records = $app->db->queryAllRecords("SELECT domain_id, `domain`, `type`, `web_folder` FROM web_domain WHERE parent_domain_id = ".$this->id); foreach($records as $rec) { - $app->db->datalogUpdate('web_domain', "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."'", 'domain_id', $rec['domain_id']); + $update_columns = "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."'"; + if($rec['type'] == 'vhostsubdomain') { + $php_open_basedir = str_replace("[website_path]/web",$document_root.'/'.$rec['web_folder'],$web_config["php_open_basedir"]); + $php_open_basedir = str_replace("[website_domain]/web",$rec['domain'].'/'.$rec['web_folder'],$php_open_basedir); + $php_open_basedir = str_replace("[website_path]",$document_root,$php_open_basedir); + $php_open_basedir = $app->db->quote(str_replace("[website_domain]",$rec['domain'],$php_open_basedir)); + + $update_columns .= ", document_root = '".$document_root."', `php_open_basedir` = '".$php_open_basedir."'"; + } + $app->db->datalogUpdate('web_domain', $update_columns, 'domain_id', $rec['domain_id']); } unset($records); unset($rec); @@ -823,7 +832,7 @@ } - //* If the domain name has been changed, we will have to change all subdomains + //* If the domain name has been changed, we will have to change all subdomains + APS instances if(!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"]) { $records = $app->db->queryAllRecords("SELECT domain_id,domain FROM web_domain WHERE (type = 'subdomain' OR type = 'vhostsubdomain') AND domain LIKE '%.".$app->db->quote($this->oldDataRecord["domain"])."'"); foreach($records as $rec) { @@ -833,6 +842,18 @@ unset($records); unset($rec); unset($subdomain); + + // Update APS instances + $records = $app->db->queryAllRecords("SELECT id, instance_id FROM aps_instances_settings WHERE name = 'main_domain' AND value = '".$this->oldDataRecord["domain"]."'"); + if(is_array($records) && !empty($records)){ + foreach($records as $rec){ + $app->db->datalogUpdate('aps_instances_settings', "value = '".$this->dataRecord["domain"]."'", 'id', $rec['id']); + // Reinstall of package needed? + //$app->db->datalogUpdate('aps_instances', "instance_status = '1'", 'id', $rec['instance_id']); + } + } + unset($records); + unset($rec); } //* Set allow_override if empty -- Gitblit v1.9.1