Skip to content

Commit

Permalink
Switch "web" directory to "public"
Browse files Browse the repository at this point in the history
  • Loading branch information
pamil committed Aug 15, 2018
1 parent 2760de2 commit 9d11932
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 191 deletions.
4 changes: 2 additions & 2 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import yargs from 'yargs';
const { argv } = yargs
.options({
rootPath: {
description: '<path> path to web assets directory',
description: '<path> path to public assets directory',
type: 'string',
requiresArg: true,
required: false,
Expand All @@ -20,7 +20,7 @@ const { argv } = yargs

const config = [
'--rootPath',
argv.rootPath || '../../../../web/assets',
argv.rootPath || '../../../../public/assets',
'--nodeModulesPath',
argv.nodeModulesPath || '../../../../node_modules',
];
Expand Down
8 changes: 4 additions & 4 deletions web/.htaccess → public/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ DirectoryIndex app.php

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]

RewriteRule .? %{ENV:BASE}/app.php [L]
RewriteRule .? %{ENV:BASE}/index.php [L]
</IfModule>

<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /app.php/
RedirectMatch 302 ^/$ /index.php/
</IfModule>
</IfModule>
File renamed without changes.
39 changes: 39 additions & 0 deletions public/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

use App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\HttpFoundation\Request;

require __DIR__.'/../vendor/autoload.php';

// The check is to ensure we don't use .env in production
if (!isset($_SERVER['APP_ENV'])) {
if (!class_exists(Dotenv::class)) {
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
}
(new Dotenv())->load(__DIR__.'/../.env');
}

$env = $_SERVER['APP_ENV'] ?? 'dev';
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env));

if ($debug) {
umask(0000);

Debug::enable();
}

if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}

if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts(explode(',', $trustedHosts));
}

$kernel = new Kernel($env, $debug);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
File renamed without changes.
30 changes: 0 additions & 30 deletions web/app.php

This file was deleted.

46 changes: 0 additions & 46 deletions web/app_dev.php

This file was deleted.

30 changes: 0 additions & 30 deletions web/app_staging.php

This file was deleted.

41 changes: 0 additions & 41 deletions web/app_test.php

This file was deleted.

38 changes: 0 additions & 38 deletions web/app_test_cached.php

This file was deleted.

0 comments on commit 9d11932

Please sign in to comment.