Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FossilDriver.php

function FossilDriver::initialize

@inheritDoc

Overrides VcsDriverInterface::initialize

File

vendor/composer/composer/src/Composer/Repository/Vcs/FossilDriver.php, line 41

Class

FossilDriver
@author BohwaZ <http://bohwaz.net/&gt;

Namespace

Composer\Repository\Vcs

Code

public function initialize() : void {
    // Make sure fossil is installed and reachable.
    $this->checkFossil();
    // Ensure we are allowed to use this URL by config.
    $this->config
        ->prohibitUrlByConfig($this->url, $this->io);
    // Only if url points to a locally accessible directory, assume it's the checkout directory.
    // Otherwise, it should be something fossil can clone from.
    if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
        $this->checkoutDir = $this->url;
    }
    else {
        if (!Cache::isUsable($this->config
            ->get('cache-repo-dir')) || !Cache::isUsable($this->config
            ->get('cache-vcs-dir'))) {
            throw new \RuntimeException('FossilDriver requires a usable cache directory, and it looks like you set it to be disabled');
        }
        $localName = Preg::replace('{[^a-z0-9]}i', '-', $this->url);
        $this->repoFile = $this->config
            ->get('cache-repo-dir') . '/' . $localName . '.fossil';
        $this->checkoutDir = $this->config
            ->get('cache-vcs-dir') . '/' . $localName . '/';
        $this->updateLocalRepo();
    }
    $this->getTags();
    $this->getBranches();
}
RSS feed
Powered by Drupal