Skip to content

Instantly share code, notes, and snippets.

@aleron75
Last active August 23, 2019 00:41
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aleron75/9d6609e99153d19461f3 to your computer and use it in GitHub Desktop.
Save aleron75/9d6609e99153d19461f3 to your computer and use it in GitHub Desktop.
Magento runtime for Administrator
<?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