소스 검색

Update many files to latest standard edition

Jordi Boggiano 11 년 전
부모
커밋
4bdff0a7d7
7개의 변경된 파일42개의 추가작업 그리고 41개의 파일을 삭제
  1. 0 19
      app/AppKernel.php
  2. 0 7
      app/autoload.php
  3. 3 3
      app/config/config.yml
  4. 4 3
      app/config/config_prod.yml
  5. 14 3
      app/console
  6. 13 2
      web/app.php
  7. 8 4
      web/app_dev.php

+ 0 - 19
app/AppKernel.php

@@ -2,9 +2,6 @@
 
 use Symfony\Component\HttpKernel\Kernel;
 use Symfony\Component\Config\Loader\LoaderInterface;
-use Symfony\Component\ClassLoader\DebugUniversalClassLoader;
-use Symfony\Component\HttpKernel\Debug\ErrorHandler;
-use Symfony\Component\HttpKernel\Debug\ExceptionHandler;
 
 class AppKernel extends Kernel
 {
@@ -36,22 +33,6 @@ class AppKernel extends Kernel
         return $bundles;
     }
 
-    public function init()
-    {
-        if ($this->debug) {
-            ini_set('display_errors', 1);
-            error_reporting(-1);
-
-            DebugUniversalClassLoader::enable();
-            ErrorHandler::register();
-            if ('cli' !== php_sapi_name()) {
-                ExceptionHandler::register();
-            }
-        } else {
-            ini_set('display_errors', 0);
-        }
-    }
-
     public function registerContainerConfiguration(LoaderInterface $loader)
     {
         $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');

+ 0 - 7
app/autoload.php

@@ -20,13 +20,6 @@ EOF;
     die($message);
 }
 
-// intl
-if (!function_exists('intl_get_error_code')) {
-    require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
-
-    $loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');
-}
-
 AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
 
 return $loader;

+ 3 - 3
app/config/config.yml

@@ -17,6 +17,8 @@ framework:
         name: packagist
         cookie_lifetime: 3600
     trusted_proxies: %trusted_proxies%
+    http_method_override: true
+    fragments: ~
 
 # Twig Configuration
 twig:
@@ -63,6 +65,7 @@ swiftmailer:
     host:      %mailer_host%
     username:  %mailer_user%
     password:  %mailer_password%
+    spool:     { type: memory }
 
 fos_user:
     db_driver:     orm
@@ -92,6 +95,3 @@ hwi_oauth:
             client_secret: %github.client_secret%
 
 nelmio_solarium: ~
-
-parameters:
-    session.flashbag.class: Symfony\Component\HttpFoundation\Session\Flash\FlashBag

+ 4 - 3
app/config/config_prod.yml

@@ -2,9 +2,10 @@ imports:
     - { resource: config.yml }
 
 doctrine:
-    metadata_cache_driver: %doctrine_cache_backend%
-    result_cache_driver: %doctrine_cache_backend%
-    query_cache_driver: %doctrine_cache_backend%
+    orm:
+        metadata_cache_driver: %doctrine_cache_backend%
+        result_cache_driver: %doctrine_cache_backend%
+        query_cache_driver: %doctrine_cache_backend%
 
 monolog:
     handlers:

+ 14 - 3
app/console

@@ -1,18 +1,29 @@
 #!/usr/bin/env php
 <?php
 
+// if you don't want to setup permissions the proper way, just uncomment the following PHP line
+// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
+//umask(0000);
+
 ini_set('date.timezone', 'UTC');
 
+set_time_limit(0);
+
 require_once __DIR__.'/bootstrap.php.cache';
 require_once __DIR__.'/AppKernel.php';
 
 use Symfony\Bundle\FrameworkBundle\Console\Application;
 use Symfony\Component\Console\Input\ArgvInput;
+use Symfony\Component\Debug\Debug;
 
 $input = new ArgvInput();
-$env = $input->getParameterOption(array('--env', '-e'), 'dev');
-$debug = !$input->hasParameterOption(array('--no-debug', ''));
+$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');
+$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';
+
+if ($debug) {
+    Debug::enable();
+}
 
 $kernel = new AppKernel($env, $debug);
 $application = new Application($kernel);
-$application->run();
+$application->run($input);

+ 13 - 2
web/app.php

@@ -2,16 +2,27 @@
 
 ini_set('date.timezone', 'UTC');
 
+
+
+use Symfony\Component\ClassLoader\ApcClassLoader;
 use Symfony\Component\HttpFoundation\Request;
 
 $loader = require_once __DIR__.'/../app/bootstrap.php.cache';
 
+// Use APC for autoloading to improve performance.
+// Change 'sf2' to a unique prefix in order to prevent cache key conflicts
+// with other applications also using APC.
+if (function_exists('apc_store')) {
+    $loader = new ApcClassLoader('packagist', $loader);
+    $loader->register(true);
+}
+
 require_once __DIR__.'/../app/AppKernel.php';
-require_once __DIR__.'/../app/AppCache.php';
+//require_once __DIR__.'/../app/AppCache.php';
 
 $kernel = new AppKernel('prod', false);
 $kernel->loadClassCache();
-$kernel = new AppCache($kernel);
+//$kernel = new AppCache($kernel);
 $request = Request::createFromGlobals();
 $response = $kernel->handle($request);
 $response->send();

+ 8 - 4
web/app_dev.php

@@ -3,21 +3,25 @@
 ini_set('date.timezone', 'UTC');
 
 use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\Debug\Debug;
+
+// If you don't want to setup permissions the proper way, just uncomment the following PHP line
+// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
+//umask(0000);
 
 // This check prevents access to debug front controllers that are deployed by accident to production servers.
 // 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',
-        '::1',
-    ))
+    || !in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1'))
 ) {
     header('HTTP/1.0 403 Forbidden');
     exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
 }
 
 $loader = require_once __DIR__.'/../app/bootstrap.php.cache';
+Debug::enable();
+
 require_once __DIR__.'/../app/AppKernel.php';
 
 $kernel = new AppKernel('dev', true);