Skip to content

Commit c17882d

Browse files
author
Olga Kopylova
committed
MAGETWO-34851: Contribution of Sprint 25 to Mainline
Merge remote-tracking branch 'origin/MAGETWO-33491-db-error' into develop Conflicts: setup/src/Magento/Setup/Controller/ConsoleController.php setup/src/Magento/Setup/Model/InstallerFactory.php
2 parents 670849f + 377b568 commit c17882d

File tree

7 files changed

+105
-3
lines changed

7 files changed

+105
-3
lines changed

setup/pub/magento/setup/add-database.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ angular.module('add-database', ['ngStorage'])
2222
$http.post('index.php/database-check', $scope.db)
2323
.success(function (data) {
2424
$scope.testConnection.result = data;
25-
if (!(($scope.testConnection.result !== undefined) && (!$scope.testConnection.result.success))) {
25+
if ($scope.testConnection.result.success) {
2626
$scope.nextState();
2727
}
28+
})
29+
.error(function (data) {
30+
$scope.testConnection.failed = data;
2831
});
2932
};
3033

setup/pub/magento/setup/readiness-check.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ angular.module('readiness-check', [])
3232
processed: false,
3333
expanded: false
3434
};
35+
$scope.rawpost = {
36+
visible: false,
37+
processed: false,
38+
expanded: false
39+
};
3540
$scope.extensions = {
3641
visible: false,
3742
processed: false,
@@ -57,6 +62,19 @@ angular.module('readiness-check', [])
5762
$scope.stopProgress();
5863
}
5964
},
65+
'php-rawpost': {
66+
url:'index.php/environment/php-rawpost',
67+
show: function() {
68+
$scope.startProgress();
69+
$scope.rawpost.visible = true;
70+
},
71+
process: function(data) {
72+
$scope.rawpost.processed = true;
73+
angular.extend($scope.rawpost, data);
74+
$scope.updateOnProcessed($scope.rawpost.responseType);
75+
$scope.stopProgress();
76+
}
77+
},
6078
'php-extensions': {
6179
url:'index.php/environment/php-extensions',
6280
show: function() {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ public function __construct(
317317
$this->installer = $installerFactory->create($consoleLogger);
318318
$this->maintenanceMode = $maintenanceMode;
319319
$this->objectManagerProvider = $objectManagerProvider;
320+
// By default we use our customized error handler, but for CLI we want to display all errors
321+
restore_error_handler();
320322
}
321323

322324
/**

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,29 @@ public function phpVersionAction()
8787
return new JsonModel($data);
8888
}
8989

90+
/**
91+
* Checks if PHP version >= 5.6.0 and always_populate_raw_post_data is set
92+
*
93+
* @return JsonModel
94+
*/
95+
public function phpRawpostAction()
96+
{
97+
$iniSetting = ini_get('always_populate_raw_post_data');
98+
$responseType = ResponseTypeInterface::RESPONSE_TYPE_SUCCESS;
99+
if (version_compare(PHP_VERSION, '5.6.0') >= 0 && (int)$iniSetting > -1) {
100+
$responseType = ResponseTypeInterface::RESPONSE_TYPE_ERROR;
101+
}
102+
$data = [
103+
'responseType' => $responseType,
104+
'data' => [
105+
'version' => PHP_VERSION,
106+
'ini' => ini_get('always_populate_raw_post_data')
107+
]
108+
];
109+
110+
return new JsonModel($data);
111+
}
112+
90113
/**
91114
* Verifies php verifications
92115
*

setup/src/Magento/Setup/Model/InstallerFactory.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use Zend\ServiceManager\ServiceLocatorInterface;
1010
use Magento\Setup\Module\ResourceFactory;
11+
use Magento\Framework\App\ErrorHandler;
1112

1213
class InstallerFactory
1314
{
@@ -33,6 +34,9 @@ public function __construct(ServiceLocatorInterface $serviceLocator, ResourceFac
3334
{
3435
$this->serviceLocator = $serviceLocator;
3536
$this->resourceFactory = $resourceFactory;
37+
// For Setup Wizard we are using our customized error handler
38+
$handler = new ErrorHandler();
39+
set_error_handler([$handler, 'handler']);
3640
}
3741

3842
/**

setup/view/magento/setup/add-database.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
</div>
4545
<div
4646
class="alert alert-info"
47-
ng-show="testConnection.result.success === undefined && testConnection.result !== undefined"
47+
ng-show="testConnection.failed !== undefined"
4848
>
4949
<span class="alert-icon icon-failed-round"></span>
50-
<span class="alert-text">Unknown Database Server Host.</span>
50+
<span class="alert-text">{{testConnection.failed}}</span>
5151
</div>
5252

5353
<form

setup/view/magento/setup/readiness-check/progress.phtml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,58 @@
8888

8989
</div>
9090

91+
<div id="php-rawpost" class="rediness-check-item" ng-show="rawpost.visible">
92+
93+
<h3 class="readiness-check-title" ng-hide="version.processed">
94+
Checking PHP Settings...
95+
</h3>
96+
97+
<div ng-show="rawpost.processed" ng-switch="rawpost.responseType">
98+
99+
<div ng-switch-when="success" ng-init="updateOnSuccess(rawpost)">
100+
101+
<span class="readiness-check-icon icon-success-round"></span>
102+
103+
<div class="readiness-check-content">
104+
<h3 class="readiness-check-title">PHP Settings Check</h3>
105+
<p>
106+
Your PHP setting is correct.
107+
</p>
108+
</div>
109+
110+
</div>
111+
112+
<div class="readiness-check-item" ng-switch-default ng-init="updateOnError(rawpost)">
113+
114+
<div class="rediness-check-side">
115+
<p class="side-title">Need Help?</p>
116+
<a href="http://php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data" target="_blank">PHP Documentation</a>
117+
</div>
118+
119+
<span class="readiness-check-icon icon-failed-round"></span>
120+
121+
<div class="readiness-check-content">
122+
<h3 class="readiness-check-title">PHP Settings Check</h3>
123+
<p>
124+
Your PHP Version is {{rawpost.data.version}}, but always_populate_raw_post_data = {{rawpost.data.ini}}.
125+
<a href="#php-rawpost" ng-click="updateOnExpand(rawpost)">
126+
<span ng-hide="rawpost.expanded">Show detail</span>
127+
<span ng-show="rawpost.expanded">Hide detail</span>
128+
</a>
129+
</p>
130+
<p ng-show="rawpost.expanded">
131+
$HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will stop the installer from running.
132+
Please open your php.ini file and set always_populate_raw_post_data to -1.
133+
</p>
134+
<p ng-show="rawpost.expanded">If you need more help please call your hosting provider.</p>
135+
</div>
136+
137+
</div>
138+
139+
</div>
140+
141+
</div>
142+
91143
<div id="php-extensions" class="rediness-check-item" ng-show="extensions.visible">
92144

93145
<h3 ng-hide="extensions.processed" class="readiness-check-title">

0 commit comments

Comments
 (0)