1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 21:27:25 +02:00

cPanelDeployer will no longer delete all databases

Parsing bug deleted all MariaDB users and databases that were not in the
active tests list.  Now, cPanelDeployer will only delete the MariaDB
users and databases that are expired and leave those that are not part
of the testing suite alone.
This commit is contained in:
Deltik
2018-02-23 16:13:56 -06:00
parent 986b4a63ba
commit abc4012a42

View File

@@ -289,11 +289,13 @@ class cPanelDeployer
private static function prune_mysql_databases($dbs, $ids, $cPanel)
{
$prefix = $cPanel->user."_".self::TEST_PREFIX;
foreach ($dbs as $db)
{
$db = (array) $db;
$offset = strpos($db['db'], self::TEST_PREFIX);
$questionable_db = substr($db['db'], $offset);
if (substr($db['db'], 0, strlen($prefix)) !== $prefix)
continue;
$questionable_db = substr($db['db'], strlen($prefix));
if (!in_array($questionable_db, $ids))
{
self::println("Deleting expired MySQL database \"".$db['db']."\"");
@@ -304,11 +306,13 @@ class cPanelDeployer
private static function prune_mysql_users($users, $ids, $cPanel)
{
$prefix = $cPanel->user."_".self::TEST_PREFIX;
foreach ($users as $user)
{
$user = (array) $user;
$offset = strpos($user['user'], self::TEST_PREFIX);
$questionable_user = substr($user['user'], $offset);
if (substr($user['user'], 0, strlen($prefix)) !== $prefix)
continue;
$questionable_user = substr($user['user'], strlen($prefix));
if (!in_array($questionable_user, $ids))
{
self::println("Deleting expired MySQL user \"".$user['user']."\"");