Skip to content

Commit 2136092

Browse files
authored
Merge pull request #33397 from karyna-tsymbal-atwix/improvement/m2-33338-remove-laminas-mvc-dependency-from-setup-wizard-page
33338: Remove usage of laminas\mvc from Setup Wizard page
2 parents a8c0e9b + 2fc17c1 commit 2136092

File tree

7 files changed

+64
-167
lines changed

7 files changed

+64
-167
lines changed

setup/config/module.config.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,5 @@
1212
'template_path_stack' => [
1313
'setup' => __DIR__ . '/../view',
1414
],
15-
],
16-
'controllers' => [
17-
'factories' => [
18-
\Magento\Setup\Controller\Index::class => \Laminas\ServiceManager\AbstractFactory\ReflectionBasedAbstractFactory::class,
19-
],
20-
],
15+
]
2116
];

setup/config/router.config.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

setup/index.php

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
use Magento\Setup\Application;
7-
use Magento\Setup\Model\ObjectManagerProvider;
6+
7+
use Laminas\Http\PhpEnvironment\Request;
8+
use Magento\Framework\App\Bootstrap;
9+
use Magento\Framework\App\ProductMetadata;
10+
use Magento\Setup\Model\License;
811

912
if (PHP_SAPI == 'cli') {
1013
echo "You cannot run this from the command line." . PHP_EOL .
@@ -30,10 +33,20 @@
3033
$handler = new \Magento\Framework\App\ErrorHandler();
3134
set_error_handler([$handler, 'handler']);
3235

33-
$configuration = require __DIR__ . '/config/application.config.php';
34-
$bootstrap = new Application();
35-
$application = $bootstrap->bootstrap($configuration);
36-
$application->getServiceManager()
37-
->get(ObjectManagerProvider::class)
38-
->setObjectManager(\Magento\Framework\App\Bootstrap::create(BP, $_SERVER)->getObjectManager());
39-
$application->run();
36+
// Render Setup Wizard landing page
37+
$objectManager = Bootstrap::create(BP, $_SERVER)->getObjectManager();
38+
39+
$licenseClass = $objectManager->create(License::class);
40+
$metaClass = $objectManager->create(ProductMetadata::class);
41+
/** @var License $license */
42+
$license = $licenseClass->getContents();
43+
/** @var ProductMetadata $version */
44+
$version = $metaClass->getVersion();
45+
46+
$request = new Request();
47+
$basePath = $request->getBasePath();
48+
49+
ob_start();
50+
require_once __DIR__ . '/view/magento/setup/index.phtml';
51+
$html = ob_get_clean();
52+
echo $html;

setup/src/Magento/Setup/Controller/Index.php

Lines changed: 0 additions & 57 deletions
This file was deleted.

setup/src/Magento/Setup/Module.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ public function getConfig()
7575
// phpcs:disable
7676
$result = array_merge_recursive(
7777
include __DIR__ . '/../../../config/module.config.php',
78-
include __DIR__ . '/../../../config/router.config.php',
7978
include __DIR__ . '/../../../config/di.config.php',
8079
);
8180
// phpcs:enable

setup/src/Magento/Setup/Test/Unit/Controller/IndexTest.php

Lines changed: 0 additions & 67 deletions
This file was deleted.

setup/view/magento/setup/index.phtml

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,48 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// phpcs:disable Magento2.Templates.ThisInTemplate
86
?>
7+
<!--[if !IE]><!-->
8+
<html lang="en">
9+
<!--<![endif]-->
10+
<head>
11+
<meta charset="utf-8">
12+
<meta name="viewport" content="width=device-width, initial-scale=1">
13+
<title>Magento</title>
14+
<link href="<?= $basePath ?>/pub/styles/setup.css" media="screen" rel="stylesheet" type="text/css" />
15+
<script src="<?= $basePath ?>/pub/scripts/main.js"></script>
16+
<link
17+
rel="icon"
18+
type="image/x-icon"
19+
href="<?= $basePath ?>/pub/images/favicon/favicon.ico"
20+
sizes="16x16">
21+
<link
22+
rel="icon"
23+
type="image/png"
24+
href="<?= $basePath ?>/pub/images/favicon/favicon-96x96.png"
25+
sizes="96x96">
26+
<link
27+
rel="icon"
28+
type="image/png"
29+
href="<?= $basePath ?>/pub/images/favicon/favicon-32x32.png"
30+
sizes="32x32">
31+
<link
32+
rel="icon"
33+
type="image/png"
34+
href="<?= $basePath ?>/pub/images/favicon/favicon-16x16.png"
35+
sizes="16x16">
36+
<style>
37+
a.white-space-pre-line {
38+
white-space: pre-line;
39+
}
40+
</style>
41+
</head>
42+
<body>
943
<div class="container">
1044
<main class="page-content">
1145
<section data-section="landing" class="page-landing">
12-
<img class="logo" src="<?= $this->basePath() ?>/pub/images/magento-logo.svg" alt="Magento"/>
13-
<p class="text-version">Version <?= htmlspecialchars($this->version, ENT_COMPAT) ?></p>
46+
<img class="logo" src="<?= $basePath ?>/pub/images/magento-logo.svg" alt="Magento"/>
47+
<p class="text-version">Version <?= htmlspecialchars($version, ENT_COMPAT) ?></p>
1448
<p class="text-welcome">
1549
Welcome to Magento Admin, your online store headquarters.
1650
<br>
@@ -22,7 +56,7 @@
2256
<section data-section="license" class="row page-license" style="display: none">
2357
<div class="col-m-offset-2 col-m-8 col-xs-12">
2458
<div class="license-text">
25-
<?= nl2br(htmlspecialchars($this->license, ENT_COMPAT)) ?>
59+
<?= nl2br(htmlspecialchars($license, ENT_COMPAT)) ?>
2660
</div>
2761
<div class="page-license-footer">
2862
<div class="btn-wrap-triangle-left">
@@ -33,3 +67,5 @@
3367
</section>
3468
</main>
3569
</div>
70+
</body>
71+
</html>

0 commit comments

Comments
 (0)