Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Mar 19, 2024
1 parent c73d4a5 commit a76711e
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 72 deletions.
123 changes: 52 additions & 71 deletions plib/controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,14 @@ public function installAction()
return $this->_redirect('index/index');
}

$requestParams = $this->getRequest()->getParams();

if (isset($requestParams['dom_id'])
&& isset($requestParams['site_id'])) {

return;
}

/*
$this->view->selinuxError = false;
$this->view->activateSymlinking = false;
Expand Down Expand Up @@ -683,83 +691,56 @@ public function installAction()
}
}

if (!$this->devMode) {
// Save pending installation
$installationDomainPath = $domain->getName();
$installationDirPath = $domain->getDocumentRoot();
$installationType = 'Standalone';
if (!empty($post['installation_folder'])) {
$installationDirPath = $domain->getDocumentRoot() . '/' . $post['installation_folder'];
$installationDomainPath = $domain->getName() . '/' . $post['installation_folder'];
}
if ($post['installation_type'] == 'symlink') {
$installationType = 'Symlinked';
}

// Save pending installation
$installationDomainPath = $domain->getName();
$installationDirPath = $domain->getDocumentRoot();
$installationType = 'Standalone';
if (!empty($post['installation_folder'])) {
$installationDirPath = $domain->getDocumentRoot() . '/' . $post['installation_folder'];
$installationDomainPath = $domain->getName() . '/' . $post['installation_folder'];
}
if ($post['installation_type'] == 'symlink') {
$installationType = 'Symlinked';
}
Modules_Microweber_Domain::addAppInstallation($domain, [
'domainNameUrl' => $installationDomainPath,
'domainCreation' => $domain->getProperty('cr_date'),
'installationType' => $installationType,
'appVersion' => '-',
'appInstallation' => $installationDirPath,
'domainIsActive' => true,
'manageDomainUrl' => '',
'pending' => true,
'created_at' => date('Y-m-d H:i:s'),
]);

Modules_Microweber_Domain::addAppInstallation($domain, [
'domainNameUrl' => $installationDomainPath,
'domainCreation' => $domain->getProperty('cr_date'),
'installationType' => $installationType,
'appVersion' => '-',
'appInstallation' => $installationDirPath,
'domainIsActive' => true,
'manageDomainUrl' => '',
'pending' => true,
'created_at' => date('Y-m-d H:i:s'),
]);
pm_Settings::set('mw_installations_count', (Modules_Microweber_LicenseData::getAppInstallationsCount() + 1));


$task = new Modules_Microweber_Task_DomainAppInstall();
$task->setParam('domainId', $domain->getId());
$task->setParam('domainName', $domain->getName());
$task->setParam('domainDisplayName', $domain->getDisplayName());
$task->setParam('type', $post['installation_type']);
$task->setParam('databaseDriver', $post['installation_database_driver']);
//$task->setParam('databaseServerId', $post['installation_database_server_id']);
$task->setParam('path', $post['installation_folder']);
$task->setParam('template', $post['installation_template']);
$task->setParam('language', $post['installation_language']);
$task->setParam('email', $post['installation_email']);
$task->setParam('username', $post['installation_username']);
$task->setParam('password', $post['installation_password']);

if (pm_Session::getClient()->isAdmin()) {
// Run global
$this->taskManager->start($task, NULL);
} else {
// Run for domain
$this->taskManager->start($task, $domain);
}
pm_Settings::set('mw_installations_count', (Modules_Microweber_LicenseData::getAppInstallationsCount() + 1));

$task = new Modules_Microweber_Task_DomainAppInstall();
$task->setParam('domainId', $domain->getId());
$task->setParam('domainName', $domain->getName());
$task->setParam('domainDisplayName', $domain->getDisplayName());
$task->setParam('type', $post['installation_type']);
$task->setParam('databaseDriver', $post['installation_database_driver']);
//$task->setParam('databaseServerId', $post['installation_database_server_id']);
$task->setParam('path', $post['installation_folder']);
$task->setParam('template', $post['installation_template']);
$task->setParam('language', $post['installation_language']);
$task->setParam('email', $post['installation_email']);
$task->setParam('username', $post['installation_username']);
$task->setParam('password', $post['installation_password']);

$this->_helper->json(['redirect' => pm_Context::getBaseUrl() . 'index.php/index/index']);
if (pm_Session::getClient()->isAdmin()) {
// Run global
$this->taskManager->start($task, NULL);
} else {

$newInstallation = new Modules_Microweber_Install();
$newInstallation->setDomainId($post['installation_domain']);
$newInstallation->setType($post['installation_type']);
$newInstallation->setDatabaseDriver($post['installation_database_driver']);
//$newInstallation->setDatabaseServerId($post['installation_database_server_id']);
$newInstallation->setPath($post['installation_folder']);
$newInstallation->setTemplate($post['installation_template']);
$newInstallation->setLanguage($post['installation_language']);

if (!empty($post['installation_email'])) {
$newInstallation->setEmail($post['installation_email']);
}

if (!empty($post['installation_username'])) {
$newInstallation->setUsername($post['installation_username']);
}

if (!empty($post['installation_password'])) {
$newInstallation->setPassword($post['installation_password']);
}

return $newInstallation->run();
// Run for domain
$this->taskManager->start($task, $domain);
}

$this->_helper->json(['redirect' => pm_Context::getBaseUrl() . 'index.php/index/index']);

}

$this->view->form = $form;
Expand Down
1 change: 0 additions & 1 deletion plib/library/BasepluginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

abstract class Modules_Microweber_BasepluginController extends pm_Controller_Action {

protected $devMode = false;
protected $taskManager = NULL;
protected $_moduleName = 'Microweber';

Expand Down

0 comments on commit a76711e

Please sign in to comment.