private function findMageScript(InputInterface $input, OutputInterface $output)
{
if ($this->mageScript === null) {
$this->detectMagento($output);
@chdir($this->_magentoRootFolder);
$this->mageScript = './mage';
if (!is_file($this->mageScript)) {
throw new RuntimeException('Could not find "mage" shell script in current installation');
}
if (!is_executable($this->mageScript)) {
if (!@chmod($this->mageScript, 0755)) {
throw new RuntimeException('Cannot make "mage" shell script executable. Please chmod the file manually.');
}
}
if (!strstr(shell_exec($this->mageScript . ' list-channels'), 'community')) {
// no channels available -> try to setup
shell_exec($this->mageScript . ' mage-setup');
}
}
}