diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-01-15 15:38:31 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-01-15 15:38:31 +0100 |
commit | 1930c19d8214c05ceefac5ac011a6b6e7e4a983d (patch) | |
tree | 8f07ffa139c7c2e883a560ef7dbb35a76adfb8dd /web | |
parent | 790573d45899504bdecd2573c8f64018e23b139e (diff) | |
parent | 131eaa3e94ace8d75d6218e5c7c3aa58d5bb5009 (diff) | |
download | wallabag-1930c19d8214c05ceefac5ac011a6b6e7e4a983d.tar.gz wallabag-1930c19d8214c05ceefac5ac011a6b6e7e4a983d.tar.zst wallabag-1930c19d8214c05ceefac5ac011a6b6e7e4a983d.zip |
Merge pull request #1524 from wallabag/sf2.8
Upgrade to Symfony 3.0
Diffstat (limited to 'web')
-rw-r--r-- | web/.htaccess | 22 | ||||
-rw-r--r-- | web/app.php | 12 | ||||
-rw-r--r-- | web/app_dev.php | 12 | ||||
-rw-r--r-- | web/robots.txt | 4 |
4 files changed, 33 insertions, 17 deletions
diff --git a/web/.htaccess b/web/.htaccess index b52e3ae6..4dc72516 100644 --- a/web/.htaccess +++ b/web/.htaccess | |||
@@ -5,6 +5,18 @@ | |||
5 | # to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl). | 5 | # to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl). |
6 | DirectoryIndex app.php | 6 | DirectoryIndex app.php |
7 | 7 | ||
8 | # By default, Apache does not evaluate symbolic links if you did not enable this | ||
9 | # feature in your server configuration. Uncomment the following line if you | ||
10 | # install assets as symlinks or if you experience problems related to symlinks | ||
11 | # when compiling LESS/Sass/CoffeScript assets. | ||
12 | # Options FollowSymlinks | ||
13 | |||
14 | # Disabling MultiViews prevents unwanted negotiation, e.g. "/app" should not resolve | ||
15 | # to the front controller "/app.php" but be rewritten to "/app.php/app". | ||
16 | <IfModule mod_negotiation.c> | ||
17 | Options -MultiViews | ||
18 | </IfModule> | ||
19 | |||
8 | <IfModule mod_rewrite.c> | 20 | <IfModule mod_rewrite.c> |
9 | RewriteEngine On | 21 | RewriteEngine On |
10 | 22 | ||
@@ -18,9 +30,9 @@ DirectoryIndex app.php | |||
18 | RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ | 30 | RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ |
19 | RewriteRule ^(.*) - [E=BASE:%1] | 31 | RewriteRule ^(.*) - [E=BASE:%1] |
20 | 32 | ||
21 | # Sets the HTTP_AUTHORIZATION header removed by apache | 33 | # Sets the HTTP_AUTHORIZATION header removed by Apache |
22 | RewriteCond %{HTTP:Authorization} . | 34 | RewriteCond %{HTTP:Authorization} . |
23 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | 35 | RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] |
24 | 36 | ||
25 | # Redirect to URI without front controller to prevent duplicate content | 37 | # Redirect to URI without front controller to prevent duplicate content |
26 | # (with and without `/app.php`). Only do this redirect on the initial | 38 | # (with and without `/app.php`). Only do this redirect on the initial |
@@ -34,15 +46,15 @@ DirectoryIndex app.php | |||
34 | # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the | 46 | # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the |
35 | # following RewriteCond (best solution) | 47 | # following RewriteCond (best solution) |
36 | RewriteCond %{ENV:REDIRECT_STATUS} ^$ | 48 | RewriteCond %{ENV:REDIRECT_STATUS} ^$ |
37 | RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L] | 49 | RewriteRule ^app\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L] |
38 | 50 | ||
39 | # If the requested filename exists, simply serve it. | 51 | # If the requested filename exists, simply serve it. |
40 | # We only want to let Apache serve files and not directories. | 52 | # We only want to let Apache serve files and not directories. |
41 | RewriteCond %{REQUEST_FILENAME} -f | 53 | RewriteCond %{REQUEST_FILENAME} -f |
42 | RewriteRule .? - [L] | 54 | RewriteRule ^ - [L] |
43 | 55 | ||
44 | # Rewrite all other queries to the front controller. | 56 | # Rewrite all other queries to the front controller. |
45 | RewriteRule .? %{ENV:BASE}/app.php [L] | 57 | RewriteRule ^ %{ENV:BASE}/app.php [L] |
46 | </IfModule> | 58 | </IfModule> |
47 | 59 | ||
48 | <IfModule !mod_rewrite.c> | 60 | <IfModule !mod_rewrite.c> |
diff --git a/web/app.php b/web/app.php index c5c26409..5c5ee03b 100644 --- a/web/app.php +++ b/web/app.php | |||
@@ -1,23 +1,23 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | use Symfony\Component\ClassLoader\ApcClassLoader; | ||
4 | use Symfony\Component\HttpFoundation\Request; | 3 | use Symfony\Component\HttpFoundation\Request; |
5 | 4 | ||
6 | $loader = require_once __DIR__.'/../app/bootstrap.php.cache'; | 5 | /** |
6 | * @var Composer\Autoload\ClassLoader | ||
7 | */ | ||
8 | $loader = require __DIR__.'/../app/autoload.php'; | ||
9 | include_once __DIR__.'/../var/bootstrap.php.cache'; | ||
7 | 10 | ||
8 | // Enable APC for autoloading to improve performance. | 11 | // Enable APC for autoloading to improve performance. |
9 | // You should change the ApcClassLoader first argument to a unique prefix | 12 | // You should change the ApcClassLoader first argument to a unique prefix |
10 | // in order to prevent cache key conflicts with other applications | 13 | // in order to prevent cache key conflicts with other applications |
11 | // also using APC. | 14 | // also using APC. |
12 | /* | 15 | /* |
13 | $apcLoader = new ApcClassLoader(sha1(__FILE__), $loader); | 16 | $apcLoader = new Symfony\Component\ClassLoader\ApcClassLoader(sha1(__FILE__), $loader); |
14 | $loader->unregister(); | 17 | $loader->unregister(); |
15 | $apcLoader->register(true); | 18 | $apcLoader->register(true); |
16 | */ | 19 | */ |
17 | 20 | ||
18 | require_once __DIR__.'/../app/AppKernel.php'; | ||
19 | //require_once __DIR__.'/../app/AppCache.php'; | ||
20 | |||
21 | $kernel = new AppKernel('prod', false); | 21 | $kernel = new AppKernel('prod', false); |
22 | $kernel->loadClassCache(); | 22 | $kernel->loadClassCache(); |
23 | //$kernel = new AppCache($kernel); | 23 | //$kernel = new AppCache($kernel); |
diff --git a/web/app_dev.php b/web/app_dev.php index e0279c2a..8456754d 100644 --- a/web/app_dev.php +++ b/web/app_dev.php | |||
@@ -4,24 +4,26 @@ use Symfony\Component\HttpFoundation\Request; | |||
4 | use Symfony\Component\Debug\Debug; | 4 | use Symfony\Component\Debug\Debug; |
5 | 5 | ||
6 | // If you don't want to setup permissions the proper way, just uncomment the following PHP line | 6 | // If you don't want to setup permissions the proper way, just uncomment the following PHP line |
7 | // read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information | 7 | // read http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup |
8 | // for more information | ||
8 | //umask(0000); | 9 | //umask(0000); |
9 | 10 | ||
10 | // This check prevents access to debug front controllers that are deployed by accident to production servers. | 11 | // This check prevents access to debug front controllers that are deployed by accident to production servers. |
11 | // Feel free to remove this, extend it, or make something more sophisticated. | 12 | // Feel free to remove this, extend it, or make something more sophisticated. |
12 | if (isset($_SERVER['HTTP_CLIENT_IP']) | 13 | if (isset($_SERVER['HTTP_CLIENT_IP']) |
13 | || isset($_SERVER['HTTP_X_FORWARDED_FOR']) | 14 | || isset($_SERVER['HTTP_X_FORWARDED_FOR']) |
14 | || !(in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1')) || php_sapi_name() === 'cli-server') | 15 | || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server') |
15 | ) { | 16 | ) { |
16 | header('HTTP/1.0 403 Forbidden'); | 17 | header('HTTP/1.0 403 Forbidden'); |
17 | exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); | 18 | exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); |
18 | } | 19 | } |
19 | 20 | ||
20 | $loader = require_once __DIR__.'/../app/bootstrap.php.cache'; | 21 | /** |
22 | * @var Composer\Autoload\ClassLoader $loader | ||
23 | */ | ||
24 | $loader = require __DIR__.'/../app/autoload.php'; | ||
21 | Debug::enable(); | 25 | Debug::enable(); |
22 | 26 | ||
23 | require_once __DIR__.'/../app/AppKernel.php'; | ||
24 | |||
25 | $kernel = new AppKernel('dev', true); | 27 | $kernel = new AppKernel('dev', true); |
26 | $kernel->loadClassCache(); | 28 | $kernel->loadClassCache(); |
27 | $request = Request::createFromGlobals(); | 29 | $request = Request::createFromGlobals(); |
diff --git a/web/robots.txt b/web/robots.txt index 77470cb3..214e4119 100644 --- a/web/robots.txt +++ b/web/robots.txt | |||
@@ -1,2 +1,4 @@ | |||
1 | # www.robotstxt.org/ | ||
2 | # www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449 | ||
3 | |||
1 | User-agent: * | 4 | User-agent: * |
2 | Disallow: / \ No newline at end of file | ||