mirror of
https://github.com/humhub/humhub.git
synced 2025-03-14 20:19:47 +01:00
Force or Forbid installer depending on app state
This commit is contained in:
parent
84218845f6
commit
6f59e05393
@ -17,4 +17,4 @@ Yii::setAlias('@webroot', __DIR__);
|
||||
Yii::setAlias('@app', __DIR__ . DIRECTORY_SEPARATOR . 'protected');
|
||||
Yii::setAlias('@humhub', '@app/humhub');
|
||||
|
||||
(new yii\web\Application($config))->run();
|
||||
(new humhub\components\Application($config))->run();
|
||||
|
35
protected/humhub/components/Application.php
Normal file
35
protected/humhub/components/Application.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @link https://www.humhub.org/
|
||||
* @copyright Copyright (c) 2015 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*/
|
||||
|
||||
namespace humhub\components;
|
||||
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
* Base WebApplication
|
||||
*
|
||||
* @author luke
|
||||
*/
|
||||
class Application extends \yii\web\Application
|
||||
{
|
||||
|
||||
public function beforeAction($action)
|
||||
{
|
||||
|
||||
/**
|
||||
* Check if it's already installed - if not force controller module
|
||||
*/
|
||||
if (!$this->params['installed'] && $this->controller->module != null && $this->controller->module->id != 'installer') {
|
||||
$this->controller->redirect(\yii\helpers\Url::to(['/installer/index']));
|
||||
return false;
|
||||
}
|
||||
|
||||
return parent::beforeAction($action);
|
||||
}
|
||||
|
||||
}
|
@ -38,6 +38,15 @@ class Module extends \yii\base\Module
|
||||
$this->layout = '@humhub/core/installer/views/layouts/main.php';
|
||||
}
|
||||
|
||||
public function beforeAction($action)
|
||||
{
|
||||
if (Yii::$app->params['installed']) {
|
||||
throw new \yii\web\HttpException(500, 'HumHub is already installed!');
|
||||
}
|
||||
|
||||
return parent::beforeAction($action);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if database connections works
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user