Echoes a VHost skeleton with correct path inserted.

@param string $installPath The install path to insert.

@author Benjamin Carl <opensource@clickalicious.de>
@return void
@access protected
@static
334559
protected static function showVhostExample($installPath)
    {
        \cli\line();
        \cli\line('You could use this skeleton (example and not production ready!) for your vhost:');
        \cli\line();
        \cli\line(\cli\Colors::colorize('%y<VirtualHost *:80>'));
        \cli\line('    ServerName www.example.com:80');
        \cli\line('    ServerAlias example.com *.example.com');
        \cli\line('    ServerAdmin webmaster@example.com');
        \cli\line('    DocumentRoot "' . $installPath . DIRECTORY_SEPARATOR . 'web"');
        \cli\line('    <Directory "' . $installPath . DIRECTORY_SEPARATOR . 'web">');
        \cli\line('        Options Indexes FollowSymLinks Includes ExecCGI');
        \cli\line('        AllowOverride All');
        \cli\line('        Order allow,deny');
        \cli\line('        Allow from all');
        \cli\line('        DirectoryIndex app.php index.php index.html index.htm');
        \cli\line('    </Directory>');
        \cli\line('</VirtualHost>');
    }
441583
public function addGlobPath($globPath) {
    foreach(glob($globPath, GLOB_BRACE) as $definitionFile) {
      $this->addDefinitions($definitionFile);
    }
    return $this;
  }
562255
public function basePath($basePath = null)
    {
        if (!func_num_args()) {
            return $this->_basePath;
        }
        $this->_basePath = $basePath;
        return $this;
    }
732834
public function setLogPath(string $logPath) : void
    {
        if (!file_exists($logPath)) {
            throw new ManagerException('Invalid log path. Folder not found.');
        }
        $this->logPath = $logPath;
    }
40247
public function deployDatabases(
        string $snapshotPath,
        string $snapshotName,
        array $databases
    ): void {

        if (!$databases) {
            throw new Exception\RuntimeException('No database given for deployment.');
        }

        $application = $this->applicationConfig;
        $this->logger->info('Installing databases');
        foreach ($databases as $databaseName => $database) {
            $adapterName = $database['adapter'] ?? $application->getDefaultDatabaseAdapter();
            $databaseAdapter = $this->databaseAdapterManager->getAdapter($adapterName);
            $adapterName = $database['importexport_adapter'] ??
                $application->getDefaultDatabaseImportExportAdapter();
            $databaseImportExportAdapter = $this->databaseImportAdapterManager->getAdapter($adapterName);

            $filename = "$databaseName." . $databaseImportExportAdapter::getFileExtension();
            $localDatabaseName = $database['local_database_name'] ?? $databaseName;

            if (!$databaseAdapter->databaseExists($localDatabaseName)) {
                $this->logger->debug("Creating database \"$localDatabaseName\".");
                $databaseAdapter->createDatabase($localDatabaseName);
            }

            $workingDir = getcwd() . '/' . DatabaseImportExportAdapterInterface::DEFAULT_WORKING_DIR;
            $this->logger->debug("Downloading database script \"$filename\".");
            $this->mountManager->sync(
                "$snapshotPath/$snapshotName/databases/$filename",
                "local://$workingDir/$filename"
            );

            $databaseImportExportAdapter->importFromFile(
                "$workingDir/$filename",
                $localDatabaseName,
                [] // This command does not yet support any options
            );


            // @todo Deal with running environment scripts
            if (!empty($database['post_import_scripts'])) {
                foreach ($database['post_import_scripts'] as $scriptFilename) {
                    $scriptFilename = $this->findScript($scriptFilename);
                    $scriptFilename = $this->applyStringReplacements(
                        $scriptFilename
                    );

                    $this->logger->debug("Running post import script \"$scriptFilename\".");
                    $databaseAdapter->run(
                        file_get_contents($scriptFilename),
                        $localDatabaseName
                    );
                }
            }
        }
    }
971185
public static function addPath($path)
    {
        if (!in_array($path, self::$paths)) {
            array_unshift(self::$paths, $path);
        }
    }
1298916
public function createDirectory($dirPath)
    {
      if (! $this->fs->exists($dirPath))
      {
        $this->fs->mkdir($dirPath);
      }
    }
726126
def install(self, xmlpath):
        
        #Before we can install it, we need to make sure that none of the existing
        #installed paths point to the same repo.
        from os import path
        fullpath = path.abspath(path.expanduser(xmlpath))
        if path.isfile(fullpath):
            repo = RepositorySettings(self, fullpath)
            if repo.name.lower() not in self.repositories:
                self.installed.append(fullpath)
                self._save_installed()
                self.archive[repo.name.lower()] = {}
                self._save_archive()
                
                self.repositories[repo.name.lower()] = repo
        else:
            warn("The file {} does not exist; install aborted.".format(fullpath))
