]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Switch to Symfony 3 structure
authorJeremy Benoist <jeremy.benoist@gmail.com>
Thu, 14 Jan 2016 17:15:07 +0000 (18:15 +0100)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Fri, 15 Jan 2016 08:35:39 +0000 (09:35 +0100)
21 files changed:
.gitignore
app/AppKernel.php
app/autoload.php
app/config/config.yml
app/config/config_dev.yml
bin/console [moved from app/console with 78% similarity, mode: 0644]
bin/doctrine [new symlink]
bin/doctrine-dbal [new symlink]
bin/doctrine-migrations [new symlink]
bin/doctrine.php [new symlink]
bin/poche.sqlite [deleted file]
bin/security-checker [new symlink]
bin/symfony_requirements [moved from app/check.php with 97% similarity]
var/SymfonyRequirements.php [moved from app/SymfonyRequirements.php with 100% similarity]
var/cache/.gitkeep [moved from app/logs/.gitkeep with 100% similarity]
var/logs/.gitkeep [new file with mode: 0644]
var/sessions/.gitkeep [new file with mode: 0644]
web/.htaccess
web/app.php
web/app_dev.php
web/robots.txt

index f88370d78d5e7f65bb4f0449054cffab45d9bc86..b6d6aa5d568f2cce10d5d206ccf2d8778280756a 100644 (file)
@@ -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
index d97842f9034d45505008e975ab42dc3e915ff3ee..7e76a9e9053dc1ba6f12537b5a96207e7bb44807 100644 (file)
@@ -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');
index 70526bb5e4aa1f812fdcd3f4fc94b9f89b365656..fa582ecd03cb978c1f1ffa0bde9632c310db5d64 100644 (file)
@@ -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;
index 5fac31929408297b3c05d2cf3df29106f00cabf4..133fc12fe6109a41b111a13c2cdaaaf37e941400 100644 (file)
@@ -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
 
index 116dd0d5b31c47b1d969ff43fa376f1fa3591964..6b077fdbd2245f54885c118f8f28ceec4ad28cef 100644 (file)
@@ -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
old mode 100755 (executable)
new mode 100644 (file)
similarity index 78%
rename from app/console
rename to bin/console
index 3b4c367..49247c9
@@ -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 (symlink)
index 0000000..0f72e36
--- /dev/null
@@ -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 (symlink)
index 0000000..110e93c
--- /dev/null
@@ -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 (symlink)
index 0000000..7184da7
--- /dev/null
@@ -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 (symlink)
index 0000000..b22b74d
--- /dev/null
@@ -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 (file)
index f2b79b6..0000000
Binary files a/bin/poche.sqlite and /dev/null differ
diff --git a/bin/security-checker b/bin/security-checker
new file mode 120000 (symlink)
index 0000000..85f6e8e
--- /dev/null
@@ -0,0 +1 @@
+../vendor/sensiolabs/security-checker/security-checker
\ No newline at end of file
similarity index 97%
rename from app/check.php
rename to bin/symfony_requirements
index 282507f703a85916597ed0d49a9f033c5ab5b81c..1eca6719c478c2b0bec85ab98c0d4c61f6d7f1d4 100644 (file)
@@ -1,6 +1,7 @@
+#!/usr/bin/env php
 <?php
 
-require_once dirname(__FILE__).'/SymfonyRequirements.php';
+require_once dirname(__FILE__).'/../var/SymfonyRequirements.php';
 
 $lineSize = 70;
 $symfonyRequirements = new SymfonyRequirements();
similarity index 100%
rename from app/logs/.gitkeep
rename to var/cache/.gitkeep
diff --git a/var/logs/.gitkeep b/var/logs/.gitkeep
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/var/sessions/.gitkeep b/var/sessions/.gitkeep
new file mode 100644 (file)
index 0000000..e69de29
index b52e3ae622eaa75ddf27fab60cd4e8e012cfa71b..4dc725167db10e80b22cc25af2a0e4fe5b6c8b2a 100644 (file)
@@ -5,6 +5,18 @@
 # to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
 DirectoryIndex app.php
 
+# By default, Apache does not evaluate symbolic links if you did not enable this
+# feature in your server configuration. Uncomment the following line if you
+# install assets as symlinks or if you experience problems related to symlinks
+# when compiling LESS/Sass/CoffeScript assets.
+# Options FollowSymlinks
+
+# Disabling MultiViews prevents unwanted negotiation, e.g. "/app" should not resolve
+# to the front controller "/app.php" but be rewritten to "/app.php/app".
+<IfModule mod_negotiation.c>
+    Options -MultiViews
+</IfModule>
+
 <IfModule mod_rewrite.c>
     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]
 </IfModule>
 
 <IfModule !mod_rewrite.c>
index cc2fefb5569907bfc85267e78cb67e43f15721e4..5c5ee03be180d6fbf52634d103154661f7b22903 100644 (file)
@@ -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
index 635bf7ac7be9773dc48c0b5a02b1c586fc2c35a6..8456754d561d4178778d0998ad35a466f676ed1b 100644 (file)
@@ -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.');
index 77470cb39f05f70a5b709b68304d0756bab75a0d..214e4119653f9c6a4c48cd0ebb06a6754f00f62b 100644 (file)
@@ -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