Эх сурвалжийг харах

[Ready] Upgrade to Symfony 4 / Flex (#3139)

* Update Symfony to 3.3 (based on standard edition)

* Fix config

Create var folder

Update .gitignore

Fix credentials & console location

Add missing bin/ folder & fix hhvm setup

* Upgrade to Symfony Flex / 4.x

* Upgrade to Symfony 4

* Remove unused file

* Install composer specifically to use the last version

* Fix ngnix config

* Remove port in database url

* Fix DB configuration

* Fix setup script to replace localhost by DBHOST

* Upgrade to SF 4.0.2
Thomas Lallement 7 жил өмнө
parent
commit
99cdff30a2
60 өөрчлөгдсөн 741 нэмэгдсэн , 1609 устгасан
  1. 7 0
      frameworks/PHP/symfony/.gitignore
  2. BIN
      frameworks/PHP/symfony/.hhvm.bbhc
  3. 0 19
      frameworks/PHP/symfony/LICENSE
  4. 0 47
      frameworks/PHP/symfony/README.md
  5. 0 1
      frameworks/PHP/symfony/app/.htaccess
  6. 0 7
      frameworks/PHP/symfony/app/AppCache.php
  7. 0 50
      frameworks/PHP/symfony/app/AppKernel.php
  8. 0 7
      frameworks/PHP/symfony/app/Resources/views/base.html.twig
  9. 0 62
      frameworks/PHP/symfony/app/config/config.yml
  10. 0 12
      frameworks/PHP/symfony/app/config/config_dev.yml
  11. 0 10
      frameworks/PHP/symfony/app/config/config_prod.yml
  12. 0 15
      frameworks/PHP/symfony/app/config/parameters.yml
  13. 0 14
      frameworks/PHP/symfony/app/config/parameters.yml.dist
  14. 0 27
      frameworks/PHP/symfony/app/config/routing.yml
  15. 0 14
      frameworks/PHP/symfony/app/config/routing_dev.yml
  16. 22 11
      frameworks/PHP/symfony/bin/console
  17. 0 146
      frameworks/PHP/symfony/bin/symfony_requirements
  18. 27 56
      frameworks/PHP/symfony/composer.json
  19. 380 478
      frameworks/PHP/symfony/composer.lock
  20. 8 0
      frameworks/PHP/symfony/config/bundles.php
  21. 3 0
      frameworks/PHP/symfony/config/packages/dev/routing.yaml
  22. 27 0
      frameworks/PHP/symfony/config/packages/doctrine.yaml
  23. 15 0
      frameworks/PHP/symfony/config/packages/framework.yaml
  24. 31 0
      frameworks/PHP/symfony/config/packages/prod/doctrine.yaml
  25. 3 0
      frameworks/PHP/symfony/config/packages/routing.yaml
  26. 4 0
      frameworks/PHP/symfony/config/packages/test/framework.yaml
  27. 4 0
      frameworks/PHP/symfony/config/packages/twig.yaml
  28. 27 0
      frameworks/PHP/symfony/config/routes.yaml
  29. 3 0
      frameworks/PHP/symfony/config/routes/annotations.yaml
  30. 3 0
      frameworks/PHP/symfony/config/routes/dev/twig.yaml
  31. 27 0
      frameworks/PHP/symfony/config/services.yaml
  32. 0 49
      frameworks/PHP/symfony/deploy/config.hdf
  33. 5 41
      frameworks/PHP/symfony/deploy/nginx.conf
  34. 6 2
      frameworks/PHP/symfony/deploy/php-symfony
  35. 0 1
      frameworks/PHP/symfony/hhvm.pid
  36. 0 0
      frameworks/PHP/symfony/public/favicon.ico
  37. 36 0
      frameworks/PHP/symfony/public/index.php
  38. 11 2
      frameworks/PHP/symfony/setup.sh
  39. 0 17
      frameworks/PHP/symfony/setup_hhvm.sh
  40. 0 1
      frameworks/PHP/symfony/src/.htaccess
  41. 0 0
      frameworks/PHP/symfony/src/Controller/.gitignore
  42. 20 19
      frameworks/PHP/symfony/src/Controller/BenchController.php
  43. 0 0
      frameworks/PHP/symfony/src/Entity/.gitignore
  44. 2 2
      frameworks/PHP/symfony/src/Entity/Fortune.php
  45. 3 19
      frameworks/PHP/symfony/src/Entity/World.php
  46. 61 0
      frameworks/PHP/symfony/src/Kernel.php
  47. 0 0
      frameworks/PHP/symfony/src/Repository/.gitignore
  48. 0 10
      frameworks/PHP/symfony/src/Skamander/BenchmarkBundle/Resources/views/Bench/fortunes.html.twig
  49. 0 7
      frameworks/PHP/symfony/src/Skamander/BenchmarkBundle/Resources/views/layout.html.twig
  50. 0 9
      frameworks/PHP/symfony/src/Skamander/BenchmarkBundle/SkamanderBenchmarkBundle.php
  51. 1 0
      frameworks/PHP/symfony/templates/base.html.twig
  52. 5 0
      frameworks/PHP/symfony/templates/bench/fortunes.html.twig
  53. 0 1
      frameworks/PHP/symfony/var/.gitkeep
  54. 0 48
      frameworks/PHP/symfony/web/.htaccess
  55. 0 21
      frameworks/PHP/symfony/web/app.php
  56. 0 33
      frameworks/PHP/symfony/web/app_dev.php
  57. BIN
      frameworks/PHP/symfony/web/apple-touch-icon.png
  58. 0 335
      frameworks/PHP/symfony/web/config.php
  59. 0 4
      frameworks/PHP/symfony/web/robots.txt
  60. 0 12
      frameworks/PHP/symfony2/app/config/config_dev.yml

+ 7 - 0
frameworks/PHP/symfony/.gitignore

@@ -12,3 +12,10 @@
 app/bootstrap.php.cache
 /deploy/php-fpm.pid
 /.buildpath
+
+###> symfony/framework-bundle ###
+.env
+/public/bundles/
+/var/
+/vendor/
+###< symfony/framework-bundle ###

BIN
frameworks/PHP/symfony/.hhvm.bbhc


+ 0 - 19
frameworks/PHP/symfony/LICENSE

@@ -1,19 +0,0 @@
-Copyright (c) 2004-2017 Fabien Potencier
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is furnished
-to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.

+ 0 - 47
frameworks/PHP/symfony/README.md

@@ -1,47 +0,0 @@
-# Symfony Benchmarking Test
-
-The information below contains information specific to Symfony. 
-For further guidance, review the 
-[documentation](http://frameworkbenchmarks.readthedocs.org/en/latest/). 
-Also note the additional information provided in the [PHP README](../).
-
-This is the Symfony PHP portion of a [benchmarking test suite](../../) comparing a variety of web development platforms.
-
-## Infrastructure Software Versions
-
-The tests were run with:
-
-* [Symfony Version 3.3.0](http://symfony.com/)
-* [PHP Version 7.x](http://www.php.net/) with FPM and APC
-* [nginx 1.4.0](http://nginx.org/)
-* [MySQL 5.5.29](https://dev.mysql.com/)
-
-## Paths & Source for Tests
-
-* [JSON Serialization](src/Skamander/BenchmarkBundle/Controller/BenchController.php)
-: "/json" _Note: Uses the PHP standard 
-[JSON encoder](http://www.php.net/manual/en/function.json-encode.php)._
-* [Single Database Query](src/Skamander/BenchmarkBundle/Controller/BenchController.php) ([Model](src/Skamander/BenchmarkBundle/Entity/World.php))
-: "/db" _Note: Uses the Symfony /Doctrine Entity functionality._
-* [Multiple Database Queries](src/Skamander/BenchmarkBundle/Controller/BenchController.php) ([Model](src/Skamander/BenchmarkBundle/Entity/World.php))
-: "/db?queries=" _Note: Uses the Symfony /Doctrine Entity functionality._
-* [Fortunes Template Test](src/Skamander/BenchmarkBundle/Controller/BenchController.php)
-: "/fortunes" _Note: Uses Symfony's template engine 'Twig'_
-
-## Advice for Adding Symfony Tests
-
-This implementation is the direct result of installing the 
-[Standard Edition of Symfony](https://github.com/symfony/symfony-standard) using [Composer](https://getcomposer.org/), and making 
-the minimum modifications necessary to support 
-running the benchmark. Specifically, unnecessary bundles 
-have *not* been removed from the kernel to properly 
-reflect "out of the box" performance.
-
-Note: `app/bootstrap.php.cache` is generated by Composer
-when you first run `composer.phar install`
-
-# Interesting Links
-
-* [Discussion on APC vs Zend Optimizer, PHP 5.4](http://www.ricardclau.com/2013/03/apc-vs-zend-optimizer-benchmarks-with-symfony2/)
-* [Symfony2 Performance Tuning](http://symfony.com/doc/current/book/performance.html)
-* [Why is Symfony2 performing so bad in benchmarks and does it matter?](http://stackoverflow.com/questions/16696763/why-is-symfony2-performing-so-bad-in-benchmarks-and-does-it-matter)

+ 0 - 1
frameworks/PHP/symfony/app/.htaccess

@@ -1 +0,0 @@
-deny from all

+ 0 - 7
frameworks/PHP/symfony/app/AppCache.php

@@ -1,7 +0,0 @@
-<?php
-
-use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
-
-class AppCache extends HttpCache
-{
-}

+ 0 - 50
frameworks/PHP/symfony/app/AppKernel.php

@@ -1,50 +0,0 @@
-<?php
-
-use Symfony\Component\HttpKernel\Kernel;
-use Symfony\Component\Config\Loader\LoaderInterface;
-
-class AppKernel extends Kernel
-{
-    public function registerBundles()
-    {
-        $bundles = [
-            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
-            new Symfony\Bundle\TwigBundle\TwigBundle(),
-            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
-            new Skamander\BenchmarkBundle\SkamanderBenchmarkBundle(),
-        ];
-        
-        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();
-            
-            if ('dev' === $this->getEnvironment()) {
-                $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
-                $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
-            }
-        }
-        
-        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');
-    }
-}

+ 0 - 7
frameworks/PHP/symfony/app/Resources/views/base.html.twig

@@ -1,7 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title>{% block title %}Welcome!{% endblock %}</title>
-</head>
-<body>{% block body %}{% endblock %}</body>
-</html>

+ 0 - 62
frameworks/PHP/symfony/app/config/config.yml

@@ -1,62 +0,0 @@
-imports:
-    - { resource: parameters.yml }
-    #- { resource: security.yml }
-
-# Put parameters here that don't need to change on each machine where the app is deployed
-# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
-parameters:
-    locale: en
-    container.dumper.inline_class_loader: true
-
-framework:
-    #esi: ~
-    #translator: { fallbacks: ['%locale%'] }
-    secret: '%secret%'
-    router:
-        resource: '%kernel.project_dir%/app/config/routing.yml'
-        strict_requirements: ~
-    form: ~
-    csrf_protection: ~
-    validation: { enable_annotations: true }
-    #serializer: { enable_annotations: true }
-    templating:
-        engines: ['twig']
-    default_locale: '%locale%'
-    trusted_hosts: ~
-    session:
-        # https://symfony.com/doc/current/reference/configuration/framework.html#handler-id
-        handler_id: session.handler.native_file
-        save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%'
-    fragments: ~
-    http_method_override: true
-    assets: ~
-    php_errors:
-        log: true
-
-# Twig Configuration
-twig:
-    debug: '%kernel.debug%'
-    strict_variables: '%kernel.debug%'
-
-# Doctrine Configuration
-doctrine:
-    dbal:
-        driver: pdo_mysql
-        host: '%database_host%'
-        port: '%database_port%'
-        dbname: '%database_name%'
-        user: '%database_user%'
-        password: '%database_password%'
-        charset: UTF8
-        # if using pdo_sqlite as your database driver:
-        #   1. add the path in parameters.yml
-        #     e.g. database_path: "%kernel.project_dir%/var/data/data.sqlite"
-        #   2. Uncomment database_path in parameters.yml.dist
-        #   3. Uncomment next line:
-        #path: '%database_path%'
-
-    orm:
-        auto_generate_proxy_classes: '%kernel.debug%'
-        #naming_strategy: doctrine.orm.naming_strategy.underscore
-        auto_mapping: true
-

+ 0 - 12
frameworks/PHP/symfony/app/config/config_dev.yml

@@ -1,12 +0,0 @@
-imports:
-    - { resource: config.yml }
-
-framework:
-    router:
-        resource: '%kernel.project_dir%/app/config/routing_dev.yml'
-        strict_requirements: true
-    profiler: { only_exceptions: false }
-
-web_profiler:
-    toolbar: true
-    intercept_redirects: false

+ 0 - 10
frameworks/PHP/symfony/app/config/config_prod.yml

@@ -1,10 +0,0 @@
-imports:
-    - { resource: config.yml }
-
-# In production environment you should know that the parameters for URL generation
-# always pass the requirements. Otherwise it would break your link (or even site with
-# strict_requirements = true). So we can disable the requirements check completely for
-# enhanced performance with strict_requirements = null.
-framework:
-    router:
-        strict_requirements: null

+ 0 - 15
frameworks/PHP/symfony/app/config/parameters.yml

@@ -1,15 +0,0 @@
-# This file is auto-generated during the composer install
-parameters:
-    database_driver: pdo_mysql
-    database_host: tfbdata
-    database_port: null
-    database_name: hello_world
-    database_user: benchmarkdbuser
-    database_password: benchmarkdbpass
-    mailer_transport: smtp
-    mailer_host: 127.0.0.1
-    mailer_user: null
-    mailer_password: null
-    locale: en
-    secret: 2d50e353f5d24683c46e298ec0aead14
-    database_path: null

+ 0 - 14
frameworks/PHP/symfony/app/config/parameters.yml.dist

@@ -1,14 +0,0 @@
-parameters:
-    database_driver: pdo_mysql
-    database_host: tfbdata
-    database_port: null
-    database_name: hello_world
-    database_user: benchmarkdbuser
-    database_password: benchmarkdbpass
-    mailer_transport: smtp
-    mailer_host: 127.0.0.1
-    mailer_user: null
-    mailer_password: null
-    locale: en
-    secret: 2d50e353f5d24683c46e298ec0aead14
-    database_path: null

+ 0 - 27
frameworks/PHP/symfony/app/config/routing.yml

@@ -1,27 +0,0 @@
-_plaintext:
-    path:  /plaintext
-    defaults: { _controller: "SkamanderBenchmarkBundle:Bench:plaintext" }
-
-_json:
-    path:  /json
-    defaults: { _controller: "SkamanderBenchmarkBundle:Bench:json" }
-
-_db:
-    path:  /db
-    defaults: { _controller: "SkamanderBenchmarkBundle:Bench:db" }
-
-_dbRaw:
-    path:  /db-raw
-    defaults: { _controller: "SkamanderBenchmarkBundle:Bench:dbRaw" }
-
-_update:
-    path:  /update
-    defaults: { _controller: "SkamanderBenchmarkBundle:Bench:update" }
-
-_updateRaw:
-    path:  /update-raw
-    defaults: { _controller: "SkamanderBenchmarkBundle:Bench:updateRaw" }
-
-_fortunes:
-    path:  /fortunes
-    defaults: { _controller: "SkamanderBenchmarkBundle:Bench:fortunes" }

+ 0 - 14
frameworks/PHP/symfony/app/config/routing_dev.yml

@@ -1,14 +0,0 @@
-_wdt:
-    resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
-    prefix: /_wdt
-
-_profiler:
-    resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
-    prefix: /_profiler
-
-_errors:
-    resource: '@TwigBundle/Resources/config/routing/errors.xml'
-    prefix: /_error
-
-_main:
-    resource: routing.yml

+ 22 - 11
frameworks/PHP/symfony/bin/console

@@ -1,28 +1,39 @@
 #!/usr/bin/env php
 <?php
 
+use App\Kernel;
 use Symfony\Bundle\FrameworkBundle\Console\Application;
 use Symfony\Component\Console\Input\ArgvInput;
 use Symfony\Component\Debug\Debug;
-
-// if you don't want to setup permissions the proper way, just uncomment the following PHP line
-// read https://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup
-// for more information
-//umask(0000);
+use Symfony\Component\Dotenv\Dotenv;
 
 set_time_limit(0);
 
-/** @var Composer\Autoload\ClassLoader $loader */
-$loader = require __DIR__.'/../vendor/autoload.php';
+require __DIR__.'/../vendor/autoload.php';
+
+if (!class_exists(Application::class)) {
+    throw new \RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
+}
+
+if (!isset($_SERVER['APP_ENV'])) {
+    if (!class_exists(Dotenv::class)) {
+        throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
+    }
+    (new Dotenv())->load(__DIR__.'/../.env');
+}
 
 $input = new ArgvInput();
-$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev');
-$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod';
+$env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev');
+$debug = ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)) && !$input->hasParameterOption(['--no-debug', '']);
 
 if ($debug) {
-    Debug::enable();
+    umask(0000);
+
+    if (class_exists(Debug::class)) {
+        Debug::enable();
+    }
 }
 
-$kernel = new AppKernel($env, $debug);
+$kernel = new Kernel($env, $debug);
 $application = new Application($kernel);
 $application->run($input);

+ 0 - 146
frameworks/PHP/symfony/bin/symfony_requirements

@@ -1,146 +0,0 @@
-#!/usr/bin/env php
-<?php
-
-require_once dirname(__FILE__).'/../var/SymfonyRequirements.php';
-
-$lineSize = 70;
-$symfonyRequirements = new SymfonyRequirements();
-$iniPath = $symfonyRequirements->getPhpIniConfigPath();
-
-echo_title('Symfony Requirements Checker');
-
-echo '> PHP is using the following php.ini file:'.PHP_EOL;
-if ($iniPath) {
-    echo_style('green', '  '.$iniPath);
-} else {
-    echo_style('yellow', '  WARNING: No configuration file (php.ini) used by PHP!');
-}
-
-echo PHP_EOL.PHP_EOL;
-
-echo '> Checking Symfony requirements:'.PHP_EOL.'  ';
-
-$messages = array();
-foreach ($symfonyRequirements->getRequirements() as $req) {
-    if ($helpText = get_error_message($req, $lineSize)) {
-        echo_style('red', 'E');
-        $messages['error'][] = $helpText;
-    } else {
-        echo_style('green', '.');
-    }
-}
-
-$checkPassed = empty($messages['error']);
-
-foreach ($symfonyRequirements->getRecommendations() as $req) {
-    if ($helpText = get_error_message($req, $lineSize)) {
-        echo_style('yellow', 'W');
-        $messages['warning'][] = $helpText;
-    } else {
-        echo_style('green', '.');
-    }
-}
-
-if ($checkPassed) {
-    echo_block('success', 'OK', 'Your system is ready to run Symfony projects');
-} else {
-    echo_block('error', 'ERROR', 'Your system is not ready to run Symfony projects');
-
-    echo_title('Fix the following mandatory requirements', 'red');
-
-    foreach ($messages['error'] as $helpText) {
-        echo ' * '.$helpText.PHP_EOL;
-    }
-}
-
-if (!empty($messages['warning'])) {
-    echo_title('Optional recommendations to improve your setup', 'yellow');
-
-    foreach ($messages['warning'] as $helpText) {
-        echo ' * '.$helpText.PHP_EOL;
-    }
-}
-
-echo PHP_EOL;
-echo_style('title', 'Note');
-echo '  The command console could use a different php.ini file'.PHP_EOL;
-echo_style('title', '~~~~');
-echo '  than the one used with your web server. To be on the'.PHP_EOL;
-echo '      safe side, please check the requirements from your web'.PHP_EOL;
-echo '      server using the ';
-echo_style('yellow', 'web/config.php');
-echo ' script.'.PHP_EOL;
-echo PHP_EOL;
-
-exit($checkPassed ? 0 : 1);
-
-function get_error_message(Requirement $requirement, $lineSize)
-{
-    if ($requirement->isFulfilled()) {
-        return;
-    }
-
-    $errorMessage = wordwrap($requirement->getTestMessage(), $lineSize - 3, PHP_EOL.'   ').PHP_EOL;
-    $errorMessage .= '   > '.wordwrap($requirement->getHelpText(), $lineSize - 5, PHP_EOL.'   > ').PHP_EOL;
-
-    return $errorMessage;
-}
-
-function echo_title($title, $style = null)
-{
-    $style = $style ?: 'title';
-
-    echo PHP_EOL;
-    echo_style($style, $title.PHP_EOL);
-    echo_style($style, str_repeat('~', strlen($title)).PHP_EOL);
-    echo PHP_EOL;
-}
-
-function echo_style($style, $message)
-{
-    // ANSI color codes
-    $styles = array(
-        'reset' => "\033[0m",
-        'red' => "\033[31m",
-        'green' => "\033[32m",
-        'yellow' => "\033[33m",
-        'error' => "\033[37;41m",
-        'success' => "\033[37;42m",
-        'title' => "\033[34m",
-    );
-    $supports = has_color_support();
-
-    echo($supports ? $styles[$style] : '').$message.($supports ? $styles['reset'] : '');
-}
-
-function echo_block($style, $title, $message)
-{
-    $message = ' '.trim($message).' ';
-    $width = strlen($message);
-
-    echo PHP_EOL.PHP_EOL;
-
-    echo_style($style, str_repeat(' ', $width));
-    echo PHP_EOL;
-    echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT));
-    echo PHP_EOL;
-    echo_style($style, $message);
-    echo PHP_EOL;
-    echo_style($style, str_repeat(' ', $width));
-    echo PHP_EOL;
-}
-
-function has_color_support()
-{
-    static $support;
-
-    if (null === $support) {
-        if (DIRECTORY_SEPARATOR == '\\') {
-            $support = false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI');
-        } else {
-            $support = function_exists('posix_isatty') && @posix_isatty(STDOUT);
-        }
-    }
-
-    return $support;
-}

+ 27 - 56
frameworks/PHP/symfony/composer.json

@@ -1,72 +1,43 @@
 {
-	"name" : "symfony/framework-standard-edition",
-	"license" : "MIT",
 	"type" : "project",
-	"description" : "The \"Symfony Standard Edition\" distribution",
-	"autoload" : {
-		"psr-4" : {
-			"" : "src/"
-		},
-		"classmap" : [
-			"app/AppKernel.php",
-			"app/AppCache.php"
-		]
-	},
-	"autoload-dev" : {
-		"psr-4" : {
-			"Tests\\" : "tests/"
-		},
-		"files" : [
-			"vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php"
-		]
-	},
+	"license" : "proprietary",
 	"require" : {
-		"php" : ">=5.5.9",
+		"php" : "^7.1.3",
 		"doctrine/doctrine-bundle" : "^1.6",
 		"doctrine/orm" : "^2.5",
-		"incenteev/composer-parameter-handler" : "^2.0",
-		"sensio/distribution-bundle" : "^5.0.19",
-		"sensio/framework-extra-bundle" : "^3.0.2",
-		"symfony/monolog-bundle" : "^3.1.0",
-		"symfony/polyfill-apcu" : "^1.0",
-		"symfony/swiftmailer-bundle" : "^2.3.10",
-		"symfony/symfony" : "^3.3",
-		"twig/twig" : "^1.0||^2.0"
+		"symfony/console" : "^4.0",
+		"symfony/flex" : "^1.0",
+		"symfony/framework-bundle" : "^4.0",
+		"symfony/twig-bundle" : "^4.0",
+		"symfony/yaml" : "^4.0",
+		"twig/twig" : "^2.4"
 	},
 	"require-dev" : {
-		"sensio/generator-bundle" : "^3.0",
-		"symfony/phpunit-bridge" : "^3.0"
-	},
-	"scripts" : {
-		"symfony-scripts" : [
-			"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
-			"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
-			"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
-			"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
-			"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
-			"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
-		],
-		"post-install-cmd" : "@symfony-scripts",
-		"post-update-cmd" : "@symfony-scripts"
+		"symfony/dotenv" : "^4.0"
 	},
 	"config" : {
-		"platform" : {
-			"php" : "5.5.9"
+		"preferred-install" : {
+			"*" : "dist"
 		},
 		"sort-packages" : true
 	},
+	"autoload" : {
+		"psr-4" : {
+			"App\\" : "src/"
+		}
+	},
+	"autoload-dev" : {
+		"psr-4" : {
+			"App\\Tests\\" : "tests/"
+		}
+	},
+	"conflict" : {
+		"symfony/symfony" : "*"
+	},
 	"extra" : {
-		"symfony-app-dir" : "app",
-		"symfony-bin-dir" : "bin",
-		"symfony-var-dir" : "var",
-		"symfony-web-dir" : "web",
-		"symfony-tests-dir" : "tests",
-		"symfony-assets-install" : "relative",
-		"incenteev-parameters" : {
-			"file" : "app/config/parameters.yml"
-		},
-		"branch-alias" : {
-			"dev-master" : "3.3-dev"
+		"symfony" : {
+			"id" : "01C0MBGZ184NXGJSE6HFTV8B43",
+			"allow-contrib" : false
 		}
 	}
 }

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 380 - 478
frameworks/PHP/symfony/composer.lock


+ 8 - 0
frameworks/PHP/symfony/config/bundles.php

@@ -0,0 +1,8 @@
+<?php
+
+return [
+    Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
+    Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
+    Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
+    Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
+];

+ 3 - 0
frameworks/PHP/symfony/config/packages/dev/routing.yaml

@@ -0,0 +1,3 @@
+framework:
+    router:
+        strict_requirements: true

+ 27 - 0
frameworks/PHP/symfony/config/packages/doctrine.yaml

@@ -0,0 +1,27 @@
+parameters:
+    # Adds a fallback DATABASE_URL if the env var is not set.
+    # This allows you to run cache:warmup even if your
+    # environment variables are not available yet.
+    # You should not need to change this value.
+    env(DATABASE_URL): ''
+
+doctrine:
+    dbal:
+        # configure these for your database server
+        driver: 'pdo_mysql'
+        server_version: '5.7'
+        charset: utf8mb4
+
+        # With Symfony 3.3, remove the `resolve:` prefix
+        url: '%env(resolve:DATABASE_URL)%'
+    orm:
+        auto_generate_proxy_classes: '%kernel.debug%'
+        #naming_strategy: doctrine.orm.naming_strategy.underscore
+        auto_mapping: true
+        mappings:
+            App:
+                is_bundle: false
+                type: annotation
+                dir: '%kernel.project_dir%/src/Entity'
+                prefix: 'App\Entity'
+                alias: App

+ 15 - 0
frameworks/PHP/symfony/config/packages/framework.yaml

@@ -0,0 +1,15 @@
+framework:
+    secret: '%env(APP_SECRET)%'
+    #default_locale: en
+    #csrf_protection: ~
+    #http_method_override: true
+
+    # uncomment this entire section to enable sessions
+    #session:
+    #    # With this config, PHP's native session handling is used
+    #    handler_id: ~
+
+    #esi: ~
+    #fragments: ~
+    php_errors:
+        log: true

+ 31 - 0
frameworks/PHP/symfony/config/packages/prod/doctrine.yaml

@@ -0,0 +1,31 @@
+doctrine:
+    orm:
+        metadata_cache_driver:
+            type: service
+            id: doctrine.system_cache_provider
+        query_cache_driver:
+            type: service
+            id: doctrine.system_cache_provider
+        result_cache_driver:
+            type: service
+            id: doctrine.result_cache_provider
+
+services:
+    doctrine.result_cache_provider:
+        class: Symfony\Component\Cache\DoctrineProvider
+        public: false
+        arguments:
+            - '@doctrine.result_cache_pool'
+    doctrine.system_cache_provider:
+        class: Symfony\Component\Cache\DoctrineProvider
+        public: false
+        arguments:
+            - '@doctrine.system_cache_pool'
+
+framework:
+    cache:
+        pools:
+            doctrine.result_cache_pool:
+                adapter: cache.app
+            doctrine.system_cache_pool:
+                adapter: cache.system

+ 3 - 0
frameworks/PHP/symfony/config/packages/routing.yaml

@@ -0,0 +1,3 @@
+framework:
+    router:
+        strict_requirements: ~

+ 4 - 0
frameworks/PHP/symfony/config/packages/test/framework.yaml

@@ -0,0 +1,4 @@
+framework:
+    test: ~
+    #session:
+    #    storage_id: session.storage.mock_file

+ 4 - 0
frameworks/PHP/symfony/config/packages/twig.yaml

@@ -0,0 +1,4 @@
+twig:
+    paths: ['%kernel.project_dir%/templates']
+    debug: '%kernel.debug%'
+    strict_variables: '%kernel.debug%'

+ 27 - 0
frameworks/PHP/symfony/config/routes.yaml

@@ -0,0 +1,27 @@
+_plaintext:
+    path:  /plaintext
+    controller: App\Controller\BenchController::plaintextAction
+
+_json:
+    path:  /json
+    controller: App\Controller\BenchController::jsonAction
+
+_db:
+    path:  /db
+    controller: App\Controller\BenchController::dbAction
+
+_dbRaw:
+    path:  /db-raw
+    controller: App\Controller\BenchController::dbRawAction
+
+_update:
+    path:  /update
+    controller: App\Controller\BenchController::updateAction
+
+_updateRaw:
+    path:  /update-raw
+    controller: App\Controller\BenchController::updateRawAction
+
+_fortunes:
+    path:  /fortunes
+    controller: App\Controller\BenchController::fortunesAction

+ 3 - 0
frameworks/PHP/symfony/config/routes/annotations.yaml

@@ -0,0 +1,3 @@
+controllers:
+    resource: ../../src/Controller/
+    type: annotation

+ 3 - 0
frameworks/PHP/symfony/config/routes/dev/twig.yaml

@@ -0,0 +1,3 @@
+_errors:
+    resource: '@TwigBundle/Resources/config/routing/errors.xml'
+    prefix: /_error

+ 27 - 0
frameworks/PHP/symfony/config/services.yaml

@@ -0,0 +1,27 @@
+# Put parameters here that don't need to change on each machine where the app is deployed
+# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
+parameters:
+
+services:
+    # default configuration for services in *this* file
+    _defaults:
+        autowire: true      # Automatically injects dependencies in your services.
+        autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
+        public: false       # Allows optimizing the container by removing unused services; this also means
+                            # fetching services directly from the container via $container->get() won't work.
+                            # The best practice is to be explicit about your dependencies anyway.
+
+    # makes classes in src/ available to be used as services
+    # this creates a service per class whose id is the fully-qualified class name
+    App\:
+        resource: '../src/*'
+        exclude: '../src/{Entity,Migrations,Tests}'
+
+    # controllers are imported separately to make sure services can be injected
+    # as action arguments even if you don't extend any base controller class
+    App\Controller\:
+        resource: '../src/Controller'
+        tags: ['controller.service_arguments']
+
+    # add more service definitions when explicit configuration is needed
+    # please note that last definitions always *replace* previous ones

+ 0 - 49
frameworks/PHP/symfony/deploy/config.hdf

@@ -1,49 +0,0 @@
-# main configuration file
-
-# Application PID File
-PidFile = /home/vagrant/FrameworkBenchmarks/frameworks/PHP/symfony/hhvm.pid
-
-# Server settings
-Server {
-  Port = 9001
-  Type = fastcgi
-  SourceRoot = /home/vagrant/FrameworkBenchmarks/frameworks/PHP/symfony
-  DefaultDocument = index.php
-  GzipCompressionLevel = 0
-  EnableKeepAlive = true
-}
-
-# Disable logging completely
-Log {
-  UseLogFile = false
-  UseSyslog = false
-  Level = Error
-  #File = /home/vagrant/FrameworkBenchmarks/frameworks/PHP/symfony/error.log
-}
-
-# Enable jit for production mode
-Eval {
-    Jit = true
-    CheckSymLink = false
-}
-
-# Repo file
-Repo {
-  Central {
-    Path = /home/vagrant/FrameworkBenchmarks/frameworks/PHP/symfony/.hhvm.bbhc
-  }
-}
-
-# Setup basic rewrite
-VirtualHost {
-    * {
-        Pattern = .*
-        RewriteRules {
-            * {
-                pattern = ^(.*)$
-                to = $1.php
-                qsa = true
-            }
-        }
-    }
-}

+ 5 - 41
frameworks/PHP/symfony/deploy/nginx.conf

@@ -65,11 +65,11 @@ http {
         #    proxy_pass   http://127.0.0.1;
         #}
 
-        root /home/tfb/FrameworkBenchmarks/php-symfony/web/;
-        index  app.php;
+        root /home/tfb/FrameworkBenchmarks/php-symfony/public/;
+        index  index.php;
 
         location / {
-            try_files $uri $uri/ /app.php?$uri&$args;
+            try_files $uri $uri/ /index.php?$uri&$args;
         }
 
         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
@@ -80,6 +80,8 @@ http {
             fastcgi_index  index.php;
 #            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
+            fastcgi_param  APP_ENV "prod";
+            fastcgi_param  DATABASE_URL "mysql://benchmarkdbuser:benchmarkdbpass@localhost/hello_world";
             include        /usr/local/nginx/conf/fastcgi_params;
         }
 
@@ -90,42 +92,4 @@ http {
         #    deny  all;
         #}
     }
-
-
-    # another virtual host using mix of IP-, name-, and port-based configuration
-    #
-    #server {
-    #    listen       8000;
-    #    listen       somename:8080;
-    #    server_name  somename  alias  another.alias;
-
-    #    location / {
-    #        root   html;
-    #        index  index.html index.htm;
-    #    }
-    #}
-
-
-    # HTTPS server
-    #
-    #server {
-    #    listen       443;
-    #    server_name  localhost;
-
-    #    ssl                  on;
-    #    ssl_certificate      cert.pem;
-    #    ssl_certificate_key  cert.key;
-
-    #    ssl_session_timeout  5m;
-
-    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
-    #    ssl_ciphers  HIGH:!aNULL:!MD5;
-    #    ssl_prefer_server_ciphers   on;
-
-    #    location / {
-    #        root   html;
-    #        index  index.html index.htm;
-    #    }
-    #}
-
 }

+ 6 - 2
frameworks/PHP/symfony/deploy/php-symfony

@@ -1,6 +1,10 @@
 <VirtualHost *:8080>
-  Alias /php-symfony/ "/home/ubuntu/FrameworkBenchmarks/php-symfony/web/"
-  <Directory /home/ubuntu/FrameworkBenchmarks/php-symfony/web/>
+
+  SetEnv APP_ENV "prod"
+  SetEnv DATABASE_URL "mysql://benchmarkdbuser:benchmarkdbpass@tfbdata:3306/hello_world"
+
+  Alias /php-symfony/ "/home/ubuntu/FrameworkBenchmarks/php-symfony/public/"
+  <Directory /home/ubuntu/FrameworkBenchmarks/php-symfony/public/>
           Options Indexes FollowSymLinks MultiViews
           #AllowOverride None
           Order allow,deny

+ 0 - 1
frameworks/PHP/symfony/hhvm.pid

@@ -1 +0,0 @@
-29484

+ 0 - 0
frameworks/PHP/symfony/web/favicon.ico → frameworks/PHP/symfony/public/favicon.ico


+ 36 - 0
frameworks/PHP/symfony/public/index.php

@@ -0,0 +1,36 @@
+<?php
+
+use App\Kernel;
+use Symfony\Component\Debug\Debug;
+use Symfony\Component\Dotenv\Dotenv;
+use Symfony\Component\HttpFoundation\Request;
+
+require __DIR__.'/../vendor/autoload.php';
+
+// The check is to ensure we don't use .env in production
+if (!isset($_SERVER['APP_ENV'])) {
+    if (!class_exists(Dotenv::class)) {
+        throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
+    }
+    (new Dotenv())->load(__DIR__.'/../.env');
+}
+
+if ($_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev'))) {
+    umask(0000);
+
+    Debug::enable();
+}
+
+if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
+    Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
+}
+
+if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
+    Request::setTrustedHosts(explode(',', $trustedHosts));
+}
+
+$kernel = new Kernel($_SERVER['APP_ENV'] ?? 'dev', $_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev')));
+$request = Request::createFromGlobals();
+$response = $kernel->handle($request);
+$response->send();
+$kernel->terminate($request, $response);

+ 11 - 2
frameworks/PHP/symfony/setup.sh

@@ -1,11 +1,20 @@
 #!/bin/bash
 
-fw_depends mysql php7 nginx composer
+fw_depends mysql php7 nginx
 
-sed -i 's|database_host: .*|database_host: '"${DBHOST}"'|g' app/config/parameters.yml
+sed -i 's|localhost|'"${DBHOST}"'|g' deploy/nginx.conf
 sed -i 's|root .*/FrameworkBenchmarks/php-symfony| root '"${TROOT}"'|g' deploy/nginx.conf
 sed -i 's|/usr/local/nginx/|'"${IROOT}"'/nginx/|g' deploy/nginx.conf
 
+php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
+php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
+php composer-setup.php
+php -r "unlink('composer-setup.php');"
+
+export APP_ENV=prod
+
+php composer.phar install --no-dev --no-interaction --no-progress --optimize-autoloader --classmap-authoritative
+
 php bin/console cache:clear --env=prod --no-debug --no-warmup
 php bin/console cache:warmup --env=prod --no-debug
 

+ 0 - 17
frameworks/PHP/symfony/setup_hhvm.sh

@@ -1,17 +0,0 @@
-#!/bin/bash
-
-fw_depends mysql php5 nginx composer hhvm
-
-sed -i 's|database_host: .*|database_host: '"${DBHOST}"'|g' app/config/parameters.yml
-sed -i 's|SourceRoot = .*/FrameworkBenchmarks/symfony|SourceRoot = '"${TROOT}"'|g' deploy/config.hdf
-sed -i 's|Path = .*/.hhvm.hhbc|Path = '"${TROOT}"'/.hhvm.bbhc|g' deploy/config.hdf
-sed -i 's|PidFile = .*/hhvm.pid|PidFile = '"${TROOT}"'/hhvm.pid|g' deploy/config.hdf
-sed -i 's|File = .*/error.log|File = '"${TROOT}"'/error.log|g' deploy/config.hdf
-sed -i 's|root .*/FrameworkBenchmarks/php-symfony| root '"${TROOT}"'|g' deploy/nginx.conf
-sed -i 's|/usr/local/nginx/|'"${IROOT}"'/nginx/|g' deploy/nginx.conf
-
-php bin/console cache:clear --env=prod --no-debug --no-warmup
-php bin/console cache:warmup --env=prod --no-debug
-
-hhvm -m daemon --config $TROOT/deploy/config.hdf --user $(whoami)
-nginx -c $TROOT/deploy/nginx.conf

+ 0 - 1
frameworks/PHP/symfony/src/.htaccess

@@ -1 +0,0 @@
-deny from all

+ 0 - 0
frameworks/PHP/symfony/src/Controller/.gitignore


+ 20 - 19
frameworks/PHP/symfony/src/Skamander/BenchmarkBundle/Controller/BenchController.php → frameworks/PHP/symfony/src/Controller/BenchController.php

@@ -1,19 +1,22 @@
 <?php
 
-namespace Skamander\BenchmarkBundle\Controller;
+namespace App\Controller;
 
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+use Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait;
 use Symfony\Component\HttpFoundation\JsonResponse;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\Response;
-use Skamander\BenchmarkBundle\Entity\Fortune;
+use App\Entity\Fortune;
+use App\Entity\World;
 
 class BenchController extends Controller
 {
+    use ControllerTrait;
 
     public function plaintextAction()
     {
-      return new Response("Hello, World!", 200, array('Content-Type' => 'text/plain'));
+        return new Response("Hello, World!", 200, array('Content-Type' => 'text/plain'));
     }
 
     public function jsonAction()
@@ -28,11 +31,10 @@ class BenchController extends Controller
 
         // possibility for enhancement is the use of SplFixedArray -> http://php.net/manual/de/class.splfixedarray.php
         $worlds = array();
-        $repo = $this->getDoctrine()
-            ->getRepository('SkamanderBenchmarkBundle:World');
+        $repo = $this->getDoctrine()->getRepository(World::class);
 
         for ($i = 0; $i < $queries; ++$i) {
-            $worlds[] =  $repo->find(mt_rand(1, 10000));
+            $worlds[] = $repo->find(mt_rand(1, 10000));
         }
 
         if ($queries == 1 && !$request->query->has('queries')) {
@@ -51,8 +53,8 @@ class BenchController extends Controller
         $worlds = array();
         $conn = $this->get('database_connection');
 
-        for($i = 0; $i < $queries; ++$i) {
-            $worlds[] =  $conn->fetchAssoc('SELECT * FROM World WHERE id = ?', array(mt_rand(1, 10000)));
+        for ($i = 0; $i < $queries; ++$i) {
+            $worlds[] = $conn->fetchAssoc('SELECT * FROM world WHERE id = ?', array(mt_rand(1, 10000)));
         }
 
         if ($queries == 1 && !$request->query->has('queries')) {
@@ -69,17 +71,17 @@ class BenchController extends Controller
 
       $worlds = array();
       $em = $this->getDoctrine()->getManager();
-      $repo = $this->getDoctrine()
-          ->getRepository('SkamanderBenchmarkBundle:World');
+      $repo = $this->getDoctrine()->getRepository(World::class);
 
       for ($i = 0; $i < $queries; ++$i) {
         $world = $repo->find(mt_rand(1, 10000));
-        $random_number = mt_rand(1, 10000);
-        $world->setRandomNumber($random_number);
+        $randomNumber = mt_rand(1, 10000);
+        $world->setRandomNumber($randomNumber);
         $worlds[] = $world;
       }
 
       $em->flush();
+
       return new JsonResponse($worlds);
     }
 
@@ -91,11 +93,11 @@ class BenchController extends Controller
       $worlds = array();
       $conn = $this->get('database_connection');
 
-      for($i = 0; $i < $queries; ++$i) {
+      for ($i = 0; $i < $queries; ++$i) {
           $id = mt_rand(1, 10000);
-          $random_number = mt_rand(1, 10000);
-          $conn->executeUpdate('UPDATE World SET randomNumber=? WHERE id=?', array($random_number, $id));
-          $worlds[] = array('id' => $id, 'randomNumber' => $random_number);
+          $randomNumber = mt_rand(1, 10000);
+          $conn->executeUpdate('UPDATE world SET randomNumber=? WHERE id=?', array($randomNumber, $id));
+          $worlds[] = array('id' => $id, 'randomNumber' => $randomNumber);
       }
 
       return new JsonResponse($worlds);
@@ -103,8 +105,7 @@ class BenchController extends Controller
 
     public function fortunesAction()
     {
-        $repo = $this->getDoctrine()
-            ->getRepository('SkamanderBenchmarkBundle:Fortune');
+        $repo = $this->getDoctrine()->getRepository(Fortune::class);
         $fortunes = $repo->findAll();
 
         $runtimeFortune = new Fortune();
@@ -117,7 +118,7 @@ class BenchController extends Controller
             return strcmp($left->message, $right->message);
         });
 
-        return $this->render("SkamanderBenchmarkBundle:Bench:fortunes.html.twig", [
+        return $this->render("bench/fortunes.html.twig", [
             'fortunes' => $fortunes
         ]);
     }

+ 0 - 0
frameworks/PHP/symfony/src/Entity/.gitignore


+ 2 - 2
frameworks/PHP/symfony/src/Skamander/BenchmarkBundle/Entity/Fortune.php → frameworks/PHP/symfony/src/Entity/Fortune.php

@@ -1,12 +1,12 @@
 <?php
 
-namespace Skamander\BenchmarkBundle\Entity;
+namespace App\Entity;
 
 use Doctrine\ORM\Mapping as ORM;
 
 /**
  * @ORM\Entity
- * @ORM\Table(name="Fortune")
+ * @ORM\Table(name="fortune")
  */
 class Fortune
 {

+ 3 - 19
frameworks/PHP/symfony/src/Skamander/BenchmarkBundle/Entity/World.php → frameworks/PHP/symfony/src/Entity/World.php

@@ -1,14 +1,14 @@
 <?php
 
-namespace Skamander\BenchmarkBundle\Entity;
+namespace App\Entity;
 
 use Doctrine\ORM\Mapping as ORM;
 
 /**
  * @ORM\Entity
- * @ORM\Table(name="World")
+ * @ORM\Table(name="world")
  */
-class World /* implements JsonSerializable */
+class World
 {
    /**
     * @ORM\Id
@@ -21,22 +21,6 @@ class World /* implements JsonSerializable */
     */
     public $randomNumber;
 
-
-    /**
-     * Although this is a benchmark, implemented this so
-     * we don't have to make our members public. :)
-     *
-     * @return array
-     */
-    /*
-    public function jsonSerialize() {
-        return [
-            'id' => $this->id,
-            'randomNumber' => $this->randomNumber
-        ];
-    }
-    */
-
     /**
      * Set id
      *

+ 61 - 0
frameworks/PHP/symfony/src/Kernel.php

@@ -0,0 +1,61 @@
+<?php
+
+namespace App;
+
+use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
+use Symfony\Component\Config\Loader\LoaderInterface;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\HttpKernel\Kernel as BaseKernel;
+use Symfony\Component\Routing\RouteCollectionBuilder;
+
+class Kernel extends BaseKernel
+{
+    use MicroKernelTrait;
+
+    const CONFIG_EXTS = '.{php,xml,yaml,yml}';
+
+    public function getCacheDir()
+    {
+        return $this->getProjectDir().'/var/cache/'.$this->environment;
+    }
+
+    public function getLogDir()
+    {
+        return $this->getProjectDir().'/var/log';
+    }
+
+    public function registerBundles()
+    {
+        $contents = require $this->getProjectDir().'/config/bundles.php';
+        foreach ($contents as $class => $envs) {
+            if (isset($envs['all']) || isset($envs[$this->environment])) {
+                yield new $class();
+            }
+        }
+    }
+
+    protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
+    {
+        $container->setParameter('container.autowiring.strict_mode', true);
+        $container->setParameter('container.dumper.inline_class_loader', true);
+        $confDir = $this->getProjectDir().'/config';
+        $loader->load($confDir.'/packages/*'.self::CONFIG_EXTS, 'glob');
+        if (is_dir($confDir.'/packages/'.$this->environment)) {
+            $loader->load($confDir.'/packages/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob');
+        }
+        $loader->load($confDir.'/services'.self::CONFIG_EXTS, 'glob');
+        $loader->load($confDir.'/services_'.$this->environment.self::CONFIG_EXTS, 'glob');
+    }
+
+    protected function configureRoutes(RouteCollectionBuilder $routes)
+    {
+        $confDir = $this->getProjectDir().'/config';
+        if (is_dir($confDir.'/routes/')) {
+            $routes->import($confDir.'/routes/*'.self::CONFIG_EXTS, '/', 'glob');
+        }
+        if (is_dir($confDir.'/routes/'.$this->environment)) {
+            $routes->import($confDir.'/routes/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob');
+        }
+        $routes->import($confDir.'/routes'.self::CONFIG_EXTS, '/', 'glob');
+    }
+}

+ 0 - 0
frameworks/PHP/symfony/src/Repository/.gitignore


+ 0 - 10
frameworks/PHP/symfony/src/Skamander/BenchmarkBundle/Resources/views/Bench/fortunes.html.twig

@@ -1,10 +0,0 @@
-{% extends "SkamanderBenchmarkBundle::layout.html.twig" %}
-
-{% block title "Fortunes" %}
-
-{% block content %}
-<table>
-<tr><th>id</th><th>message</th></tr>
-{% for fortune in fortunes %}<tr><td>{{ fortune.id }}</td><td>{{ fortune.message }}</td></tr>{% endfor %}
-</table>
-{% endblock %}

+ 0 - 7
frameworks/PHP/symfony/src/Skamander/BenchmarkBundle/Resources/views/layout.html.twig

@@ -1,7 +0,0 @@
-{% extends '::base.html.twig' %}
-
-{% block title 'Fortunes' %}
-
-{% block body %}
-        {% block content %}{% endblock %}
-{% endblock %}

+ 0 - 9
frameworks/PHP/symfony/src/Skamander/BenchmarkBundle/SkamanderBenchmarkBundle.php

@@ -1,9 +0,0 @@
-<?php
-
-namespace Skamander\BenchmarkBundle;
-
-use Symfony\Component\HttpKernel\Bundle\Bundle;
-
-class SkamanderBenchmarkBundle extends Bundle
-{
-}

+ 1 - 0
frameworks/PHP/symfony/templates/base.html.twig

@@ -0,0 +1 @@
+<!DOCTYPE html><html><head><title>{% block title %}Welcome!{% endblock %}</title></head><body>{% block content %}{% endblock %}</body></html>

+ 5 - 0
frameworks/PHP/symfony/templates/bench/fortunes.html.twig

@@ -0,0 +1,5 @@
+{% extends "base.html.twig" %}
+
+{% block title "Fortunes" %}
+
+{% block content %}<table><tr><th>id</th><th>message</th></tr>{% for fortune in fortunes %}<tr><td>{{ fortune.id }}</td><td>{{ fortune.message }}</td></tr>{% endfor %}</table>{% endblock %}

+ 0 - 1
frameworks/PHP/symfony/var/.gitkeep

@@ -1 +0,0 @@
-

+ 0 - 48
frameworks/PHP/symfony/web/.htaccess

@@ -1,48 +0,0 @@
-# Use the front controller as index file. It serves as fallback solution when
-# every other rewrite/redirect fails (e.g. in an aliased environment without
-# mod_rewrite). Additionally, this reduces the matching process for the
-# startpage (path "/") because otherwise Apache will apply the rewritting rules
-# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
-DirectoryIndex app.php
-
-<IfModule mod_rewrite.c>
-    RewriteEngine On
-
-    # Redirect to URI without front controller to prevent duplicate content
-    # (with and without `/app.php`). Only do this redirect on the initial
-    # rewrite by Apache and not on subsequent cycles. Otherwise we would get an
-    # endless redirect loop (request -> rewrite to front controller ->
-    # redirect -> request -> ...).
-    # So in case you get a "too many redirects" error or you always get redirected
-    # to the startpage because your Apache does not expose the REDIRECT_STATUS
-    # environment variable, you have 2 choices:
-    # - disable this feature by commenting the following 2 lines or
-    # - 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(/(.*)|$) %{CONTEXT_PREFIX}/$2 [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]
-
-    # The following rewrites all other queries to the front controller. The
-    # condition ensures that if you are using Apache aliases to do mass virtual
-    # hosting, the base path will be prepended to allow proper resolution of the
-    # app.php file; it will work in non-aliased environments as well, providing
-    # a safe, one-size fits all solution.
-    RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
-    RewriteRule ^(.*) - [E=BASE:%1]
-    RewriteRule .? %{ENV:BASE}app.php [L]
-</IfModule>
-
-<IfModule !mod_rewrite.c>
-    <IfModule mod_alias.c>
-        # When mod_rewrite is not available, we instruct a temporary redirect of
-        # the startpage to the front controller explicitly so that the website
-        # and the generated links can still be used.
-        RedirectMatch 302 ^/$ /app.php/
-        # RedirectTemp cannot be used instead
-    </IfModule>
-</IfModule>

+ 0 - 21
frameworks/PHP/symfony/web/app.php

@@ -1,21 +0,0 @@
-<?php
-
-use Symfony\Component\HttpFoundation\Request;
-
-/** @var \Composer\Autoload\ClassLoader $loader */
-$loader = require __DIR__.'/../vendor/autoload.php';
-if (PHP_VERSION_ID < 70000) {
-    include_once __DIR__.'/../var/bootstrap.php.cache';
-}
-
-$kernel = new AppKernel('prod', false);
-if (PHP_VERSION_ID < 70000) {
-    $kernel->loadClassCache();
-}
-
-// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
-//Request::enableHttpMethodParameterOverride();
-$request = Request::createFromGlobals();
-$response = $kernel->handle($request);
-$response->send();
-$kernel->terminate($request, $response);

+ 0 - 33
frameworks/PHP/symfony/web/app_dev.php

@@ -1,33 +0,0 @@
-<?php
-
-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 https://symfony.com/doc/current/setup.html#checking-symfony-application-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'], ['127.0.0.1', '::1']) || PHP_SAPI === 'cli-server')
-) {
-    header('HTTP/1.0 403 Forbidden');
-    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
-}
-
-/** @var \Composer\Autoload\ClassLoader $loader */
-$loader = require __DIR__.'/../vendor/autoload.php';
-Debug::enable();
-
-$kernel = new AppKernel('dev', true);
-if (PHP_VERSION_ID < 70000) {
-    $kernel->loadClassCache();
-}
-
-$request = Request::createFromGlobals();
-$response = $kernel->handle($request);
-$response->send();
-$kernel->terminate($request, $response);

BIN
frameworks/PHP/symfony/web/apple-touch-icon.png


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 335
frameworks/PHP/symfony/web/config.php


+ 0 - 4
frameworks/PHP/symfony/web/robots.txt

@@ -1,4 +0,0 @@
-# www.robotstxt.org/
-# www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449
-
-User-agent: *

+ 0 - 12
frameworks/PHP/symfony2/app/config/config_dev.yml

@@ -1,12 +0,0 @@
-imports:
-    - { resource: config.yml }
-
-framework:
-    router:
-        resource: '%kernel.project_dir%/app/config/routing_dev.yml'
-        strict_requirements: true
-    profiler: { only_exceptions: false }
-
-web_profiler:
-    toolbar: true
-    intercept_redirects: false

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно