Skip to content

Instantly share code, notes, and snippets.

@dmouse
Last active December 29, 2015 05:19
Show Gist options
  • Select an option

  • Save dmouse/7620767 to your computer and use it in GitHub Desktop.

Select an option

Save dmouse/7620767 to your computer and use it in GitHub Desktop.
<?php
$finder = new Finder();
$dot_dot = '';
while (true){
try {
$iterator = $finder
->files()
->name('bootstrap.inc')
->in(getcwd() . '/'. $dot_dot . 'core/includes/');
break;
} catch(\InvalidArgumentException $e) {
$dot_dot .= '../';
if (realpath(getcwd() . '/' . $dot_dot) == '/')
throw new \InvalidArgumentException("Don't find Drupal base");
}
}
foreach ($iterator as $file) {
$bootstrap_real_path = $file->getRealpath();
}
$bootstrap_path = $input->getParameterOption(array('--bootstrap-file', '-b'))? : $bootstrap_real_path;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment