Skip to content

Commit

Permalink
Upgrade demo to sulu 2.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz authored and wachterjohannes committed Apr 7, 2022
1 parent 293aa51 commit 7db320b
Show file tree
Hide file tree
Showing 58 changed files with 848 additions and 730 deletions.
4 changes: 4 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
'multi_line_extends_each_single_line' => true,
],
'linebreak_after_opening_tag' => true,
'native_constant_invocation' => true,
'native_function_casing' => true,
'native_function_invocation' => ['include' => ['@internal']],
'no_php4_constructor' => true,
'no_superfluous_phpdoc_tags' => true,
'no_unreachable_default_argument_value' => true,
Expand All @@ -25,6 +28,7 @@
'semicolon_after_instruction' => true,
'strict_comparison' => true,
'strict_param' => true,
'single_line_comment_spacing' => false,
])
->setFinder(
PhpCsFixer\Finder::create()
Expand Down
5 changes: 1 addition & 4 deletions bin/adminconsole
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/usr/bin/env php
<?php

require __DIR__.'/../vendor/autoload.php';

$suluContext = \Sulu\Component\HttpKernel\SuluKernel::CONTEXT_ADMIN;
include __DIR__ . DIRECTORY_SEPARATOR. 'console.php';
return include __DIR__ . DIRECTORY_SEPARATOR. 'console.php';
20 changes: 1 addition & 19 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,22 +1,4 @@
#!/usr/bin/env php
<?php

use Sulu\Component\HttpKernel\SuluKernel;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Style\SymfonyStyle;

require __DIR__.'/../vendor/autoload.php';

$input = new ArgvInput();
$output = new ConsoleOutput();
$io = new SymfonyStyle($input, $output);

$ansi = $input->getParameterOption(['--ansi']);

if (!$ansi) {
$io->warning('This command will be executed in the "admin" context. For the "website" context, run ./bin/websiteconsole');
}

$suluContext = SuluKernel::CONTEXT_ADMIN;
include __DIR__ . DIRECTORY_SEPARATOR. 'console.php';
return include __DIR__ . DIRECTORY_SEPARATOR. 'console.php';
40 changes: 9 additions & 31 deletions bin/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,19 @@

use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;

if (!in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the ' . \PHP_SAPI . ' SAPI' . \PHP_EOL;
if (!\is_file(\dirname(__DIR__) . '/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}

set_time_limit(0);
require_once \dirname(__DIR__) . '/vendor/autoload_runtime.php';

require dirname(__DIR__) . '/vendor/autoload.php';

if (!class_exists(Application::class) || !class_exists(Dotenv::class)) {
throw new LogicException('You need to add "symfony/framework-bundle" and "symfony/dotenv" as Composer dependencies.');
}

$input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV=' . $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}

if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG=' . $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
if (!isset($suluContext)) {
$suluContext = Kernel::CONTEXT_ADMIN;
}

(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');

if ($_SERVER['APP_DEBUG']) {
umask(0000);

if (class_exists(Debug::class)) {
Debug::enable();
}
}
return function (array $context) use ($suluContext) {
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG'], $suluContext);

$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG'], $suluContext);
$application = new Application($kernel);
$application->run($input);
return new Application($kernel);
};
12 changes: 6 additions & 6 deletions bin/phpunit
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/usr/bin/env php
<?php

if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'UTC');
if (!\ini_get('date.timezone')) {
\ini_set('date.timezone', 'UTC');
}

if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
if (\is_file(\dirname(__DIR__) . '/vendor/phpunit/phpunit/phpunit')) {
\define('PHPUNIT_COMPOSER_INSTALL', \dirname(__DIR__) . '/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
} else {
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
if (!\is_file(\dirname(__DIR__) . '/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}

require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
require \dirname(__DIR__) . '/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
}
6 changes: 3 additions & 3 deletions bin/websiteconsole
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env php
<?php

require __DIR__.'/../vendor/autoload.php';
// we are not allowed to load the autoloader here to get constant because symfony/runtime does else not work correctly
$suluContext = 'website';

$suluContext = \Sulu\Component\HttpKernel\SuluKernel::CONTEXT_WEBSITE;
include __DIR__ . DIRECTORY_SEPARATOR. 'console.php';
return include __DIR__ . DIRECTORY_SEPARATOR. 'console.php';
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@
"sulu/article-bundle": "^2.3",
"sulu/automation-bundle": "^2.0",
"sulu/redirect-bundle": "^2.0",
"sulu/sulu": "~2.4.0",
"sulu/sulu": "~2.4.2",
"sulu/web-twig": "^2.4",
"symfony/config": "^5.4",
"symfony/dotenv": "^5.4",
"symfony/flex": "^1.17 || ^2.0",
"symfony/framework-bundle": "^5.4",
"symfony/monolog-bridge": "^5.4",
"symfony/monolog-bundle": "^3.7",
"symfony/runtime": "^5.4",
"symfony/security-bundle": "^5.4",
"symfony/swiftmailer-bundle": "^3.5",
"symfony/twig-bundle": "^5.4"
Expand Down Expand Up @@ -154,7 +155,8 @@
"sort-packages": true,
"allow-plugins": {
"symfony/flex": true,
"symfony/thanks": true
"symfony/thanks": true,
"symfony/runtime": true
}
},
"extra": {
Expand Down
Loading

0 comments on commit 7db320b

Please sign in to comment.