Skip to content

Commit 9c1711b

Browse files
author
Kopylova,Olga(okopylova)
committed
Merge pull request #117 from magento-ogre/PR_Branch
[Ogres] Bug Fixes
2 parents bd4407c + 7faa207 commit 9c1711b

File tree

12 files changed

+130
-50
lines changed

12 files changed

+130
-50
lines changed

app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ public function execute(\Magento\Framework\Event\Observer $observer)
148148
$jobGroupsRoot = $this->_config->getJobs();
149149

150150
foreach ($jobGroupsRoot as $groupId => $jobsRoot) {
151-
if ($this->_request->getParam('group') !== null && $this->_request->getParam('group') != $groupId) {
151+
if ($this->_request->getParam('group') !== null
152+
&& $this->_request->getParam('group') !== '\'' . ($groupId) . '\''
153+
&& $this->_request->getParam('group') !== $groupId) {
152154
continue;
153155
}
154156
if (($this->_request->getParam(self::STANDALONE_PROCESS_STARTED) !== '1') && (

lib/internal/Magento/Framework/App/Router/ActionList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ActionList
1313
/**
1414
* Not allowed string in route's action path to avoid disclosing admin url
1515
*/
16-
const NOT_ALLOWED_IN_NAMESPACE_PATH = 'adminhtml_';
16+
const NOT_ALLOWED_IN_NAMESPACE_PATH = 'adminhtml';
1717

1818
/**
1919
* List of application actions

lib/internal/Magento/Framework/Config/Dom.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ public static function validateDomDocument(
276276
$schema,
277277
$errorFormat = self::ERROR_FORMAT_DEFAULT
278278
) {
279+
if (!function_exists('libxml_set_external_entity_loader')) {
280+
return [];
281+
}
282+
279283
if (!self::$urnResolver) {
280284
self::$urnResolver = new UrnResolver();
281285
}

lib/internal/Magento/Framework/Console/Cli.php

Lines changed: 53 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
use Magento\Framework\App\Bootstrap;
1212
use Magento\Framework\Shell\ComplexParameter;
1313
use Symfony\Component\Console\Input\ArgvInput;
14+
use Symfony\Component\Console\Input\InputInterface;
15+
use Symfony\Component\Console\Output\OutputInterface;
1416

1517
/**
1618
* Magento2 CLI Application. This is the hood for all command line tools supported by Magento.
@@ -27,6 +29,34 @@ class Cli extends SymfonyApplication
2729
/** @var \Zend\ServiceManager\ServiceManager */
2830
private $serviceManager;
2931

32+
/**
33+
* Initialization exception
34+
*
35+
* @var \Exception
36+
*/
37+
private $initException;
38+
39+
/**
40+
* Process an error happened during initialization of commands, if any
41+
*
42+
* @param InputInterface $input
43+
* @param OutputInterface $output
44+
* @return int
45+
* @throws \Exception
46+
*/
47+
public function doRun(InputInterface $input, OutputInterface $output)
48+
{
49+
$exitCode = parent::doRun($input, $output);
50+
if ($this->initException) {
51+
$output->writeln(
52+
"<error>We're sorry, an error occurred. Try clearing the cache and code generation directories. "
53+
. "By default, they are: var/cache, var/di, var/generation, and var/page_cache.</error>"
54+
);
55+
throw $this->initException;
56+
}
57+
return $exitCode;
58+
}
59+
3060
/**
3161
* @param string $name The name of the application
3262
* @param string $version The version of the application
@@ -61,38 +91,33 @@ protected function getDefaultCommands()
6191
*/
6292
protected function getApplicationCommands()
6393
{
64-
$setupCommands = [];
65-
$modulesCommands = [];
94+
$commands = [];
95+
try {
96+
$bootstrapParam = new ComplexParameter(self::INPUT_KEY_BOOTSTRAP);
97+
$params = $bootstrapParam->mergeFromArgv($_SERVER, $_SERVER);
98+
$params[Bootstrap::PARAM_REQUIRE_MAINTENANCE] = null;
99+
$bootstrap = Bootstrap::create(BP, $params);
100+
$objectManager = $bootstrap->getObjectManager();
101+
/** @var \Magento\Setup\Model\ObjectManagerProvider $omProvider */
102+
$omProvider = $this->serviceManager->get('Magento\Setup\Model\ObjectManagerProvider');
103+
$omProvider->setObjectManager($objectManager);
66104

67-
$bootstrapParam = new ComplexParameter(self::INPUT_KEY_BOOTSTRAP);
68-
$params = $bootstrapParam->mergeFromArgv($_SERVER, $_SERVER);
69-
$params[Bootstrap::PARAM_REQUIRE_MAINTENANCE] = null;
70-
$bootstrap = Bootstrap::create(BP, $params);
71-
$objectManager = $bootstrap->getObjectManager();
72-
/** @var \Magento\Setup\Model\ObjectManagerProvider $omProvider */
73-
$omProvider = $this->serviceManager->get('Magento\Setup\Model\ObjectManagerProvider');
74-
$omProvider->setObjectManager($objectManager);
105+
if (class_exists('Magento\Setup\Console\CommandList')) {
106+
$setupCommandList = new \Magento\Setup\Console\CommandList($this->serviceManager);
107+
$commands = array_merge($commands, $setupCommandList->getCommands());
108+
}
75109

76-
if (class_exists('Magento\Setup\Console\CommandList')) {
77-
$setupCommandList = new \Magento\Setup\Console\CommandList($this->serviceManager);
78-
$setupCommands = $setupCommandList->getCommands();
79-
}
110+
if ($objectManager->get('Magento\Framework\App\DeploymentConfig')->isAvailable()) {
111+
/** @var \Magento\Framework\Console\CommandList $commandList */
112+
$commandList = $objectManager->create('Magento\Framework\Console\CommandList');
113+
$commands = array_merge($commands, $commandList->getCommands());
114+
}
80115

81-
if ($objectManager->get('Magento\Framework\App\DeploymentConfig')->isAvailable()) {
82-
/** @var \Magento\Framework\Console\CommandList $commandList */
83-
$commandList = $objectManager->create('Magento\Framework\Console\CommandList');
84-
$modulesCommands = $commandList->getCommands();
116+
$commands = array_merge($commands, $this->getVendorCommands($objectManager));
117+
} catch (\Exception $e) {
118+
$this->initException = $e;
85119
}
86-
87-
$vendorCommands = $this->getVendorCommands($objectManager);
88-
89-
$commandsList = array_merge(
90-
$setupCommands,
91-
$modulesCommands,
92-
$vendorCommands
93-
);
94-
95-
return $commandsList;
120+
return $commands;
96121
}
97122

98123
/**

nginx.conf.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ location /update {
4949
root $MAGE_ROOT;
5050

5151
location ~ ^/update/index.php {
52+
fastcgi_split_path_info ^(/update/index.php)(/.+)$;
5253
fastcgi_pass fastcgi_backend;
5354
fastcgi_index index.php;
5455
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
56+
fastcgi_param PATH_INFO $fastcgi_path_info;
5557
include fastcgi_params;
5658
}
5759

pub/cron.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,21 @@
1111

1212
require dirname(__DIR__) . '/app/bootstrap.php';
1313

14-
if ($_GET){
15-
$opt = $_GET;
16-
} else {
14+
if (php_sapi_name() === 'cli'){
1715
echo "You cannot run this from the command line." . PHP_EOL .
1816
"Run \"php bin/magento cron:run\" instead." . PHP_EOL;
1917
exit(1);
18+
} else {
19+
$opt = $_GET;
2020
}
2121

2222
try {
2323
if (empty($opt['group'])) {
2424
$opt['group'] = 'default';
2525
}
26+
foreach ($opt as $key => $value) {
27+
$opt[$key] = escapeshellarg($value);
28+
}
2629
$opt['standaloneProcessStarted'] = '0';
2730
$params = $_SERVER;
2831
$params[StoreManager::PARAM_RUN_CODE] = 'admin';

setup/pub/magento/setup/component-grid.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ angular.module('component-grid', ['ngStorage'])
1010
$rootScope.componentsProcessed = false;
1111
$http.get('index.php/componentGrid/components').success(function(data) {
1212
$scope.components = data.components;
13-
$scope.displayComponents = data.components;
1413
$scope.total = data.total;
1514
if(typeof data.lastSyncData.lastSyncDate === "undefined") {
1615
$scope.isOutOfSync = true;
@@ -35,9 +34,6 @@ angular.module('component-grid', ['ngStorage'])
3534
var begin = (($scope.currentPage - 1) * $scope.rowLimit);
3635
var end = parseInt(begin) + parseInt(($scope.rowLimit));
3736
$scope.numberOfPages = Math.ceil($scope.total/$scope.rowLimit);
38-
if ($scope.components !== undefined) {
39-
$scope.displayComponents = $scope.components.slice(begin, end);
40-
}
4137
if ($scope.currentPage > $scope.numberOfPages) {
4238
$scope.currentPage = $scope.numberOfPages;
4339
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,17 @@ public function progressAction()
120120
{
121121
$percent = 0;
122122
$success = false;
123+
$contents = [];
123124
$json = new JsonModel();
125+
126+
// Depending upon the install environment and network latency, there is a possibility that
127+
// "progress" check request may arrive before the Install POST request. In that case
128+
// "install.log" file may not be created yet. Check the "install.log" is created before
129+
// trying to read from it.
130+
if (!$this->log->logfileExists()) {
131+
return $json->setVariables(['progress' => $percent, 'success' => true, 'console' => $contents]);
132+
}
133+
124134
try {
125135
$progress = $this->progressFactory->createFromLog($this->log);
126136
$percent = sprintf('%d', $progress->getRatio() * 100);

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

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace Magento\Setup\Model;
88

99
use Magento\Framework\App\Filesystem\DirectoryList;
10+
use Magento\Framework\Backup\Filesystem\Iterator\Filter;
1011
use Magento\Framework\Filesystem;
1112

1213
class FilePermissions
@@ -118,25 +119,32 @@ public function getInstallationCurrentWritableDirectories()
118119
}
119120

120121
/**
121-
* Check all sub-directories
122+
* Check all sub-directories and files except for var/generation and var/di
122123
*
123124
* @param string $directory
124125
* @return bool
125126
*/
126127
private function checkRecursiveDirectories($directory)
127128
{
128-
$skipDirs = ['..', '.'];
129129
$directoryIterator = new \RecursiveIteratorIterator(
130-
new \RecursiveDirectoryIterator($directory),
131-
\RecursiveIteratorIterator::LEAVES_ONLY | \RecursiveIteratorIterator::CATCH_GET_CHILD
130+
new \RecursiveDirectoryIterator($directory, \RecursiveDirectoryIterator::SKIP_DOTS),
131+
\RecursiveIteratorIterator::CHILD_FIRST
132132
);
133-
foreach ($directoryIterator as $subDirectory) {
134-
if (in_array($subDirectory->getFilename(), $skipDirs)) {
135-
continue;
136-
}
137-
if ($subDirectory->isDir() && !$subDirectory->isWritable()) {
138-
return false;
133+
$noWritableFilesFolders = [
134+
$this->directoryList->getPath(DirectoryList::GENERATION) . '/',
135+
$this->directoryList->getPath(DirectoryList::DI) .'/'
136+
];
137+
138+
$directoryIterator = new Filter($directoryIterator, $noWritableFilesFolders);
139+
140+
try {
141+
foreach ($directoryIterator as $subDirectory) {
142+
if (!$subDirectory->isWritable()) {
143+
return false;
144+
}
139145
}
146+
} catch (\UnexpectedValueException $e) {
147+
return false;
140148
}
141149
return true;
142150
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,16 @@ public function clear()
137137
}
138138
}
139139

140+
/**
141+
* Checks existence of install.log file
142+
*
143+
* @return bool
144+
*/
145+
public function logfileExists()
146+
{
147+
return ($this->directory->isExist($this->logFile));
148+
}
149+
140150
/**
141151
* Terminates line if the inline logging is started
142152
*

0 commit comments

Comments
 (0)