-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d50e550
commit 3d3cb8d
Showing
11 changed files
with
394 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
SubModules/ServiceInitializer/Controllers/RepairNeeded.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace ArrayAccess\TrayDigita\App\Modules\Core\SubModules\ServiceInitializer\Controllers; | ||
|
||
use ArrayAccess\TrayDigita\Http\Code; | ||
use ArrayAccess\TrayDigita\Routing\Attributes\Any; | ||
use ArrayAccess\TrayDigita\Routing\Attributes\Group; | ||
use Psr\Http\Message\ResponseInterface; | ||
use Psr\Http\Message\ServerRequestInterface; | ||
use const PHP_INT_MIN; | ||
|
||
#[Group('')] | ||
class RepairNeeded extends AbstractServiceController | ||
{ | ||
#[Any( | ||
pattern: '/assets@core/(js|css|png|svg)/([^/]+\.\1)', | ||
priority: PHP_INT_MIN + 9 | ||
)] | ||
public function renderAssets( | ||
ServerRequestInterface $request, | ||
ResponseInterface $response, | ||
array $params | ||
): ResponseInterface { | ||
return parent::renderAssets( | ||
$request, | ||
$response, | ||
$params | ||
); | ||
} | ||
|
||
#[Any( | ||
pattern: '/.*', | ||
priority: PHP_INT_MIN + 10 | ||
)] | ||
public function any( | ||
ServerRequestInterface $request, | ||
ResponseInterface $response | ||
) : ResponseInterface { | ||
return $this->render( | ||
'repair', | ||
[ | ||
'request' => $request | ||
], | ||
$response | ||
)->withStatus(Code::SERVICE_UNAVAILABLE); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
SubModules/ServiceInitializer/Controllers/Views/contents/config-install.phtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
if (!isset($this, $kernel, $translator)) { | ||
return; | ||
} | ||
|
||
use ArrayAccess\TrayDigita\Kernel\Interfaces\KernelInterface; | ||
use ArrayAccess\TrayDigita\L10n\Translations\Interfaces\TranslatorInterface; | ||
use ArrayAccess\TrayDigita\View\Engines\AbstractEngine; | ||
|
||
// phpcs:disable Generic.Files.LineLength.TooLong | ||
/** | ||
* @var AbstractEngine $this | ||
* @var array $parameters | ||
* @var KernelInterface $kernel | ||
* @var TranslatorInterface $translator | ||
*/ | ||
?> | ||
<div class="container"> | ||
<section id="install"> | ||
<h1 class="hero-title"><?= $translator->translateContext('Installation', 'installation', 'core-module');?></h1> | ||
</section> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
SubModules/ServiceInitializer/Controllers/Views/repair.phtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* @var AbstractEngine $this | ||
* @var array $parameters | ||
*/ | ||
if (!isset($this)) { | ||
return; | ||
} | ||
|
||
use ArrayAccess\TrayDigita\App\Modules\Core\Core; | ||
use ArrayAccess\TrayDigita\Module\Modules; | ||
use ArrayAccess\TrayDigita\Util\Filter\ContainerHelper; | ||
use ArrayAccess\TrayDigita\View\Engines\AbstractEngine; | ||
|
||
// phpcs:disable Generic.Files.LineLength.TooLong | ||
$core = ContainerHelper::service(Modules::class, $this->getView()->getContainer()) | ||
->get(Core::class); | ||
$entities = $core->checkEntity(); | ||
$tables = $entities['tables']; | ||
$requiredModules = array_keys(array_filter($entities['required'], static fn($e) => $e === false)); | ||
?> | ||
<!DOCTYPE html> | ||
<html class="no-js" lang="<?= htmlspecialchars($parameters['language']??$core->getTranslator()?->getLanguage()??'en');?>"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="robots" content="noindex, nofollow, noodp, noydir, noarchive"> | ||
<title><?= htmlentities($core->translateContext('Incomplete Database Schema', 'module-not-found', 'core-module'));?></title> | ||
<link rel="stylesheet" href="<?= $this->getView()->getBaseURI('assets@core/css/maintenance.css?v=1.0.0');?>" media="all"> | ||
</head> | ||
<body> | ||
<div id="page" class="page-wrapper"> | ||
<div class="container"> | ||
<h1 class="page-title">503</h1> | ||
<h3 class="page-subtitle"><?= | ||
$core->translateContext( | ||
'Database schema are incomplete', | ||
'incomplete-schema', | ||
'core-module' | ||
); | ||
?></h3> | ||
<ul class="module-list"> | ||
<?php foreach ($requiredModules as $module) {?> | ||
<li><?= basename(str_replace('\\', '/', $module));?></li> | ||
<?php } ?> | ||
|
||
</ul> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.