/**
  * Install the extension
  *
  * @param Extension $extension
  * @return bool|array Returns FALSE if dependencies cannot be resolved, otherwise array with installation information
  */
 public function installExtension(Extension $extension)
 {
     $this->downloadExtension($extension);
     if (!$this->checkDependencies($extension)) {
         return false;
     }
     $updatedDependencies = array();
     $installedDependencies = array();
     $queue = $this->downloadQueue->getExtensionQueue();
     $copyQueue = $this->downloadQueue->getExtensionCopyStorage();
     if (!empty($copyQueue)) {
         $this->copyDependencies($copyQueue);
     }
     $downloadedDependencies = array();
     if (array_key_exists('download', $queue)) {
         $downloadedDependencies = $this->downloadDependencies($queue['download']);
     }
     if ($this->automaticInstallationEnabled) {
         if (array_key_exists('update', $queue)) {
             $this->downloadDependencies($queue['update']);
             $updatedDependencies = $this->uninstallDependenciesToBeUpdated($queue['update']);
         }
         // add extension at the end of the download queue
         $this->downloadQueue->addExtensionToInstallQueue($extension);
         $installQueue = $this->downloadQueue->getExtensionInstallStorage();
         if (!empty($installQueue)) {
             $installedDependencies = $this->installDependencies($installQueue);
         }
     }
     return array_merge($downloadedDependencies, $updatedDependencies, $installedDependencies);
 }