Fixed Saas Handling in Installer (#6221)

* Fixed Saas Handling in Installer

* Update CHANGELOG.md
This commit is contained in:
Lucas Bartholemy 2023-04-05 18:56:29 +02:00 committed by GitHub
parent 2544eb7af2
commit d7ac4071e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 49 additions and 33 deletions

View File

@ -6,7 +6,8 @@ HumHub Changelog
- Fix #6196: Use class names for default logging targets in default common config
- Fix #6202: Invite by link is not possible for a user already invited by email
- Fix #5718: Fix profile field "Country" to use js plugin Select2
- Enh #6214: Improve SoftDelete implementation
- Enh #6214: Improved SoftDelete implementation
- Fix #6221: Improved SaaS handling in installer
1.14.0-beta.2 (March 28, 2023)
------------------------------

View File

@ -41,7 +41,7 @@ class IndexController extends Controller
public function actionGo()
{
if ($this->module->checkDBConnection()) {
return $this->redirect(['setup/init']);
return $this->redirect(['setup/finalize']);
} else {
return $this->redirect(['setup/prerequisites']);
}

View File

@ -8,30 +8,28 @@
namespace humhub\modules\installer\controllers;
use humhub\commands\MigrateController;
use humhub\components\access\ControllerAccess;
use humhub\components\Controller;
use humhub\libs\DynamicConfig;
use humhub\modules\admin\widgets\PrerequisitesList;
use humhub\modules\installer\forms\CronForm;
use humhub\modules\installer\forms\DatabaseForm;
use humhub\modules\installer\Module;
use Yii;
/**
* SetupController checks prerequisites and is responsible for database
* connection and schema setup.
* SetupController checks prerequisites and is responsible for database connection and schema setup.
*
* @property Module $module
* @since 0.5
*/
class SetupController extends Controller
{
/**
* Allow guest access independently from guest mode setting.
*
* @var string
* @inheritdoc
*/
public $access = ControllerAccess::class;
const PASSWORD_PLACEHOLDER = 'n0thingToSeeHere!';
public function actionIndex()
@ -120,7 +118,8 @@ class SetupController extends Controller
DynamicConfig::save($config);
return $this->redirect(['init']);
return $this->redirect(['migrate']);
} catch (\Exception $e) {
$errorMessage = $e->getMessage();
}
@ -130,32 +129,18 @@ class SetupController extends Controller
return $this->render('database', ['model' => $model, 'errorMessage' => $errorMessage]);
}
/**
* The init action imports the database structure & initial data
*/
public function actionInit()
{
public function actionMigrate()
{
if (!$this->module->checkDBConnection()) {
return $this->redirect(['/installer/setup/database']);
return $this->redirect(['/installer/setup/database', 'dbFailed' => 1]);
}
// Flush Caches
Yii::$app->cache->flush();
// Disable max execution time to avoid timeouts during database installation
@ini_set('max_execution_time', 0);
// Migrate Up Database
\humhub\commands\MigrateController::webMigrateAll();
DynamicConfig::rewrite();
$this->module->setDatabaseInstalled();
return $this->redirect(['/installer/setup/cron']);
$this->initDatabase();
return $this->redirect(['cron']);
}
/**
* Crontab
*/
@ -171,4 +156,34 @@ class SetupController extends Controller
{
return $this->render('pretty-urls');
}
public function actionFinalize()
{
if (!$this->module->checkDBConnection()) {
return $this->redirect(['/installer/setup/database', 'dbFailed' => 1]);
}
// Start the migration a second time here to retry any migrations aborted by timeouts.
// In addition, in SaaS hosting, no setup step is required and only this action is executed directly.
$this->initDatabase();
return $this->redirect(['/installer/config']);
}
private function initDatabase()
{
// Flush Caches
Yii::$app->cache->flush();
// Disable max execution time to avoid timeouts during database installation
@ini_set('max_execution_time', 0);
// Migrate Up Database
MigrateController::webMigrateAll();
DynamicConfig::rewrite();
$this->module->setDatabaseInstalled();
}
}

View File

@ -581,7 +581,7 @@ class LdapAuth extends BaseFormAuth implements AutoSyncUsers, SyncAttributes, Ap
}
/**
* @inheridoc
* @inheritdoc
*/
public function beforeSerialize(): void
{

View File

@ -20,7 +20,7 @@ class Module extends \humhub\components\Module
public $acceptableNames = ['interface', 'administration', 'profile', 'spaces'];
/**
* @inheridoc
* @inheritdoc
*/
public $isCoreModule = true;

View File

@ -55,7 +55,7 @@ abstract class Filter extends Model
}
/**
* @inheridoc
* @inheritdoc
*/
public function load($data, $formName = null)
{