public function checkVarDir(OutputInterface $output)
{
$tempVarDir = sys_get_temp_dir() . '/magento/var';
if (!OutputInterface::VERBOSITY_NORMAL <= $output->getVerbosity() && !is_dir($tempVarDir)) {
return;
}
$this->detectMagento(null, $output);
/* If magento is not installed yet, don't check */
if ($this->_magentoRootFolder === null || !file_exists($this->_magentoRootFolder . '/app/etc/local.xml')) {
return;
}
try {
$this->initMagento();
} catch (Exception $e) {
$message = 'Cannot initialize Magento. Please check your configuration. ' . 'Some n98-magerun command will not work. Got message: ';
if (OutputInterface::VERBOSITY_VERY_VERBOSE <= $output->getVerbosity()) {
$message .= $e->getTraceAsString();
} else {
$message .= $e->getMessage();
}
$output->writeln($message);
return;
}
$configOptions = new \Mage_Core_Model_Config_Options();
$currentVarDir = $configOptions->getVarDir();
if ($currentVarDir == $tempVarDir) {
$output->writeln(array(sprintf('<warning>Fallback folder %s is used in n98-magerun</warning>', $tempVarDir), '', 'n98-magerun is using the fallback folder. If there is another folder configured for Magento, this ' . 'can cause serious problems.', 'Please refer to https://github.com/netz98/n98-magerun/wiki/File-system-permissions ' . 'for more information.', ''));
} else {
$output->writeln(array(sprintf('<warning>Folder %s found, but not used in n98-magerun</warning>', $tempVarDir), '', "This might cause serious problems. n98-magerun is using the configured var-folder " . "<comment>{$currentVarDir}</comment>", 'Please refer to https://github.com/netz98/n98-magerun/wiki/File-system-permissions ' . 'for more information.', ''));
return false;
}
}