-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hierbij is ook de manier waarop de app geladen wordt veranderd, configuratie.include.php wordt op dit moment niet geladen TODO: We moeten deze hele logica veranderen om een beetje overeen te komen met best practices.
- Loading branch information
1 parent
50c39ba
commit 2bdab24
Showing
9 changed files
with
162 additions
and
121 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
http: | ||
document_root: htdocs/ | ||
passthru: index.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 |
---|---|---|
@@ -1,48 +1,22 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
use CsrDelft\common\ContainerFacade; | ||
use CsrDelft\Kernel; | ||
use Symfony\Bundle\FrameworkBundle\Console\Application; | ||
use Symfony\Component\Console\Input\ArgvInput; | ||
use Symfony\Component\ErrorHandler\Debug; | ||
|
||
if (false === in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) { | ||
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.\PHP_SAPI.' SAPI'.\PHP_EOL; | ||
if (!is_dir(dirname(__DIR__).'/vendor')) { | ||
throw new LogicException('Dependencies are missing. Try running "composer install".'); | ||
} | ||
|
||
set_time_limit(0); | ||
|
||
require dirname(__DIR__).'/vendor/autoload.php'; | ||
|
||
if (!class_exists(Application::class)) { | ||
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.'); | ||
} | ||
|
||
$input = new ArgvInput(); | ||
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) { | ||
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); | ||
} | ||
|
||
if ($input->hasParameterOption('--no-debug', true)) { | ||
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); | ||
if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) { | ||
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".'); | ||
} | ||
|
||
require __DIR__ . '/../config/bootstrap.php'; | ||
|
||
$kernel = new Kernel($_SERVER['APP_ENV'], (bool)$_SERVER['APP_DEBUG']); | ||
$kernel->boot(); | ||
$container = $kernel->getContainer(); | ||
|
||
ContainerFacade::init($container); | ||
require_once dirname(__DIR__).'/lib/defines.include.php'; | ||
require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; | ||
|
||
if ($_SERVER['APP_DEBUG']) { | ||
umask(0000); | ||
|
||
if (class_exists(Debug::class)) { | ||
Debug::enable(); | ||
} | ||
} | ||
return function (array $context) { | ||
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); | ||
|
||
$application = new Application($kernel); | ||
$application->run($input); | ||
return new Application($kernel); | ||
}; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,33 +1,37 @@ | ||
<?php | ||
|
||
use CsrDelft\Kernel; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\ErrorHandler\Debug; | ||
|
||
/** | ||
* Ga niet verder als de stek in onderhoudsmodus staat. | ||
*/ | ||
if (file_exists(__DIR__ . '/../.onderhoud')) { | ||
http_response_code(503); | ||
echo <<<'HTML' | ||
<!doctype html> | ||
<html lang=nl> | ||
<title>C.S.R. Delft - Onderhoud</title> | ||
<meta charset=utf-8> | ||
<meta name=viewport content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="refresh" content="5"> | ||
<!DOCTYPE HTML> | ||
<html lang="nl"> | ||
<head> | ||
<title>C.S.R. Delft - Onderhoud</title> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="refresh" content="5"> | ||
</head> | ||
<body style="font-family: sans-serif; text-align: center;"> | ||
<h1>Onderhoud</h1> | ||
<p>De website is momenteel in onderhoud. Dit duurt meestal niet lang.</p> | ||
<img alt="Beeldmerk van de Vereniging" src="/plaetjes/layout-extern/Logo.svg" width="200"> | ||
<h1>Onderhoud</h1> | ||
<p>De website is momenteel in onderhoud. Dit duurt meestal niet lang.</p> | ||
<img alt="Beeldmerk van de Vereniging" src="/images/c.s.r.logo.svg" width="200"> | ||
</body> | ||
HTML; | ||
exit; | ||
} | ||
|
||
/** @var Kernel $kernel */ | ||
$kernel = require dirname(__DIR__) . '/lib/configuratie.include.php'; | ||
require_once dirname(__DIR__).'/lib/defines.include.php'; | ||
require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; | ||
|
||
$request = Request::createFromGlobals(); | ||
$response = $kernel->handle($request); | ||
$response->send(); | ||
$kernel->terminate($request, $response); | ||
return function (array $context) { | ||
if ($context['APP_DEBUG']) { | ||
Debug::enable(); | ||
} | ||
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); | ||
}; |
Oops, something went wrong.