Skip to content

fixed issue of Backup tool not correctly detecting .maintenance.flag #19993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ public function execute()
$this->_coreRegistry->register('backup_manager', $backupManager);

if ($this->getRequest()->getParam('maintenance_mode')) {
if (!$this->maintenanceMode->set(true)) {
$this->maintenanceMode->set(true);

if (!$this->maintenanceMode->isOn()) {
$response->setError(
__(
'You need more permissions to activate maintenance mode right now.'
Expand Down
10 changes: 8 additions & 2 deletions app/code/Magento/Backup/Controller/Adminhtml/Index/Rollback.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
*/
namespace Magento\Backup\Controller\Adminhtml\Index;

use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Filesystem;

/**
* Backup rollback controller.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Rollback extends \Magento\Backup\Controller\Adminhtml\Index
class Rollback extends \Magento\Backup\Controller\Adminhtml\Index implements HttpPostActionInterface
{
/**
* Rollback Action
Expand Down Expand Up @@ -82,7 +85,9 @@ public function execute()
}

if ($this->getRequest()->getParam('maintenance_mode')) {
if (!$this->maintenanceMode->set(true)) {
$this->maintenanceMode->set(true);

if (!$this->maintenanceMode->isOn()) {
$response->setError(
__(
'You need more permissions to activate maintenance mode right now.'
Expand Down Expand Up @@ -122,6 +127,7 @@ public function execute()
$adminSession->destroy();

$response->setRedirectUrl($this->getUrl('*'));
// phpcs:disable Magento2.Exceptions.ThrowCatch
} catch (\Magento\Framework\Backup\Exception\CantLoadSnapshot $e) {
$errorMsg = __('We can\'t find the backup file.');
} catch (\Magento\Framework\Backup\Exception\FtpConnectionFailed $e) {
Expand Down