Skip to content

Commit 25fb6e8

Browse files
authored
Merge pull request #72 from hgajjar/feature/drush-8-compatibility
Add compatibility for Drush 8.x version
2 parents 5188efc + be49c3c commit 25fb6e8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Drupal/Bootstrap.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,11 @@ public function register(): void
128128
if (class_exists(\Drush\Drush::class)) {
129129
$reflect = new \ReflectionClass(\Drush\Drush::class);
130130
if ($reflect->getFileName() !== false) {
131-
$drushDir = dirname($reflect->getFileName(), 2);
131+
$levels = 2;
132+
if (\Drush\Drush::getMajorVersion() < 9) {
133+
$levels = 3;
134+
}
135+
$drushDir = dirname($reflect->getFileName(), $levels);
132136
/** @var \SplFileInfo $file */
133137
foreach (Finder::findFiles('*.inc')->in($drushDir . '/includes') as $file) {
134138
require_once $file->getPathname();

0 commit comments

Comments
 (0)