_isLocked() || !Mage::helper('aw_hdu3/config')->isEnabled() ) { return $this; } $departmentCollection = Mage::getModel('aw_hdu3/department')->getCollection(); $departmentCollection ->addActiveFilter() ->sortByOrder() ; foreach ($departmentCollection as $department) { /** @var AW_Helpdesk3_Model_Gateway $gateway */ $gateway = $department->getGateway(); if (!$gateway->getIsActive()) { continue; } AW_Lib_Helper_Log::start(Mage::helper('aw_hdu3')->__('Start process gateway "%s".', $gateway->getTitle())); try { $gateway->load($gateway->getId()); $gateway->process(); } catch (Exception $e) { AW_Lib_Helper_Log::log($e->getMessage(), AW_Lib_Helper_Log::SEVERITY_ERROR); } AW_Lib_Helper_Log::stop(Mage::helper('aw_hdu3')->__('Stop process gateway "%s".', $gateway->getTitle())); } //remove lock Mage::app()->removeCache(self::LOCK_CACHE_ID); return $this; } /** * set lock * * @return bool */ protected function _isLocked() { if (Mage::app()->loadCache(self::LOCK_CACHE_ID)) { return true; } Mage::app()->saveCache(time(), self::LOCK_CACHE_ID, array(), self::LOCK_CACHE_LIFETIME); return false; } }