/
settings.php
40 lines (32 loc) · 1.03 KB
/
settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace Concrete\Controller\SinglePage\Dashboard\System\Multisite;
use Concrete\Core\Page\Controller\DashboardPageController;
use Concrete\Core\Site\InstallationService;
class Settings extends DashboardPageController
{
public function view()
{
$this->set('service', $this->app->make(InstallationService::class));
}
public function multisite_required()
{
return $this->view();
}
public function enable_multisite()
{
if (!$this->token->validate('enable_multisite')) {
$this->error->add($this->token->getErrorMessage());
}
$service = $this->app->make(InstallationService::class);
$error = $service->validateEnvironment();
if ($error->has()) {
$this->error->add($error);
}
if (!$this->error->has()) {
$service->enableMultisite();
$this->flash('success', t('Multiple sites enabled.'));
return $this->buildRedirect($this->action());
}
return $this->view();
}
}