- nicer and safer way of determine the customer-id out of the aps-database name
This commit is contained in:
@@ -853,9 +853,9 @@ if(isFroxlorVersion('0.9.10-svn1'))
|
|||||||
$result = $db_root->query("SHOW DATABASES;");
|
$result = $db_root->query("SHOW DATABASES;");
|
||||||
while($row = $db_root->fetch_array($result))
|
while($row = $db_root->fetch_array($result))
|
||||||
{
|
{
|
||||||
if(preg_match('/^web([0-9]+)aps([0-9]+)$/', $row['Database']))
|
if(preg_match('/^web([0-9]+)aps([0-9]+)$/', $row['Database'], $matches))
|
||||||
{
|
{
|
||||||
$cid = substr($row['Database'], 3, strpos($row['Database'], 'aps')- 3);
|
$cid = $matches[1];
|
||||||
$databasedescription = 'APS DB';
|
$databasedescription = 'APS DB';
|
||||||
$result = $db->query('INSERT INTO `' . TABLE_PANEL_DATABASES . '` (`customerid`, `databasename`, `description`, `dbserver`, `apsdb`) VALUES ("' . (int)$cid . '", "' . $db->escape($row['Database']) . '", "' . $db->escape($databasedescription) . '", "0", "1")');
|
$result = $db->query('INSERT INTO `' . TABLE_PANEL_DATABASES . '` (`customerid`, `databasename`, `description`, `dbserver`, `apsdb`) VALUES ("' . (int)$cid . '", "' . $db->escape($row['Database']) . '", "' . $db->escape($databasedescription) . '", "0", "1")');
|
||||||
$result = $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`+1 WHERE `customerid`="' . (int)$cid . '"');
|
$result = $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`+1 WHERE `customerid`="' . (int)$cid . '"');
|
||||||
|
|||||||
Reference in New Issue
Block a user