From aff951e9d6276f2a88ea4c4db245e026113024bb Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Thu, 10 Oct 2024 14:10:47 +0300 Subject: [PATCH] Update DomainIsCreatedListener.php --- .../Listeners/DomainIsCreatedListener.php | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/web/Modules/Microweber/Listeners/DomainIsCreatedListener.php b/web/Modules/Microweber/Listeners/DomainIsCreatedListener.php index f869eb6..3eb28e9 100644 --- a/web/Modules/Microweber/Listeners/DomainIsCreatedListener.php +++ b/web/Modules/Microweber/Listeners/DomainIsCreatedListener.php @@ -11,6 +11,7 @@ use App\Models\HostingSubscription; use App\Services\HostingSubscriptionService; use Illuminate\Support\Str; use MicroweberPackages\SharedServerScripts\MicroweberWhitelabelSettingsUpdater; +use MicroweberPackages\SharedServerScripts\MicroweberWhitelabelWebsiteApply; use Modules\Microweber\App\Models\MicroweberInstallation; class DomainIsCreatedListener @@ -143,12 +144,22 @@ class DomainIsCreatedListener if (isset($status['success']) && $status['success']) { - $whiteLabelSettings = []; - $whiteLabelSettings['website_manager_url'] = $website_manager_url; + $sharedAppPath = config('microweber.sharedPaths.app'); +// $whitelabelSettings = setting('microweber.whitelabel'); +// $whitelabelSettings['website_manager_url'] = setting('microweber.website_manager_url'); +// +// $whitelabel = new MicroweberWhitelabelSettingsUpdater(); +// $whitelabel->setPath($sharedAppPath); +// $whitelabel->apply($whitelabelSettings); - $whitelabel = new MicroweberWhitelabelSettingsUpdater(); - $whitelabel->setPath($findDomain->domain_public); - $whitelabel->apply($whiteLabelSettings); + try { + $whitelabelApply = new MicroweberWhitelabelWebsiteApply(); + $whitelabelApply->setWebPath($findDomain->domain_public); + $whitelabelApply->setSharedPath($sharedAppPath); + $whitelabelApply->apply(); + } catch (\Exception $e) { + // \Log::error('Error applying whitelabel to website: ' . $mwInstallation->installation_path); + } $findInstallation = MicroweberInstallation::where('installation_path', $findDomain->domain_public) ->where('domain_id', $findDomain->id)