Last active
August 23, 2019 00:41
-
-
Save aleron75/9d6609e99153d19461f3 to your computer and use it in GitHub Desktop.
Magento runtime for Administrator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Prevent this script to be called via HTTP | |
if (isset($_SERVER['REQUEST_METHOD'])) | |
{ | |
die('Permission denied.'); | |
} | |
// Avoid any time limit | |
set_time_limit(0); | |
// Avoid any memory limit | |
ini_set('memory_limit', -1); | |
// Include bootstrap code and Mage class | |
require_once 'app/Mage.php'; | |
// Enable developer mode | |
Mage::setIsDeveloperMode(true); | |
// Set the default file creation mask | |
umask(0); | |
// Init application with default store | |
Mage::app(); | |
// Init admin store | |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); | |
// Load adminhtml config area | |
Mage::app()->loadArea(Mage_Core_Model_App_Area::AREA_ADMINHTML); | |
// Initialize administrator session | |
$userModel = Mage::getModel('admin/user'); | |
$administrator = $userModel->load(1); // change administrator id here | |
$adminSession = Mage::getSingleton('admin/session'); | |
$adminSession->renewSession(); | |
$adminSession->setUser($administrator); | |
$acl = Mage::getResourceModel('admin/acl')->loadAcl(); | |
$adminSession->setAcl($acl); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment