DrupalBoot7.php

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

Namespace

Drush\Boot

Classes

Namesort descending Description
DrupalBoot7

File

lib/Drush/Boot/DrupalBoot7.php
View source
  1. <?php
  2. namespace Drush\Boot;
  3. class DrupalBoot7 extends DrupalBoot {
  4. function valid_root($path) {
  5. if (!empty($path) && is_dir($path) && file_exists($path . '/index.php')) {
  6. // Drupal 7 root.
  7. // We check for the presence of 'modules/field/field.module' to differentiate this from a D6 site
  8. $candidate = 'includes/common.inc';
  9. if (file_exists($path . '/' . $candidate) && file_exists($path . '/misc/drupal.js') && file_exists($path . '/modules/field/field.module')) {
  10. return $candidate;
  11. }
  12. }
  13. }
  14. function get_profile() {
  15. return drupal_get_profile();
  16. }
  17. function add_logger() {
  18. // If needed, prod module_implements() to recognize our system_watchdog() implementation.
  19. $dogs = drush_module_implements('watchdog');
  20. if (!in_array('system', $dogs)) {
  21. // Note that this resets module_implements cache.
  22. drush_module_implements('watchdog', FALSE, TRUE);
  23. }
  24. }
  25. function contrib_modules_paths() {
  26. return array(
  27. conf_path() . '/modules',
  28. 'sites/all/modules',
  29. );
  30. }
  31. function contrib_themes_paths() {
  32. return array(
  33. conf_path() . '/themes',
  34. 'sites/all/themes',
  35. );
  36. }
  37. function bootstrap_drupal_core($drupal_root) {
  38. define('DRUPAL_ROOT', $drupal_root);
  39. $core = DRUPAL_ROOT;
  40. return $core;
  41. }
  42. function bootstrap_drupal_database_validate() {
  43. return parent::bootstrap_drupal_database_validate() && $this->bootstrap_drupal_database_has_table('blocked_ips');
  44. }
  45. function bootstrap_drupal_database() {
  46. drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
  47. parent::bootstrap_drupal_database();
  48. }
  49. function bootstrap_drupal_configuration() {
  50. drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
  51. // Unset drupal error handler and restore drush's one.
  52. restore_error_handler();
  53. parent::bootstrap_drupal_configuration();
  54. }
  55. function bootstrap_drupal_full() {
  56. if (!drush_get_context('DRUSH_QUIET', FALSE)) {
  57. ob_start();
  58. }
  59. drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  60. if (!drush_get_context('DRUSH_QUIET', FALSE)) {
  61. ob_end_clean();
  62. }
  63. parent::bootstrap_drupal_full();
  64. }
  65. }