How can i put condition of maintenance mode in index file or Bootstap file in magento 2?
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
2
down vote
favorite
How can i put condition of maintenance mode in index file or Bootstap
file in magento 2 ?
I want to check if Maintenance mode i enable or disable conditional base.
How can i check that in Index.php file or Bootstrap.php file in Magento 2 ?
magento2 maintenance maintenance-flag
add a comment |Â
up vote
2
down vote
favorite
How can i put condition of maintenance mode in index file or Bootstap
file in magento 2 ?
I want to check if Maintenance mode i enable or disable conditional base.
How can i check that in Index.php file or Bootstrap.php file in Magento 2 ?
magento2 maintenance maintenance-flag
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
How can i put condition of maintenance mode in index file or Bootstap
file in magento 2 ?
I want to check if Maintenance mode i enable or disable conditional base.
How can i check that in Index.php file or Bootstrap.php file in Magento 2 ?
magento2 maintenance maintenance-flag
How can i put condition of maintenance mode in index file or Bootstap
file in magento 2 ?
I want to check if Maintenance mode i enable or disable conditional base.
How can i check that in Index.php file or Bootstrap.php file in Magento 2 ?
magento2 maintenance maintenance-flag
magento2 maintenance maintenance-flag
asked 42 mins ago
Aditya Shah
1,492422
1,492422
add a comment |Â
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
1
down vote
accepted
Try to use this code :
<?php
error_reporting(1);
ini_set('max_execution_time', 0);
use MagentoFrameworkAppBootstrap;
require __DIR__ . '/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$instance = MagentoFrameworkAppObjectManager::getInstance();
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$maintenanceMode = $instance ->get('MagentoFrameworkAppMaintenanceMode');
$flag = $maintenanceMode->isOn();
It maybe helpful for you.
Thanks @Rohan for the answer +1 :) let me try .
â Aditya Shah
36 mins ago
Is it index.php file @rohan ?
â Aditya Shah
35 mins ago
Please check my answer with code. You can use it in index.php
â Mage2Dev
34 mins ago
Yes. You can use in root file.
â Rohan Hapani
34 mins ago
1
Happy to help :) Happy Coding !!
â Rohan Hapani
27 mins ago
 |Â
show 1 more comment
up vote
1
down vote
If var/.maintenance.flag file does not exist, Magento operates normally, and maintenance mode is off. If it exists, maintenance mode is on. So you can write code for the same.
$objManager = MagentoFrameworkAppObjectManager::getInstance();
$maintenanceMode = $objManager->get('MagentoFrameworkAppMaintenanceMode');
$flag = $maintenanceMode->isOn();
thanks for the answer +1 !
â Aditya Shah
28 mins ago
add a comment |Â
up vote
1
down vote
Put below code in your index.php file
$obj = $bootstrap->getObjectManager();
$state = $obj->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$maintenanceMode = $obj ->get('MagentoFrameworkAppMaintenanceMode');
$flag = $maintenanceMode->set(1);
thanks for the answer +1 !
â Aditya Shah
27 mins ago
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Try to use this code :
<?php
error_reporting(1);
ini_set('max_execution_time', 0);
use MagentoFrameworkAppBootstrap;
require __DIR__ . '/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$instance = MagentoFrameworkAppObjectManager::getInstance();
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$maintenanceMode = $instance ->get('MagentoFrameworkAppMaintenanceMode');
$flag = $maintenanceMode->isOn();
It maybe helpful for you.
Thanks @Rohan for the answer +1 :) let me try .
â Aditya Shah
36 mins ago
Is it index.php file @rohan ?
â Aditya Shah
35 mins ago
Please check my answer with code. You can use it in index.php
â Mage2Dev
34 mins ago
Yes. You can use in root file.
â Rohan Hapani
34 mins ago
1
Happy to help :) Happy Coding !!
â Rohan Hapani
27 mins ago
 |Â
show 1 more comment
up vote
1
down vote
accepted
Try to use this code :
<?php
error_reporting(1);
ini_set('max_execution_time', 0);
use MagentoFrameworkAppBootstrap;
require __DIR__ . '/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$instance = MagentoFrameworkAppObjectManager::getInstance();
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$maintenanceMode = $instance ->get('MagentoFrameworkAppMaintenanceMode');
$flag = $maintenanceMode->isOn();
It maybe helpful for you.
Thanks @Rohan for the answer +1 :) let me try .
â Aditya Shah
36 mins ago
Is it index.php file @rohan ?
â Aditya Shah
35 mins ago
Please check my answer with code. You can use it in index.php
â Mage2Dev
34 mins ago
Yes. You can use in root file.
â Rohan Hapani
34 mins ago
1
Happy to help :) Happy Coding !!
â Rohan Hapani
27 mins ago
 |Â
show 1 more comment
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Try to use this code :
<?php
error_reporting(1);
ini_set('max_execution_time', 0);
use MagentoFrameworkAppBootstrap;
require __DIR__ . '/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$instance = MagentoFrameworkAppObjectManager::getInstance();
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$maintenanceMode = $instance ->get('MagentoFrameworkAppMaintenanceMode');
$flag = $maintenanceMode->isOn();
It maybe helpful for you.
Try to use this code :
<?php
error_reporting(1);
ini_set('max_execution_time', 0);
use MagentoFrameworkAppBootstrap;
require __DIR__ . '/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$instance = MagentoFrameworkAppObjectManager::getInstance();
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$maintenanceMode = $instance ->get('MagentoFrameworkAppMaintenanceMode');
$flag = $maintenanceMode->isOn();
It maybe helpful for you.
answered 38 mins ago
Rohan Hapani
3,46211456
3,46211456
Thanks @Rohan for the answer +1 :) let me try .
â Aditya Shah
36 mins ago
Is it index.php file @rohan ?
â Aditya Shah
35 mins ago
Please check my answer with code. You can use it in index.php
â Mage2Dev
34 mins ago
Yes. You can use in root file.
â Rohan Hapani
34 mins ago
1
Happy to help :) Happy Coding !!
â Rohan Hapani
27 mins ago
 |Â
show 1 more comment
Thanks @Rohan for the answer +1 :) let me try .
â Aditya Shah
36 mins ago
Is it index.php file @rohan ?
â Aditya Shah
35 mins ago
Please check my answer with code. You can use it in index.php
â Mage2Dev
34 mins ago
Yes. You can use in root file.
â Rohan Hapani
34 mins ago
1
Happy to help :) Happy Coding !!
â Rohan Hapani
27 mins ago
Thanks @Rohan for the answer +1 :) let me try .
â Aditya Shah
36 mins ago
Thanks @Rohan for the answer +1 :) let me try .
â Aditya Shah
36 mins ago
Is it index.php file @rohan ?
â Aditya Shah
35 mins ago
Is it index.php file @rohan ?
â Aditya Shah
35 mins ago
Please check my answer with code. You can use it in index.php
â Mage2Dev
34 mins ago
Please check my answer with code. You can use it in index.php
â Mage2Dev
34 mins ago
Yes. You can use in root file.
â Rohan Hapani
34 mins ago
Yes. You can use in root file.
â Rohan Hapani
34 mins ago
1
1
Happy to help :) Happy Coding !!
â Rohan Hapani
27 mins ago
Happy to help :) Happy Coding !!
â Rohan Hapani
27 mins ago
 |Â
show 1 more comment
up vote
1
down vote
If var/.maintenance.flag file does not exist, Magento operates normally, and maintenance mode is off. If it exists, maintenance mode is on. So you can write code for the same.
$objManager = MagentoFrameworkAppObjectManager::getInstance();
$maintenanceMode = $objManager->get('MagentoFrameworkAppMaintenanceMode');
$flag = $maintenanceMode->isOn();
thanks for the answer +1 !
â Aditya Shah
28 mins ago
add a comment |Â
up vote
1
down vote
If var/.maintenance.flag file does not exist, Magento operates normally, and maintenance mode is off. If it exists, maintenance mode is on. So you can write code for the same.
$objManager = MagentoFrameworkAppObjectManager::getInstance();
$maintenanceMode = $objManager->get('MagentoFrameworkAppMaintenanceMode');
$flag = $maintenanceMode->isOn();
thanks for the answer +1 !
â Aditya Shah
28 mins ago
add a comment |Â
up vote
1
down vote
up vote
1
down vote
If var/.maintenance.flag file does not exist, Magento operates normally, and maintenance mode is off. If it exists, maintenance mode is on. So you can write code for the same.
$objManager = MagentoFrameworkAppObjectManager::getInstance();
$maintenanceMode = $objManager->get('MagentoFrameworkAppMaintenanceMode');
$flag = $maintenanceMode->isOn();
If var/.maintenance.flag file does not exist, Magento operates normally, and maintenance mode is off. If it exists, maintenance mode is on. So you can write code for the same.
$objManager = MagentoFrameworkAppObjectManager::getInstance();
$maintenanceMode = $objManager->get('MagentoFrameworkAppMaintenanceMode');
$flag = $maintenanceMode->isOn();
answered 39 mins ago
Mage2Dev
3,1421919
3,1421919
thanks for the answer +1 !
â Aditya Shah
28 mins ago
add a comment |Â
thanks for the answer +1 !
â Aditya Shah
28 mins ago
thanks for the answer +1 !
â Aditya Shah
28 mins ago
thanks for the answer +1 !
â Aditya Shah
28 mins ago
add a comment |Â
up vote
1
down vote
Put below code in your index.php file
$obj = $bootstrap->getObjectManager();
$state = $obj->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$maintenanceMode = $obj ->get('MagentoFrameworkAppMaintenanceMode');
$flag = $maintenanceMode->set(1);
thanks for the answer +1 !
â Aditya Shah
27 mins ago
add a comment |Â
up vote
1
down vote
Put below code in your index.php file
$obj = $bootstrap->getObjectManager();
$state = $obj->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$maintenanceMode = $obj ->get('MagentoFrameworkAppMaintenanceMode');
$flag = $maintenanceMode->set(1);
thanks for the answer +1 !
â Aditya Shah
27 mins ago
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Put below code in your index.php file
$obj = $bootstrap->getObjectManager();
$state = $obj->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$maintenanceMode = $obj ->get('MagentoFrameworkAppMaintenanceMode');
$flag = $maintenanceMode->set(1);
Put below code in your index.php file
$obj = $bootstrap->getObjectManager();
$state = $obj->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$maintenanceMode = $obj ->get('MagentoFrameworkAppMaintenanceMode');
$flag = $maintenanceMode->set(1);
answered 29 mins ago
Ansar Husain
1,351217
1,351217
thanks for the answer +1 !
â Aditya Shah
27 mins ago
add a comment |Â
thanks for the answer +1 !
â Aditya Shah
27 mins ago
thanks for the answer +1 !
â Aditya Shah
27 mins ago
thanks for the answer +1 !
â Aditya Shah
27 mins ago
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f242975%2fhow-can-i-put-condition-of-maintenance-mode-in-index-file-or-bootstap-file-in-ma%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password