aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-01-14 18:15:07 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-01-15 09:35:39 +0100
commit73cd160bfc6e4a1b88f2117eb0c097a91ac5c753 (patch)
treec5ccc9fa57f243126538ae8d9a2f8c459c08bd8c
parent1d405d0e62a708928bccd2222ebd89d4804231f9 (diff)
downloadwallabag-73cd160bfc6e4a1b88f2117eb0c097a91ac5c753.tar.gz
wallabag-73cd160bfc6e4a1b88f2117eb0c097a91ac5c753.tar.zst
wallabag-73cd160bfc6e4a1b88f2117eb0c097a91ac5c753.zip
Switch to Symfony 3 structure
-rw-r--r--.gitignore23
-rw-r--r--app/AppKernel.php21
-rw-r--r--app/autoload.php2
-rw-r--r--app/config/config.yml3
-rw-r--r--app/config/config_dev.yml5
-rw-r--r--[-rwxr-xr-x]bin/console (renamed from app/console)6
l---------bin/doctrine1
l---------bin/doctrine-dbal1
l---------bin/doctrine-migrations1
l---------bin/doctrine.php1
-rw-r--r--bin/poche.sqlitebin393216 -> 0 bytes
l---------bin/security-checker1
-rw-r--r--bin/symfony_requirements (renamed from app/check.php)3
-rw-r--r--var/SymfonyRequirements.php (renamed from app/SymfonyRequirements.php)0
-rw-r--r--var/cache/.gitkeep (renamed from app/logs/.gitkeep)0
-rw-r--r--var/logs/.gitkeep0
-rw-r--r--var/sessions/.gitkeep0
-rw-r--r--web/.htaccess22
-rw-r--r--web/app.php2
-rw-r--r--web/app_dev.php2
-rw-r--r--web/robots.txt4
21 files changed, 65 insertions, 33 deletions
diff --git a/.gitignore b/.gitignore
index f88370d7..b6d6aa5d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,25 +1,20 @@
1# Cache and logs (Symfony2) 1# Cache, logs & sessions
2/app/cache/* 2/var/*
3/app/logs/* 3!/var/cache
4!app/cache/.gitkeep
5!app/logs/.gitkeep
6
7# Cache and logs (Symfony3)
8/var/cache/* 4/var/cache/*
9/var/logs/*
10!var/cache/.gitkeep 5!var/cache/.gitkeep
6!/var/logs
7/var/logs/*
11!var/logs/.gitkeep 8!var/logs/.gitkeep
9!/var/sessions
10/var/sessions/*
11!var/sessions/.gitkeep
12!var/SymfonyRequirements.php
12 13
13# Parameters 14# Parameters
14/app/config/parameters.yml 15/app/config/parameters.yml
15/app/config/parameters.ini
16 16
17# Managed by Composer 17# Managed by Composer
18/app/bootstrap.php.cache
19/var/bootstrap.php.cache
20/bin/*
21!bin/console
22!bin/symfony_requirements
23/vendor/ 18/vendor/
24 19
25# Assets and user uploads 20# Assets and user uploads
diff --git a/app/AppKernel.php b/app/AppKernel.php
index d97842f9..7e76a9e9 100644
--- a/app/AppKernel.php
+++ b/app/AppKernel.php
@@ -7,7 +7,7 @@ class AppKernel extends Kernel
7{ 7{
8 public function registerBundles() 8 public function registerBundles()
9 { 9 {
10 $bundles = array( 10 $bundles = [
11 new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), 11 new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
12 new Symfony\Bundle\SecurityBundle\SecurityBundle(), 12 new Symfony\Bundle\SecurityBundle\SecurityBundle(),
13 new Symfony\Bundle\TwigBundle\TwigBundle(), 13 new Symfony\Bundle\TwigBundle\TwigBundle(),
@@ -33,9 +33,9 @@ class AppKernel extends Kernel
33 new KPhoen\RulerZBundle\KPhoenRulerZBundle(), 33 new KPhoen\RulerZBundle\KPhoenRulerZBundle(),
34 new Wallabag\ImportBundle\WallabagImportBundle(), 34 new Wallabag\ImportBundle\WallabagImportBundle(),
35 new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), 35 new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
36 ); 36 ];
37 37
38 if (in_array($this->getEnvironment(), array('dev', 'test'), true)) { 38 if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
39 $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); 39 $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
40 $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); 40 $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
41 $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); 41 $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
@@ -46,6 +46,21 @@ class AppKernel extends Kernel
46 return $bundles; 46 return $bundles;
47 } 47 }
48 48
49 public function getRootDir()
50 {
51 return __DIR__;
52 }
53
54 public function getCacheDir()
55 {
56 return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
57 }
58
59 public function getLogDir()
60 {
61 return dirname(__DIR__).'/var/logs';
62 }
63
49 public function registerContainerConfiguration(LoaderInterface $loader) 64 public function registerContainerConfiguration(LoaderInterface $loader)
50 { 65 {
51 $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml'); 66 $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
diff --git a/app/autoload.php b/app/autoload.php
index 70526bb5..fa582ecd 100644
--- a/app/autoload.php
+++ b/app/autoload.php
@@ -8,6 +8,6 @@ use Composer\Autoload\ClassLoader;
8 */ 8 */
9$loader = require __DIR__.'/../vendor/autoload.php'; 9$loader = require __DIR__.'/../vendor/autoload.php';
10 10
11AnnotationRegistry::registerLoader(array($loader, 'loadClass')); 11AnnotationRegistry::registerLoader([$loader, 'loadClass']);
12 12
13return $loader; 13return $loader;
diff --git a/app/config/config.yml b/app/config/config.yml
index 5fac3192..133fc12f 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -21,7 +21,8 @@ framework:
21 trusted_proxies: ~ 21 trusted_proxies: ~
22 session: 22 session:
23 # handler_id set to null will use default session handler from php.ini 23 # handler_id set to null will use default session handler from php.ini
24 handler_id: ~ 24 handler_id: session.handler.native_file
25 save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
25 fragments: ~ 26 fragments: ~
26 http_method_override: true 27 http_method_override: true
27 28
diff --git a/app/config/config_dev.yml b/app/config/config_dev.yml
index 116dd0d5..6b077fdb 100644
--- a/app/config/config_dev.yml
+++ b/app/config/config_dev.yml
@@ -17,13 +17,14 @@ monolog:
17 type: stream 17 type: stream
18 path: "%kernel.logs_dir%/%kernel.environment%.log" 18 path: "%kernel.logs_dir%/%kernel.environment%.log"
19 level: debug 19 level: debug
20 channels: [!event]
20 console: 21 console:
21 type: console 22 type: console
22 bubble: false 23 bubble: false
23 verbosity_levels: 24 verbosity_levels:
24 VERBOSITY_VERBOSE: INFO 25 VERBOSITY_VERBOSE: INFO
25 VERBOSITY_VERY_VERBOSE: DEBUG 26 VERBOSITY_VERY_VERBOSE: DEBUG
26 channels: ["!doctrine"] 27 channels: [!event, !doctrine]
27 console_very_verbose: 28 console_very_verbose:
28 type: console 29 type: console
29 bubble: false 30 bubble: false
@@ -31,7 +32,7 @@ monolog:
31 VERBOSITY_VERBOSE: NOTICE 32 VERBOSITY_VERBOSE: NOTICE
32 VERBOSITY_VERY_VERBOSE: NOTICE 33 VERBOSITY_VERY_VERBOSE: NOTICE
33 VERBOSITY_DEBUG: DEBUG 34 VERBOSITY_DEBUG: DEBUG
34 channels: ["doctrine"] 35 channels: [doctrine]
35 36
36assetic: 37assetic:
37 use_controller: true 38 use_controller: true
diff --git a/app/console b/bin/console
index 3b4c367c..49247c94 100755..100644
--- a/app/console
+++ b/bin/console
@@ -14,11 +14,11 @@ set_time_limit(0);
14/** 14/**
15 * @var Composer\Autoload\ClassLoader $loader 15 * @var Composer\Autoload\ClassLoader $loader
16 */ 16 */
17$loader = require __DIR__.'/autoload.php'; 17$loader = require __DIR__.'/../app/autoload.php';
18 18
19$input = new ArgvInput(); 19$input = new ArgvInput();
20$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev'); 20$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev');
21$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod'; 21$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod';
22 22
23if ($debug) { 23if ($debug) {
24 Debug::enable(); 24 Debug::enable();
diff --git a/bin/doctrine b/bin/doctrine
new file mode 120000
index 00000000..0f72e36f
--- /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 00000000..110e93c5
--- /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 00000000..7184da71
--- /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 00000000..b22b74da
--- /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 f2b79b68..00000000
--- a/bin/poche.sqlite
+++ /dev/null
Binary files differ
diff --git a/bin/security-checker b/bin/security-checker
new file mode 120000
index 00000000..85f6e8ed
--- /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
index 282507f7..1eca6719 100644
--- a/app/check.php
+++ b/bin/symfony_requirements
@@ -1,6 +1,7 @@
1#!/usr/bin/env php
1<?php 2<?php
2 3
3require_once dirname(__FILE__).'/SymfonyRequirements.php'; 4require_once dirname(__FILE__).'/../var/SymfonyRequirements.php';
4 5
5$lineSize = 70; 6$lineSize = 70;
6$symfonyRequirements = new SymfonyRequirements(); 7$symfonyRequirements = new SymfonyRequirements();
diff --git a/app/SymfonyRequirements.php b/var/SymfonyRequirements.php
index 28b0dcdb..28b0dcdb 100644
--- a/app/SymfonyRequirements.php
+++ b/var/SymfonyRequirements.php
diff --git a/app/logs/.gitkeep b/var/cache/.gitkeep
index e69de29b..e69de29b 100644
--- a/app/logs/.gitkeep
+++ b/var/cache/.gitkeep
diff --git a/var/logs/.gitkeep b/var/logs/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/var/logs/.gitkeep
diff --git a/var/sessions/.gitkeep b/var/sessions/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/var/sessions/.gitkeep
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).
6DirectoryIndex app.php 6DirectoryIndex 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 cc2fefb5..5c5ee03b 100644
--- a/web/app.php
+++ b/web/app.php
@@ -6,7 +6,7 @@ use Symfony\Component\HttpFoundation\Request;
6 * @var Composer\Autoload\ClassLoader 6 * @var Composer\Autoload\ClassLoader
7 */ 7 */
8$loader = require __DIR__.'/../app/autoload.php'; 8$loader = require __DIR__.'/../app/autoload.php';
9include_once __DIR__.'/../app/bootstrap.php.cache'; 9include_once __DIR__.'/../var/bootstrap.php.cache';
10 10
11// Enable APC for autoloading to improve performance. 11// Enable APC for autoloading to improve performance.
12// You should change the ApcClassLoader first argument to a unique prefix 12// You should change the ApcClassLoader first argument to a unique prefix
diff --git a/web/app_dev.php b/web/app_dev.php
index 635bf7ac..8456754d 100644
--- a/web/app_dev.php
+++ b/web/app_dev.php
@@ -12,7 +12,7 @@ use Symfony\Component\Debug\Debug;
12// 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.
13if (isset($_SERVER['HTTP_CLIENT_IP']) 13if (isset($_SERVER['HTTP_CLIENT_IP'])
14 || isset($_SERVER['HTTP_X_FORWARDED_FOR']) 14 || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
15 || !(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')
16) { 16) {
17 header('HTTP/1.0 403 Forbidden'); 17 header('HTTP/1.0 403 Forbidden');
18 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.');
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
1User-agent: * 4User-agent: *
2Disallow: / \ No newline at end of file