add inserttask for config regeneration and fix aliasdomain NULL value if empty, fixes #478
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -2223,6 +2223,8 @@ if ($page == 'domains' || $page == 'overview') {
|
|||||||
|
|
||||||
// update customer/admin counters
|
// update customer/admin counters
|
||||||
updateCounters(false);
|
updateCounters(false);
|
||||||
|
inserttask('1');
|
||||||
|
inserttask('4');
|
||||||
|
|
||||||
$result_str = $result['imported'] . ' / ' . $result['all'];
|
$result_str = $result['imported'] . ' / ' . $result['all'];
|
||||||
standard_success('domain_import_successfully', $result_str, array(
|
standard_success('domain_import_successfully', $result_str, array(
|
||||||
|
|||||||
@@ -187,13 +187,14 @@ class DomainBulkAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
// preapre insert statement as it is used a few times
|
// preapre insert statement as it is used a few times
|
||||||
|
// leave out aliasdomain for now, cause empty = NULL value which cannot be
|
||||||
|
// added this easily using prepared statements
|
||||||
$this->_ins_stmt = Database::prepare("
|
$this->_ins_stmt = Database::prepare("
|
||||||
INSERT INTO `" . TABLE_PANEL_DOMAINS . "` SET
|
INSERT INTO `" . TABLE_PANEL_DOMAINS . "` SET
|
||||||
`domain` = :domain,
|
`domain` = :domain,
|
||||||
`adminid` = :adminid,
|
`adminid` = :adminid,
|
||||||
`customerid` = :customerid,
|
`customerid` = :customerid,
|
||||||
`documentroot` = :documentroot,
|
`documentroot` = :documentroot,
|
||||||
`aliasdomain` = :aliasdomain,
|
|
||||||
`isbinddomain` = :isbinddomain,
|
`isbinddomain` = :isbinddomain,
|
||||||
`isemaildomain` = :isemaildomain,
|
`isemaildomain` = :isemaildomain,
|
||||||
`email_only` = :email_only,
|
`email_only` = :email_only,
|
||||||
@@ -307,6 +308,7 @@ class DomainBulkAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check for alias-domain
|
// check for alias-domain
|
||||||
|
$hasAlias = false;
|
||||||
if (! empty($domain_data['aliasdomain'])) {
|
if (! empty($domain_data['aliasdomain'])) {
|
||||||
// format
|
// format
|
||||||
$domain_data['aliasdomain'] = $idna_convert->encode(preg_replace(array(
|
$domain_data['aliasdomain'] = $idna_convert->encode(preg_replace(array(
|
||||||
@@ -325,6 +327,7 @@ class DomainBulkAction
|
|||||||
// - we'd better skip
|
// - we'd better skip
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
$hasAlias = $domain_data['aliasdomain'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for use_ssl and ssl_redirect
|
// check for use_ssl and ssl_redirect
|
||||||
@@ -462,13 +465,21 @@ class DomainBulkAction
|
|||||||
$use_ssl = (bool)$domain_data['use_ssl'];
|
$use_ssl = (bool)$domain_data['use_ssl'];
|
||||||
// don't need that for the domain-insert-statement
|
// don't need that for the domain-insert-statement
|
||||||
unset($domain_data['use_ssl']);
|
unset($domain_data['use_ssl']);
|
||||||
|
// don't need alias
|
||||||
|
unset($domain_data['aliasdomain']);
|
||||||
|
|
||||||
// finally ADD the domain to panel_domains
|
// finally ADD the domain to panel_domains
|
||||||
Database::pexecute($this->_ins_stmt, $domain_data);
|
Database::pexecute($this->_ins_stmt, $domain_data);
|
||||||
|
|
||||||
// get the newly inserted domain-id
|
// get the newly inserted domain-id
|
||||||
$domain_id = Database::lastInsertId();
|
$domain_id = Database::lastInsertId();
|
||||||
|
|
||||||
|
// add alias if any
|
||||||
|
if ($hasAlias != false) {
|
||||||
|
$alias_stmt = Database::prepare("UPDATE `".TABLE_PANEL_DOMAINS."` SET `aliasdomain` = :aliasdomain WHERE `id` = :did");
|
||||||
|
Database::pexecute($alias_stmt, array('aliasdomain' => $hasAlias, 'did' => $domain_id));
|
||||||
|
}
|
||||||
|
|
||||||
// insert domain <-> ip/port reference
|
// insert domain <-> ip/port reference
|
||||||
if (empty($iplist)) {
|
if (empty($iplist)) {
|
||||||
$iplist = Settings::Get('system.ipaddress');
|
$iplist = Settings::Get('system.ipaddress');
|
||||||
|
|||||||
Reference in New Issue
Block a user