コード例 #1
0
ファイル: DrupalBoot.php プロジェクト: jibran/drush
 /**
  * Validate the DRUSH_BOOTSTRAP_DRUPAL_ROOT phase.
  *
  * In this function, we will check if a valid Drupal directory is available.
  * We also determine the value that will be stored in the DRUSH_DRUPAL_ROOT
  * context and DRUPAL_ROOT constant if it is considered a valid option.
  */
 function bootstrap_drupal_root_validate()
 {
     $drupal_root = \Drush::bootstrapManager()->getRoot();
     if (empty($drupal_root)) {
         return drush_bootstrap_error('DRUSH_NO_DRUPAL_ROOT', dt("A Drupal installation directory could not be found"));
     }
     if (!($signature = drush_valid_root($drupal_root))) {
         return drush_bootstrap_error('DRUSH_INVALID_DRUPAL_ROOT', dt("The directory !drupal_root does not contain a valid Drupal installation", array('!drupal_root' => $drupal_root)));
     }
     $version = drush_drupal_version($drupal_root);
     $major_version = drush_drupal_major_version($drupal_root);
     if ($major_version <= 6) {
         return drush_set_error('DRUSH_DRUPAL_VERSION_UNSUPPORTED', dt('Drush !drush_version does not support Drupal !major_version.', array('!drush_version' => \Drush::getMajorVersion(), '!major_version' => $major_version)));
     }
     drush_bootstrap_value('drupal_root', $drupal_root);
     define('DRUSH_DRUPAL_SIGNATURE', $signature);
     return TRUE;
 }