0

I'm attempting to programmatically determine if Magento's compilation status is enabled or disabled. I found the function getCompilerStatus() in app/design/adminhtml/default/default/template/compiler/process.phtml that allows you to determine the status in the admin panel. I am however trying to run this from a "workbench" script outside of the admin panel. Here is what I have:

<?php
ini_set('display_errors',1); 
error_reporting(E_ALL);

# workebench script
require_once('app/Mage.php');
umask(0);
Mage::app();

echo "Checking Compilation Status<br />";

// Code that would work in admin panel
echo $this->getCompilerStatus();

The result: Fatal error: Using $this when not in object context

So I Googled the function and came across the following link from Magento which shows the "Varien Objects" required: http://docs.magentocommerce.com/Mage_Compiler/Mage_Compiler_Block_Process.html#getCompilerStatus

From this it appears that I need to load Mage_Core_Block_Abstract, Mage_Core_Block_Template and I'm assuming I can drop Mage_Adminhtml_Block_Template as my function does not require the admin panel.

Can anyone tell me if I'm going about this the right way? Thank you.

1

Actually that method just checks if the constant COMPILER_INCLUE_PATH is defined.

The only place where this seems to be set is includes/config.php. So I've never used the compiler, but it looks like that this file is modified when the compiler is activated, so I would include it and after that check as in the method if the constant is defined.

  • Interesting. So you're saying that this isn't a database config entry that reflects the status of the compiler? – sparecycle Feb 2 '15 at 17:20
  • 1
    Correctly, just check the getCompilerStatus method. – Tobias Feb 2 '15 at 17:20
  • Thank you! Can you provide a link or any advice on doing that? I'm relatively new to this process. – sparecycle Feb 2 '15 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.