From 310e7b01ea94f28304341da535ec1eb2b9bc8289 Mon Sep 17 00:00:00 2001 From: Michal Malinowski Date: Tue, 6 Jan 2015 09:57:22 +0000 Subject: [PATCH 1/3] added install.log file check and create on open function to prevent installation error due to not created log file (reproduced several times by Trying Install Again without refresh installation process page after other error) --- setup/module/Magento/Setup/src/Model/WebLogger.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/setup/module/Magento/Setup/src/Model/WebLogger.php b/setup/module/Magento/Setup/src/Model/WebLogger.php index 28dde3a0b2b76..d25069ae5a097 100644 --- a/setup/module/Magento/Setup/src/Model/WebLogger.php +++ b/setup/module/Magento/Setup/src/Model/WebLogger.php @@ -56,7 +56,11 @@ public function __construct() */ private function open($mode) { - $this->resource = fopen($this->logFile, $mode); + if (!file_exists($this->logFile) && !is_resource($this->resource)) { + $this->resource = fopen($this->logFile, 'w'); + } else { + $this->resource = fopen($this->logFile, $mode); + } } /** @@ -66,7 +70,10 @@ private function open($mode) */ private function close() { - fclose($this->resource); + // Do a check to prevent warinig in console + if (is_resource($this->resource)) { + fclose($this->resource); + } } /** From ca1599aeb5ecc4a4531628cef2cbc04c2f033c60 Mon Sep 17 00:00:00 2001 From: Michal Malinowski Date: Tue, 6 Jan 2015 11:30:57 +0000 Subject: [PATCH 2/3] created default system message when there is no system message exstisting anymore (most probably have been fixed and page wasn't refreshed) --- .../Controller/Adminhtml/System/Message/ListAction.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message/ListAction.php b/app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message/ListAction.php index 3707100db4c85..5a59a9b2f3fc5 100644 --- a/app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message/ListAction.php +++ b/app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message/ListAction.php @@ -13,6 +13,11 @@ class ListAction extends \Magento\Backend\App\AbstractAction public function execute() { $severity = $this->getRequest()->getParam('severity'); + $default = array( + 'severity' => $severity, + 'text' => 'All recent issues have been fixed. Please refresh the screen for an update.' + ); + $messageCollection = $this->_objectManager->get( 'Magento\AdminNotification\Model\Resource\System\Message\Collection' ); @@ -23,6 +28,11 @@ public function execute() foreach ($messageCollection->getItems() as $item) { $result[] = ['severity' => $item->getSeverity(), 'text' => $item->getText()]; } + + if (empty($result)) { + $result[] = $default; + } + $this->getResponse()->representJson( $this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result) ); From d88354beb03294e2f86c5fc58ab4d447f8a4c287 Mon Sep 17 00:00:00 2001 From: Michal Malinowski Date: Tue, 6 Jan 2015 14:22:13 +0000 Subject: [PATCH 3/3] fixed php standards test failture --- .../Adminhtml/System/Message/ListAction.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message/ListAction.php b/app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message/ListAction.php index 5a59a9b2f3fc5..60c34f1ed3fd9 100644 --- a/app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message/ListAction.php +++ b/app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message/ListAction.php @@ -1,5 +1,5 @@ getRequest()->getParam('severity'); - $default = array( - 'severity' => $severity, - 'text' => 'All recent issues have been fixed. Please refresh the screen for an update.' - ); - + $default = array( + 'severity' => $severity, + 'text' => 'All recent issues have been fixed. Please refresh the screen for an update.' + ); + $messageCollection = $this->_objectManager->get( 'Magento\AdminNotification\Model\Resource\System\Message\Collection' ); @@ -28,11 +28,11 @@ public function execute() foreach ($messageCollection->getItems() as $item) { $result[] = ['severity' => $item->getSeverity(), 'text' => $item->getText()]; } - - if (empty($result)) { - $result[] = $default; - } - + + if (empty($result)) { + $result[] = $default; + } + $this->getResponse()->representJson( $this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result) );