diff --git a/.gitignore b/.gitignore index f88370d78..b6d6aa5d5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,25 +1,20 @@ -# Cache and logs (Symfony2) -/app/cache/* -/app/logs/* -!app/cache/.gitkeep -!app/logs/.gitkeep - -# Cache and logs (Symfony3) +# Cache, logs & sessions +/var/* +!/var/cache /var/cache/* -/var/logs/* !var/cache/.gitkeep +!/var/logs +/var/logs/* !var/logs/.gitkeep +!/var/sessions +/var/sessions/* +!var/sessions/.gitkeep +!var/SymfonyRequirements.php # Parameters /app/config/parameters.yml -/app/config/parameters.ini # Managed by Composer -/app/bootstrap.php.cache -/var/bootstrap.php.cache -/bin/* -!bin/console -!bin/symfony_requirements /vendor/ # Assets and user uploads diff --git a/app/AppKernel.php b/app/AppKernel.php index d97842f90..7e76a9e90 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -7,7 +7,7 @@ class AppKernel extends Kernel { public function registerBundles() { - $bundles = array( + $bundles = [ new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), @@ -33,9 +33,9 @@ class AppKernel extends Kernel new KPhoen\RulerZBundle\KPhoenRulerZBundle(), new Wallabag\ImportBundle\WallabagImportBundle(), new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), - ); + ]; - if (in_array($this->getEnvironment(), array('dev', 'test'), true)) { + if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); @@ -46,6 +46,21 @@ class AppKernel extends Kernel return $bundles; } + public function getRootDir() + { + return __DIR__; + } + + public function getCacheDir() + { + return dirname(__DIR__).'/var/cache/'.$this->getEnvironment(); + } + + public function getLogDir() + { + return dirname(__DIR__).'/var/logs'; + } + public function registerContainerConfiguration(LoaderInterface $loader) { $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml'); diff --git a/app/autoload.php b/app/autoload.php index 70526bb5e..fa582ecd0 100644 --- a/app/autoload.php +++ b/app/autoload.php @@ -8,6 +8,6 @@ use Composer\Autoload\ClassLoader; */ $loader = require __DIR__.'/../vendor/autoload.php'; -AnnotationRegistry::registerLoader(array($loader, 'loadClass')); +AnnotationRegistry::registerLoader([$loader, 'loadClass']); return $loader; diff --git a/app/config/config.yml b/app/config/config.yml index 5fac31929..133fc12fe 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -21,7 +21,8 @@ framework: trusted_proxies: ~ session: # handler_id set to null will use default session handler from php.ini - handler_id: ~ + handler_id: session.handler.native_file + save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%" fragments: ~ http_method_override: true diff --git a/app/config/config_dev.yml b/app/config/config_dev.yml index 116dd0d5b..6b077fdbd 100644 --- a/app/config/config_dev.yml +++ b/app/config/config_dev.yml @@ -17,13 +17,14 @@ monolog: type: stream path: "%kernel.logs_dir%/%kernel.environment%.log" level: debug + channels: [!event] console: type: console bubble: false verbosity_levels: VERBOSITY_VERBOSE: INFO VERBOSITY_VERY_VERBOSE: DEBUG - channels: ["!doctrine"] + channels: [!event, !doctrine] console_very_verbose: type: console bubble: false @@ -31,7 +32,7 @@ monolog: VERBOSITY_VERBOSE: NOTICE VERBOSITY_VERY_VERBOSE: NOTICE VERBOSITY_DEBUG: DEBUG - channels: ["doctrine"] + channels: [doctrine] assetic: use_controller: true diff --git a/app/console b/bin/console old mode 100755 new mode 100644 similarity index 78% rename from app/console rename to bin/console index 3b4c367c9..49247c94d --- a/app/console +++ b/bin/console @@ -14,11 +14,11 @@ set_time_limit(0); /** * @var Composer\Autoload\ClassLoader $loader */ -$loader = require __DIR__.'/autoload.php'; +$loader = require __DIR__.'/../app/autoload.php'; $input = new ArgvInput(); -$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev'); -$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod'; +$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev'); +$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod'; if ($debug) { Debug::enable(); diff --git a/bin/doctrine b/bin/doctrine new file mode 120000 index 000000000..0f72e36f9 --- /dev/null +++ b/bin/doctrine @@ -0,0 +1 @@ +../vendor/doctrine/orm/bin/doctrine \ No newline at end of file diff --git a/bin/doctrine-dbal b/bin/doctrine-dbal new file mode 120000 index 000000000..110e93c53 --- /dev/null +++ b/bin/doctrine-dbal @@ -0,0 +1 @@ +../vendor/doctrine/dbal/bin/doctrine-dbal \ No newline at end of file diff --git a/bin/doctrine-migrations b/bin/doctrine-migrations new file mode 120000 index 000000000..7184da719 --- /dev/null +++ b/bin/doctrine-migrations @@ -0,0 +1 @@ +../vendor/doctrine/migrations/bin/doctrine-migrations \ No newline at end of file diff --git a/bin/doctrine.php b/bin/doctrine.php new file mode 120000 index 000000000..b22b74da5 --- /dev/null +++ b/bin/doctrine.php @@ -0,0 +1 @@ +../vendor/doctrine/orm/bin/doctrine.php \ No newline at end of file diff --git a/bin/poche.sqlite b/bin/poche.sqlite deleted file mode 100644 index f2b79b68f..000000000 Binary files a/bin/poche.sqlite and /dev/null differ diff --git a/bin/security-checker b/bin/security-checker new file mode 120000 index 000000000..85f6e8ed6 --- /dev/null +++ b/bin/security-checker @@ -0,0 +1 @@ +../vendor/sensiolabs/security-checker/security-checker \ No newline at end of file diff --git a/app/check.php b/bin/symfony_requirements similarity index 97% rename from app/check.php rename to bin/symfony_requirements index 282507f70..1eca6719c 100644 --- a/app/check.php +++ b/bin/symfony_requirements @@ -1,6 +1,7 @@ +#!/usr/bin/env php + Options -MultiViews + + RewriteEngine On @@ -18,9 +30,9 @@ DirectoryIndex app.php RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ RewriteRule ^(.*) - [E=BASE:%1] - # Sets the HTTP_AUTHORIZATION header removed by apache + # Sets the HTTP_AUTHORIZATION header removed by Apache RewriteCond %{HTTP:Authorization} . - RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] + RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # Redirect to URI without front controller to prevent duplicate content # (with and without `/app.php`). Only do this redirect on the initial @@ -34,15 +46,15 @@ DirectoryIndex app.php # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the # following RewriteCond (best solution) RewriteCond %{ENV:REDIRECT_STATUS} ^$ - RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L] + RewriteRule ^app\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L] # If the requested filename exists, simply serve it. # We only want to let Apache serve files and not directories. RewriteCond %{REQUEST_FILENAME} -f - RewriteRule .? - [L] + RewriteRule ^ - [L] # Rewrite all other queries to the front controller. - RewriteRule .? %{ENV:BASE}/app.php [L] + RewriteRule ^ %{ENV:BASE}/app.php [L] diff --git a/web/app.php b/web/app.php index cc2fefb55..5c5ee03be 100644 --- a/web/app.php +++ b/web/app.php @@ -6,7 +6,7 @@ use Symfony\Component\HttpFoundation\Request; * @var Composer\Autoload\ClassLoader */ $loader = require __DIR__.'/../app/autoload.php'; -include_once __DIR__.'/../app/bootstrap.php.cache'; +include_once __DIR__.'/../var/bootstrap.php.cache'; // Enable APC for autoloading to improve performance. // You should change the ApcClassLoader first argument to a unique prefix diff --git a/web/app_dev.php b/web/app_dev.php index 635bf7ac7..8456754d5 100644 --- a/web/app_dev.php +++ b/web/app_dev.php @@ -12,7 +12,7 @@ use Symfony\Component\Debug\Debug; // Feel free to remove this, extend it, or make something more sophisticated. if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) - || !(in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1')) || php_sapi_name() === 'cli-server') + || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server') ) { header('HTTP/1.0 403 Forbidden'); exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); diff --git a/web/robots.txt b/web/robots.txt index 77470cb39..214e41196 100644 --- a/web/robots.txt +++ b/web/robots.txt @@ -1,2 +1,4 @@ +# www.robotstxt.org/ +# www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449 + User-agent: * -Disallow: / \ No newline at end of file