protected function _fixComposerExtractionBug()
 {
     $filesystem = new Filesystem();
     $mediaFolder = $this->config['installationFolder'] . '/media';
     $wrongFolder = $this->config['installationFolder'] . '/_temp_demo_data/media';
     if (is_dir($wrongFolder)) {
         $filesystem->recursiveCopy($wrongFolder, $mediaFolder);
         $filesystem->recursiveRemoveDirectory($wrongFolder);
     }
 }
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return bool
  */
 public function downloadContao(InputInterface $input, OutputInterface $output)
 {
     try {
         $package = $this->createComposerPackageByConfig($this->config['contaoVersionData']);
         $this->config['contaoPackage'] = $package;
         if (file_exists($this->config['installationFolder'] . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'Mage.php')) {
             $output->writeln('<error>A contao installation already exists in this folder </error>');
             return false;
         }
         $composer = $this->getComposer($input, $output);
         $targetFolder = $this->getTargetFolderByType($composer, $package, $this->config['installationFolder']);
         $this->config['contaoPackage'] = $this->downloadByComposerConfig($input, $output, $package, $targetFolder, true);
         if ($this->isSourceTypeRepository($package->getSourceType())) {
             $filesystem = new \IMI\Util\Filesystem();
             $filesystem->recursiveCopy($targetFolder, $this->config['installationFolder'], array('.git', '.hg'));
         } else {
             $filesystem = new \Composer\Util\Filesystem();
             $filesystem->copyThenRemove($this->config['installationFolder'] . '/_imi_conrun_download', $this->config['installationFolder']);
         }
         if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
             // Patch installer
             $this->patchContaoInstallerForPHP54($this->config['installationFolder']);
         }
     } catch (\Exception $e) {
         $output->writeln('<error>' . $e->getMessage() . '</error>');
         return false;
     }
     return true;
 }