This commit is contained in:
Peter Ivanov 2024-08-27 14:43:58 +03:00
parent 6c3e9cf4cc
commit 9119906f2a

View file

@ -56,6 +56,18 @@ class DomainIsCreatedListener
$createdDatabaseHost = null;
$createdDatabasePort = null;
$databseType = 'sqlite';
$databasesAreCreated = false;
$shouldCreateMysqlDatabase = false;
$microweberSettingsFromPanel = setting('microweber');
if (isset($microweberSettingsFromPanel['database_driver']) && $microweberSettingsFromPanel['database_driver'] == 'mysql') {
$shouldCreateMysqlDatabase = true;
}
if($shouldCreateMysqlDatabase) {
try {
$databaseUserPassword = Str::password(24);
@ -79,9 +91,22 @@ class DomainIsCreatedListener
} catch (\Exception $e) {
$databasesAreCreated = false;
}
}
$installationType = 'symlink';
$installationLanguage = 'bg';
$installationLanguage = 'en';
$website_manager_url = 'https://microweber.com';
//$installationTemplate = 'default';
if (isset($microweberSettingsFromPanel['default_installation_type']) && $microweberSettingsFromPanel['default_installation_type'] == 'standalone') {
$installationType = 'standalone';
}
if (isset($microweberSettingsFromPanel['website_manager_url']) && $microweberSettingsFromPanel['website_manager_url']) {
$website_manager_url = $microweberSettingsFromPanel['website_manager_url'];
}
// dd(setting('microweber'));
$install = new \MicroweberPackages\SharedServerScripts\MicroweberInstaller();
$install->setChownUser($findDomain->domain_username);
@ -93,7 +118,12 @@ class DomainIsCreatedListener
$install->setLanguage($installationLanguage);
//$install->setStandaloneInstallation();
if($installationType == 'symlink') {
$install->setSymlinkInstallation();
} else {
$install->setStandaloneInstallation();
}
if ($databasesAreCreated) {
$install->setDatabaseDriver('mysql');
@ -114,7 +144,7 @@ class DomainIsCreatedListener
if (isset($status['success']) && $status['success']) {
$whiteLabelSettings = [];
$whiteLabelSettings['website_manager_url'] = 'https://microweber.com';
$whiteLabelSettings['website_manager_url'] = $website_manager_url;
$whitelabel = new MicroweberWhitelabelSettingsUpdater();
$whitelabel->setPath($findDomain->domain_public);