class DrupalBoot7

  1. 8.0.x lib/Drush/Boot/DrupalBoot7.php DrupalBoot7
  2. 7.x lib/Drush/Boot/DrupalBoot7.php DrupalBoot7
  3. master lib/Drush/Boot/DrupalBoot7.php DrupalBoot7

Namespace

Drush\Boot

Hierarchy

Expanded class hierarchy of DrupalBoot7

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
BaseBoot::bootstrap_and_dispatch function Main entrypoint to bootstrap the selected CMS and execute the selected command. Overrides Boot::bootstrap_and_dispatch
BaseBoot::terminate public function This method is called during the shutdown of drush. Overrides Boot::terminate
DrupalBoot7::add_logger function
DrupalBoot7::bootstrap_drupal_configuration function Initialize and load the Drupal configuration files. Overrides DrupalBoot::bootstrap_drupal_configuration
DrupalBoot7::bootstrap_drupal_core function
DrupalBoot7::bootstrap_drupal_database function Boostrap the Drupal database. Overrides DrupalBoot::bootstrap_drupal_database
DrupalBoot7::bootstrap_drupal_database_validate function Validate the DRUSH_BOOTSTRAP_DRUPAL_DATABASE phase Overrides DrupalBoot::bootstrap_drupal_database_validate
DrupalBoot7::bootstrap_drupal_full function Attempt to load the full Drupal system. Overrides DrupalBoot::bootstrap_drupal_full
DrupalBoot7::contrib_modules_paths function Overrides DrupalBoot::contrib_modules_paths
DrupalBoot7::contrib_themes_paths function Overrides DrupalBoot::contrib_themes_paths
DrupalBoot7::get_profile function Overrides DrupalBoot::get_profile
DrupalBoot7::get_version function Given a site root directory, determine the exact version of the software. Overrides DrupalBoot::get_version
DrupalBoot7::valid_root function This function determines if the specified path points to the root directory of a CMS that can be bootstrapped by the specific subclass that implements it. Overrides DrupalBoot::valid_root
DrupalBoot::bootstrap_do_drupal_site function Called by bootstrap_drupal_site to do the main work of the drush drupal site bootstrap.
DrupalBoot::bootstrap_drupal_database_has_table function Test to see if the Drupal database has a specified table or tables.
DrupalBoot::bootstrap_drupal_login function Log into the bootstrapped Drupal site with a specific username or user id.
DrupalBoot::bootstrap_drupal_root function Bootstrap Drush with a valid Drupal Directory.
DrupalBoot::bootstrap_drupal_root_validate function Validate the DRUSH_BOOTSTRAP_DRUPAL_ROOT phase.
DrupalBoot::bootstrap_drupal_site function Initialize a site on the Drupal root.
DrupalBoot::bootstrap_drupal_site_setup_server_global function Set up the $_SERVER globals so that Drupal will see the same values that it does when serving pages via the web server.
DrupalBoot::bootstrap_drupal_site_validate function VALIDATE the DRUSH_BOOTSTRAP_DRUPAL_SITE phase.
DrupalBoot::bootstrap_drupal_site_validate_settings_present function Validate that the Drupal site has all of the settings that it needs to operated.
DrupalBoot::bootstrap_init_phases function List of bootstrap phases where Drush should stop and look for commandfiles. Overrides Boot::bootstrap_init_phases
DrupalBoot::bootstrap_phases function Bootstrap phases used with Drupal: Overrides Boot::bootstrap_phases
DrupalBoot::commandfile_searchpaths function
DrupalBoot::command_defaults function Return an array of default values that should be added to every command (e.g. values needed in enforce_requirements(), etc.) Overrides BaseBoot::command_defaults
DrupalBoot::conf_path function
DrupalBoot::drush_command_belongs_to_disabled_module function Check if the given command belongs to a disabled module.
DrupalBoot::drush_enforce_requirement_drupal_dependencies function Check that a command has its declared dependencies available or have no dependencies.
DrupalBoot::enforce_requirement function Called by Drush when a command is selected, but before it runs. This gives the Boot class an opportunity to determine if any minimum requirements (e.g. minimum Drupal version) declared in the command have been met. Overrides BaseBoot::enforce_requirement
DrupalBoot::report_command_error function Called by Drush if a command is not found, or if the command was found, but did not meet requirements. Overrides BaseBoot::report_command_error
DrupalBoot::__construct function Overrides BaseBoot::__construct

File

lib/Drush/Boot/DrupalBoot7.php, line 5

View source
class DrupalBoot7 extends DrupalBoot {

  function valid_root($path) {
    if (!empty($path) && is_dir($path) && file_exists($path . '/index.php')) {
      // Drupal 7 root.
      // We check for the presence of 'modules/field/field.module' to differentiate this from a D6 site
      $candidate = 'includes/common.inc';
      if (file_exists($path . '/' . $candidate) && file_exists($path . '/misc/drupal.js') && file_exists($path . '/modules/field/field.module')) {
        return $candidate;
      }
    }
  }

  function get_version($drupal_root) {
    $path = $drupal_root . '/includes/bootstrap.inc';
    if (is_file($path)) {
      require_once $path;
      if (defined('VERSION')) {
        return VERSION;
      }
    }
  }

  function get_profile() {
    return drupal_get_profile();
  }

  function add_logger() {
    // If needed, prod module_implements() to recognize our system_watchdog() implementation.
    $dogs = drush_module_implements('watchdog');
    if (!in_array('system', $dogs)) {
      // Note that this resets module_implements cache.
      drush_module_implements('watchdog', FALSE, TRUE);
    }
  }

  function contrib_modules_paths() {
    return array(
      $this->conf_path() . '/modules',
      'sites/all/modules',
    );
  }

  function contrib_themes_paths() {
    return array(
      $this->conf_path() . '/themes',
      'sites/all/themes',
    );
  }

  function bootstrap_drupal_core($drupal_root) {
    define('DRUPAL_ROOT', $drupal_root);
    require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
    $core = DRUPAL_ROOT;

    return $core;
  }

  function bootstrap_drupal_database_validate() {
    return parent::bootstrap_drupal_database_validate() && $this->bootstrap_drupal_database_has_table('blocked_ips');
  }

  function bootstrap_drupal_database() {
    drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
    parent::bootstrap_drupal_database();
  }

  function bootstrap_drupal_configuration() {
    drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);

    // Unset drupal error handler and restore drush's one.
    restore_error_handler();

    parent::bootstrap_drupal_configuration();
  }

  function bootstrap_drupal_full() {
    if (!drush_get_context('DRUSH_QUIET', FALSE)) {
      ob_start();
    }
    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
    if (!drush_get_context('DRUSH_QUIET', FALSE)) {
      ob_end_clean();
    }

    parent::bootstrap_drupal_full();
  }
}