777867
public function setClasspath(Path $classpath): void
    {
        if ($this->classpath === null) {
            $this->classpath = $classpath;
        } else {
            $this->classpath->append($classpath);
        }
    }
757735
public function rotateInstalledFiles($installPath)
    {
        $fsm = new Filesystem;
        $tempDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid('oci-');
        DebugPrinter::log('Rotating files using `%s` dir', $tempDir);
        // unzipped contents may or may not contain `upload.*` directory,
        // which holds actual opencart contents.
        $dirs = glob($installPath . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR);
        foreach ($dirs as $key => $dir) {
            if ($dir[0] === '.') {
                unset($dirs[$key]);
            }
        }
        if (sizeof($dirs) === 1) {
            $subDirectory = $tempDir . DIRECTORY_SEPARATOR .
                dirname(reset($dirs));
            $fsm->rename($installPath, $tempDir);
            $fsm->rename($subDirectory, $installPath);
            $fsm->remove($tempDir);
        }
    }
823441
public static function moveInstall($source_path, $install_path)
    {
        if (file_exists($install_path)) {
            Folder::delete($install_path);
        }

        Folder::move($source_path, $install_path);

        return true;
    }
928286
private function setTemplatesPath($templatesPath)
    {
        $this->templatesPath = $templatesPath;
        if (!is_readable($this->templatesPath)) {
            $this->error("Template Root Path ({$this->templatesPath}) does not exist or not readable.");
        }
    }
1356468
public function setBasePath($path)
    {
        foreach ($this->loaders as $loader) {
            if ($loader instanceof FileLoaderInterface) {
                $loader->setBasePath($path);
            }
        }
    }
989684
public function setTemplatePath($templatePath)
    {
        $resolvedPath = "";
        $tok = strtok($templatePath, ",");
        while ($tok) {
            // resolve relative path from basedir and leave
            // absolute path untouched.
            $fullPath = $this->project->resolveFile($tok);
            $cpath = $fullPath->getCanonicalPath();
            if ($cpath === false) {
                $this->log("Template directory does not exist: " . $fullPath->getAbsolutePath());
            } else {
                $resolvedPath .= $cpath;
            }
            $tok = strtok(",");
            if ($tok) {
                $resolvedPath .= ",";
            }
        }
        $this->templatePath = $resolvedPath;
    }
1287354
public function setPath($path)
    {
        if (!$this->databaseIsPath) {
            $path = ltrim($path, '/');
        }
        $this->setDatabase($path);
    }
106067
public static function getNameFromManifest($installPath)
    {
        $manifest = self::getPackageManifest($installPath);

        if ($manifest === false) {
            return false;
        }

        $xml = simplexml_load_file($manifest);

        if (!($xml instanceof \SimpleXMLElement)) {
            return false;
        }

        $element = false;
        $type    = (string) $xml->attributes()->type;

        switch($type)
        {
            case 'component':
                $name    = strtolower((string) $xml->name);
                $element = preg_replace('/[^A-Z0-9_\.-]/i', '', $name);

                if (substr($element, 0, 4) != 'com_') {
                    $element = 'com_'.$element;
                }
                break;
            case 'module':
            case 'plugin':
                if(count($xml->files->children()))
                {
                    foreach($xml->files->children() as $file)
                    {
                        if ((string) $file->attributes()->$type)
                        {
                            $element = (string) $file->attributes()->$type;
                            break;
                        }
                    }
                }
                break;
            case 'file':
            case 'library':
                $filename = basename($manifest);
                $element  = substr($filename, 0, -strlen('.xml'));
                break;
            case 'package':
                $element = preg_replace('/[^A-Z0-9_\.-]/i', '', $xml->packagename);

                if (substr($element, 0, 4) != 'pkg_') {
                    $element = 'pkg_'.$element;
                }
                break;
            case 'language':
                $element = (string) $xml->tag;
                break;
            case 'template':
                $name    = preg_replace('/[^A-Z0-9_ \.-]/i', '', $xml->name);
                $element = strtolower(str_replace(' ', '_', $name));
                break;
            default:
                break;
        }

        return $element;
    }
47121
public static function load(string $path): void
    {
        $filePath = \absolute_path($path, static::FILE);
        if (!\is_readable($filePath) || !\is_file($filePath)) {
            return;
        }

        $array = self::optimizeGet($path, $filePath);

        if ($array === false) {
            $array = \parse_ini_file($filePath, false, INI_SCANNER_RAW);
        }

        foreach ($array as $name => $value) {
            static::set($name, $value);
        }

        self::optimizeSet($path, $array, $filePath);
    }