From b40c908bda64364f31ce5d5821a3f1ac809b9ba8 Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Wed, 15 May 2024 02:18:20 +0300 Subject: [PATCH] update --- .../Listeners/DomainIsCreatedListener.php | 46 +++++++++---------- web/tests/Unit/MWHSCreateTest.php | 2 + 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/web/Modules/Microweber/Listeners/DomainIsCreatedListener.php b/web/Modules/Microweber/Listeners/DomainIsCreatedListener.php index f6943b1..e393133 100644 --- a/web/Modules/Microweber/Listeners/DomainIsCreatedListener.php +++ b/web/Modules/Microweber/Listeners/DomainIsCreatedListener.php @@ -56,29 +56,29 @@ class DomainIsCreatedListener $createdDatabaseHost = null; $createdDatabasePort = null; -// try { -// -// $databaseUserPassword = Str::password(24); -// $databaseName = $databaseUsername = 'mw'.time(); -// -// $hss = new HostingSubscriptionService($findDomain->hosting_subscription_id); -// $createDatabase = $hss->createDatabase($databaseName); -// if (isset($createDatabase['data']['database_name'])) { -// $createdDatabaseName = $createDatabase['data']['database_name']; -// } -// $createDatabaseUser = $hss->createDatabaseUser($createDatabase['data']['database_id'], $databaseUsername,$databaseUserPassword); -// if (isset($createDatabaseUser['data']['database_user'])) { -// $createdDatabaseUsername = $createDatabaseUser['data']['database_user']; -// $createdDatabaseUserPassword = $createDatabaseUser['data']['database_password']; -// $createdDatabaseHost = $createDatabase['data']['database_host']; -// $createdDatabasePort = $createDatabase['data']['database_port']; -// } -// -// $databasesAreCreated = true; -// -// } catch (\Exception $e) { -// $databasesAreCreated = false; -// } + try { + + $databaseUserPassword = Str::password(24); + $databaseName = $databaseUsername = 'mw'.time(); + + $hss = new HostingSubscriptionService($findDomain->hosting_subscription_id); + $createDatabase = $hss->createDatabase($databaseName); + if (isset($createDatabase['data']['database_name'])) { + $createdDatabaseName = $createDatabase['data']['database_name']; + } + $createDatabaseUser = $hss->createDatabaseUser($createDatabase['data']['database_id'], $databaseUsername,$databaseUserPassword); + if (isset($createDatabaseUser['data']['database_user'])) { + $createdDatabaseUsername = $createDatabaseUser['data']['database_user']; + $createdDatabaseUserPassword = $createDatabaseUser['data']['database_password']; + $createdDatabaseHost = $createDatabase['data']['database_host']; + $createdDatabasePort = $createDatabase['data']['database_port']; + } + + $databasesAreCreated = true; + + } catch (\Exception $e) { + $databasesAreCreated = false; + } $installationType = 'symlink'; $installationLanguage = 'bg'; diff --git a/web/tests/Unit/MWHSCreateTest.php b/web/tests/Unit/MWHSCreateTest.php index 13098e6..611bd7e 100644 --- a/web/tests/Unit/MWHSCreateTest.php +++ b/web/tests/Unit/MWHSCreateTest.php @@ -72,6 +72,8 @@ class MWHSCreateTest extends ActionTestCase $this->assertIsInt($callCustomerStoreResponse['data']['customer']['id']); $customerId = $callCustomerStoreResponse['data']['customer']['id']; + // TODO + return; $hostingSubscriptionDomain = 'phyre-unit-test-microweber-'.rand(1000, 9999).'.com'; $callHostingSubscriptionStoreResponse = $this->callApiAuthorizedRouteAction('api.hosting-subscriptions.store',[