From 5e162b018dafe79e8ab4a0191ec07244f8eded36 Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Thu, 17 Jun 2010 11:32:14 +0000 Subject: [PATCH] - nicer and safer way of determine the customer-id out of the aps-database name --- install/updates/froxlor/0.9/update_0.9.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php index 3ee201c4..197d5f1f 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -853,9 +853,9 @@ if(isFroxlorVersion('0.9.10-svn1')) $result = $db_root->query("SHOW DATABASES;"); 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'; $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 . '"');