Skip to content

Commit

Permalink
Merge pull request AOEpeople#152 from LeeSaferite/patch-2
Browse files Browse the repository at this point in the history
Fix cron job bootstrap
  • Loading branch information
LeeSaferite committed Aug 17, 2015
2 parents fa744fe + c5b6d44 commit 584cf49
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions shell/scheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ public function run()
} else {
$actionMethodName = $action . 'Action';
if (method_exists($this, $actionMethodName)) {
// Disable use of SID in generated URLs - This is standard for cron job bootstrapping
Mage::app()->setUseSessionInUrl(false);
// Disable permissions masking by default - This is Magento standard, but not recommended for security reasons
umask(0);
// Load the global event area - This is non-standard be should be standard
Mage::app()->addEventArea(Mage_Core_Model_App_Area::AREA_GLOBAL);
// Load the crontab event area - This is standard for cron job bootstrapping
Mage::app()->addEventArea('crontab');
// Run the command
$this->$actionMethodName();
} else {
echo "Action $action not found!\n";
Expand Down Expand Up @@ -342,9 +351,6 @@ public function watchdogAction()
*/
public function cronAction()
{
Mage::app('admin')->setUseSessionInUrl(false);
umask(0);

$mode = $this->getArg('mode');
switch ($mode) {
case 'always':
Expand All @@ -353,8 +359,6 @@ public function cronAction()
$excludeGroups = array_filter(array_map('trim', explode(',', $this->getArg('excludeGroups'))));
$includeJobs = array_filter(array_map('trim', explode(',', $this->getArg('includeJobs'))));
$excludeJobs = array_filter(array_map('trim', explode(',', $this->getArg('excludeJobs'))));
Mage::getConfig()->init()->loadEventObservers('crontab');
Mage::app()->addEventArea('crontab');
Mage::dispatchEvent($mode, array(
'include_groups' => $includeGroups,
'exclude_groups' => $excludeGroups,
Expand Down

0 comments on commit 584cf49

Please sign in to comment.