Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
setup
src
Magento
Setup
Model
Cron
JobSetMaintenanceMode.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Setup\Model\Cron
;
7
8
use
Magento\Setup\Console\Command\AbstractSetupCommand
;
9
use
Magento\Setup\Console\Command\MaintenanceDisableCommand
;
10
use
Magento\Setup\Model\ObjectManagerProvider
;
11
use Symfony\Component\Console\Input\ArrayInput;
12
use Symfony\Component\Console\Output\OutputInterface;
13
17
class
JobSetMaintenanceMode
extends
AbstractJob
18
{
29
public
function
__construct
(
30
AbstractSetupCommand
$command
,
31
ObjectManagerProvider
$objectManagerProvider,
32
OutputInterface
$output
,
33
Status
$status
,
34
$name
,
35
$params
= []
36
) {
37
$this->command =
$command
;
38
parent::__construct(
$output
,
$status
, $objectManagerProvider,
$name
,
$params
);
39
}
40
47
public
function
execute
()
48
{
49
if
($this->command instanceof
MaintenanceDisableCommand
&& $this->command->
isSetAddressInfo
()) {
50
// Maintenance mode should not be unset from updater application if it was set manually by the admin
51
throw
new \RuntimeException(
52
$this->getExceptionMessage(
53
'Magento maintenance mode was not disabled. It can be disabled from the Magento Backend.'
54
)
55
);
56
}
57
58
try
{
59
// Prepare the arguments to invoke Symfony run()
60
$arguments
[
'command'
] = $this->getCommand();
61
$this->command->run(
new
ArrayInput(
$arguments
), $this->
output
);
62
}
catch
(\
Exception
$e) {
63
$this->status->toggleUpdateError(
true
);
64
throw
new \RuntimeException(
65
$this->getExceptionMessage($e->getMessage())
66
);
67
}
68
}
69
76
private
function
getExceptionMessage($msg)
77
{
78
return
sprintf(
'Could not complete %s successfully: %s'
, $this, $msg);
79
}
80
86
private
function
getCommand()
87
{
88
return
$this->
getName
() ===
'setup:maintenance:enable'
?
'maintenance:enable'
:
'maintenance:disable'
;
89
}
90
}
Magento\Setup\Console\Command\AbstractSetupCommand
Definition:
AbstractSetupCommand.php:16
Magento\Setup\Model\Cron\AbstractJob\$command
$command
Definition:
AbstractJob.php:20
output
output($string, $level=INFO, $label='')
Definition:
pre_composer_update_2.3.php:389
Magento\Setup\Model\ObjectManagerProvider
Definition:
ObjectManagerProvider.php:22
Magento\Setup\Model\Cron\AbstractJob\$output
$output
Definition:
AbstractJob.php:25
Magento\Setup\Model\Cron\AbstractJob
Definition:
AbstractJob.php:15
Magento\Setup\Console\Command\MaintenanceDisableCommand
Definition:
MaintenanceDisableCommand.php:12
Magento\Setup\Model\Cron\JobSetMaintenanceMode\__construct
__construct(AbstractSetupCommand $command, ObjectManagerProvider $objectManagerProvider, OutputInterface $output, Status $status, $name, $params=[])
Definition:
JobSetMaintenanceMode.php:29
Magento\Setup\Model\Cron
Definition:
MultipleStreamOutputTest.php:6
Magento\Setup\Model\Cron\JobSetMaintenanceMode
Definition:
JobSetMaintenanceMode.php:17
Magento\Setup\Model\Cron\AbstractJob\$params
$params
Definition:
AbstractJob.php:35
Magento\Setup\Model\Cron\JobSetMaintenanceMode\execute
execute()
Definition:
JobSetMaintenanceMode.php:47
Magento\Setup\Model\Cron\Status
Definition:
Status.php:21
Magento\Setup\Model\Cron\AbstractJob\$status
$status
Definition:
AbstractJob.php:50
Magento\Setup\Exception
Definition:
Exception.php:14
$arguments
$arguments
Definition:
final_price.phtml:24
Magento\Setup\Console\Command\MaintenanceDisableCommand\isSetAddressInfo
isSetAddressInfo()
Definition:
MaintenanceDisableCommand.php:50
Magento\Setup\Model\Cron\AbstractJob\getName
getName()
Definition:
AbstractJob.php:88
Magento\Setup\Model\Cron\AbstractJob\$name
$name
Definition:
AbstractJob.php:30