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

Breadcrumb

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

function DrupalFinder::discoverRoots

Discover all valid paths.

Parameters

$start_path: The path to start the search from.

Throws

\Exception

2 calls to DrupalFinder::discoverRoots()
DrupalFinder::locateRoot in vendor/webflo/drupal-finder/src/DrupalFinder.php
Locate Drupal, Composer, and vendor directory paths.
DrupalFinder::__construct in vendor/webflo/drupal-finder/src/DrupalFinder.php
Initialize finder.

File

vendor/webflo/drupal-finder/src/DrupalFinder.php, line 145

Class

DrupalFinder

Namespace

DrupalFinder

Code

protected function discoverRoots($start_path) {
    // Since we are discovering, reset all path variables.
    $this->drupalRoot = false;
    $this->composerRoot = false;
    $this->vendorDir = false;
    foreach (array(
        true,
        false,
    ) as $follow_symlinks) {
        $path = $start_path;
        if ($follow_symlinks && is_link($path)) {
            $path = realpath($path);
        }
        // Check the start path.
        if ($this->findAndValidateRoots($path)) {
            return;
        }
        else {
            // Move up dir by dir and check each.
            while ($path = $this->shiftPathUp($path)) {
                if ($follow_symlinks && is_link($path)) {
                    $path = realpath($path);
                }
                if ($this->findAndValidateRoots($path)) {
                    return;
                }
            }
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal