Question

Je l'extension qui est à l'écoute à l'événement core_layout_block_create_after. Il pourrait être un événement qui est mise à feu dans magento admin. Aussi j'ai instance magento avec le mode compilateur activé. J'ai installé l'extension par magentoconnect. L'installation a réussi et le cache a été nettoyé. Maintenant, après le retour de retour à l'admin je vais obtenir l'erreur:

Mage registry key "_singleton/extension/observer" already exists
 /var/www/magento/trunk/app/Mage.php(222): Mage::throwException('Mage registry k...')
 /var/www/magento/trunk/app/Mage.php(476): Mage::register('_singleton/exte...', false)
 /var/www/magento/trunk/includes/src/__default.php(21023): Mage::getSingleton('extension...')
 /var/www/magento/trunk/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('core_layout_blo...', Ar
ray)
 /var/www/magento/trunk/includes/src/__default.php(27297): Mage::dispatchEvent('core_layout_blo...', A
rray)
 /var/www/magento/trunk/includes/src/__default.php(27310): Mage_Core_Model_Layout->createBlock('adminh
tml/page', 'root')
 /var/www/magento/trunk/includes/src/__default.php(27077): Mage_Core_Model_Layout->addBlock('adminhtml
/page', 'root')
 /var/www/magento/trunk/includes/src/__default.php(27043): Mage_Core_Model_Layout->_generateBlock(Obje
ct(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
 /var/www/magento-demo/trunk/includes/src/__default.php(13507): Mage_Core_Model_Layout->generateBlocks()
 /var/www/magento/trunk/includes/src/__default.php(13432): Mage_Core_Controller_Varien_Action->generat
eLayoutBlocks()
 /var/www/magento/trunk/includes/src/Mage_Adminhtml_Controller_Action.php(275): Mage_Core_Controller_Varien_Action->loadLayout(NULL, true, true)
 /var/www/magento/trunk/app/code/core/Mage/Compiler/controllers/Adminhtml/Compiler/ProcessController.
php(59): Mage_Adminhtml_Controller_Action->loadLayout()
 /var/www/magento/trunk/includes/src/__default.php(13582): Mage_Compiler_Adminhtml_Compiler_ProcessController->indexAction()
 /var/www/magento/trunk/includes/src/__default.php(17927): Mage_Core_Controller_Varien_Action->dispatch('index')
 /var/www/magento/trunk/includes/src/__default.php(17484): Mage_Core_Controller_Varien_Router_Standar
d->match(Object(Mage_Core_Controller_Request_Http))
 /var/www/magento/trunk/includes/src/__default.php(20061): Mage_Core_Controller_Varien_Front->dispatch()
 /var/www/magento/trunk/app/Mage.php(683): Mage_Core_Model_App->run(Array)
 /var/www/magento/trunk/index.php(87): Mage::run('', 'store')
Était-ce utile?

La solution 3

I am sorry about answering so late but I want to describe how I fixed that bug. The problem was that my observer was attached in global area to core_layout_block_create_after event, which is firing in both areas (frontend, admin).

After installation during Compilation Mode enabled cache was cleaned. But code was not recompiling during installation. It means that after returning back I could not access admin, and rerun compilation. I could do that only from console.

As I needed watching for that event only for frontend area I just moved the observer initialization. And problem was fixed.

My advise do not initialize observers in global scope for events which runs in every page in admin.

Autres conseils

The only way that I think is possible to consistently avoid this is to turn off compilation mode before installing / making any code changes. You will also need to rerun the compilation process after the installation. Simply re-enabling it will have the same issue.

The underlying problem is that with compilation mode enabled Magento parses the new config.xml files but will only look for classes under the includes/ path. When you install a new extension the new files are placed in the standard Magento paths and are not found by Magento.

If the extension were to include the files in the compiled state as well as uncompiled state this could be an option to prevent this. The sql installation routines are also not part of the compiled state and could be used to change the php include paths (this seems rather hackish).

I consider this behaviour an oversight in the Magento compilation mode implementation - options that would have made sense are 1.) a change in config invalidates the compilaton mode 2.) config is also compiled to have a consistent site

You'll need to re-run the compiler via System > Tools > Compilation.

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top