public function clearCache($observer) { // this part for flush magento cache $tags = $observer->getTags(); $rewriter = new Aitoc_Aitsys_Model_Rewriter(); if (null !== $tags) { if (empty($tags) || !is_array($tags) || in_array('aitsys', $tags)) { $rewriter->prepare(); } } // this part for mass refresh $cacheTypes = Mage::app()->getRequest()->getParam('types'); if ($cacheTypes) { $cacheTypesArray = $cacheTypes; if (!is_array($cacheTypesArray)) { $cacheTypesArray = array($cacheTypesArray); } if (in_array('aitsys', $cacheTypesArray)) { $rewriter->prepare(); } } // this part is for flush cache storage if (null === $cacheTypes && null === $tags) { $rewriter->prepare(); } }
public static function register2($stopProcessing = false) { if (!$stopProcessing && !self::$_registered) { $rewriter = new Aitoc_Aitsys_Model_Rewriter(); $rewriter->preRegisterAutoloader(); // unregistering all autoloaders to make our performing first $autoloaders = spl_autoload_functions(); $firstAutoloader = $autoloaders[0]; // EXTENDWARE CHANGE if ($autoloaders && is_array($autoloaders) && !empty($autoloaders)) { foreach ($autoloaders as $autoloader) { spl_autoload_unregister($autoloader); } } // EXTENDWARE CHANGE if (is_callable($firstAutoloader)) { spl_autoload_register($firstAutoloader, false); } // register our autoloader spl_autoload_register(array(self::instance(), 'autoload'), false); // register 1.3.1 and older autoloader if (version_compare(Mage::getVersion(), '1.3.1', 'le')) { spl_autoload_register(array(self::instance(), 'performStandardAutoload'), true); } // register back all unregistered autoloaders if ($autoloaders && is_array($autoloaders) && !empty($autoloaders)) { foreach ($autoloaders as $autoloader) { spl_autoload_register($autoloader, is_array($autoloader) && $autoloader[0] instanceof Varien_Autoload); } } self::$_registered = true; } }
public function clearCache($observer) { //not clear if rewriter is disabled if (Mage::getConfig()->getNode('default/aitsys/rewriter_status') != 1) { return false; } // this part for flush magento cache $tags = $observer->getTags(); $rewriter = new Aitoc_Aitsys_Model_Rewriter(); if (null !== $tags) { if (empty($tags) || !is_array($tags) || in_array('aitsys', $tags)) { return $rewriter->prepare(); } } // this part for mass refresh $cacheTypes = Mage::app()->getRequest()->getParam('types'); if ($cacheTypes) { $cacheTypesArray = $cacheTypes; if (!is_array($cacheTypesArray)) { $cacheTypesArray = array($cacheTypesArray); } if (in_array('aitsys', $cacheTypesArray)) { return $rewriter->prepare(); } } // this part is for flush cache storage if (null === $cacheTypes && null === $tags) { return $rewriter->prepare(); } }
public function enableAction() { Mage::getModel('core/config')->saveConfig('aitsys/rewriter_status', 1); Mage::app()->cleanCache(); Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('compiler')->__('Rewriter is enabled.')); //flash rewriter cache $rewriter = new Aitoc_Aitsys_Model_Rewriter(); $rewriter->prepare(); $this->_redirect('*/*/'); }
public function autoload($class) { if (in_array($class, array_keys($this->_rewriteConfig))) { $classFile = $this->_rewriteDir . $this->_rewriteConfig[$class] . '.php'; try { return include $classFile; } catch (Exception $e) { if (!file_exists($classFile)) { $rewriter = new Aitoc_Aitsys_Model_Rewriter(); $rewriter->prepare(); return $this->autoload($class); } throw $e; } } return false; }
public function autoload($class) { if (in_array($class, array_keys($this->_rewriteConfig))) { $classFile = $this->_rewriteDir . $this->_rewriteConfig[$class] . '.php'; try { return include $classFile; } catch (Exception $e) { if (!file_exists($classFile)) { $rewriter = new Aitoc_Aitsys_Model_Rewriter(); $rewriter->prepare(); return $this->autoload($class); } throw $e; } } /* should work now without this fix foreach ($this->_aitocDirs as $dir) { if (stristr($class,$dir)) { if (!class_exists($class, false)) { $file = uc_words($class,DS).'.php'; if(function_exists('apc_cache_info') && $cache=@apc_cache_info() ) { if(apc_compile_file($file)) { return false; //or apc_delete_file($file); } } return include $file; } } } */ return false; }