Skip to content
This repository has been archived by the owner on Oct 23, 2019. It is now read-only.

Commit

Permalink
Adapted front-controller and /bin/console to work with Pimcore as a C…
Browse files Browse the repository at this point in the history
…omposer dependency
  • Loading branch information
brusch committed Jul 23, 2018
1 parent 23344d9 commit fd67a50
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 33 deletions.
18 changes: 4 additions & 14 deletions bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,14 @@
* @license http://www.pimcore.org/license GPLv3 and PEL
*/

use Pimcore\Config;
use Symfony\Component\Console\Input\ArgvInput;

ob_get_clean();

if (!defined('PIMCORE_PROJECT_ROOT')) {
define(
'PIMCORE_PROJECT_ROOT',
getenv('PIMCORE_PROJECT_ROOT')
?: getenv('REDIRECT_PIMCORE_PROJECT_ROOT')
?: realpath(__DIR__ . '/..')
);
}
include __DIR__ . "/../vendor/autoload.php";
\Pimcore\Bootstrap::setProjectRoot();

define('PIMCORE_CONSOLE', true);

/** @var \Pimcore\Kernel $kernel */
$kernel = require_once __DIR__ . '/../pimcore/config/startup_cli.php';

$application = new Pimcore\Console\Application($kernel);
$kernel = \Pimcore\Bootstrap::startupCli();
$application = new \Pimcore\Console\Application($kernel);
$application->run();
25 changes: 6 additions & 19 deletions web/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,12 @@

use Pimcore\Tool;
use Symfony\Component\Debug\Debug;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

if (!defined('PIMCORE_PROJECT_ROOT')) {
define(
'PIMCORE_PROJECT_ROOT',
getenv('PIMCORE_PROJECT_ROOT')
?: getenv('REDIRECT_PIMCORE_PROJECT_ROOT')
?: realpath(__DIR__ . '/..')
);
}

require_once PIMCORE_PROJECT_ROOT . '/pimcore/config/bootstrap.php';
include __DIR__ . "/../vendor/autoload.php";

\Pimcore\Bootstrap::setProjectRoot();
\Pimcore\Bootstrap::boostrap();

$request = Request::createFromGlobals();

Expand All @@ -37,17 +29,12 @@

// redirect to installer if pimcore is not installed
if (!is_file(\Pimcore\Config::locateConfigFile('system.php'))) {
if (file_exists(__DIR__ . '/install.php')) {
(new RedirectResponse('/install', Response::HTTP_FOUND))->send();
return;
}

Debug::enable(E_ALL, true);
throw new RuntimeException('Pimcore is not installed and the installer is not available. Please add the installer or install via command line.');
throw new RuntimeException('Pimcore is not installed! Please install via command line.');
}

/** @var \Pimcore\Kernel $kernel */
$kernel = require_once PIMCORE_PROJECT_ROOT . '/pimcore/config/kernel.php';
$kernel = \Pimcore\Bootstrap::kernel();

// reset current request - will be read from request stack from now on
Tool::setCurrentRequest(null);
Expand Down

0 comments on commit fd67a50

Please # to comment.