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_version($drupal_root) {
  15. $path = $drupal_root . '/includes/bootstrap.inc';
  16. if (is_file($path)) {
  17. require_once $path;
  18. if (defined('VERSION')) {
  19. return VERSION;
  20. }
  21. }
  22. }
  23. function get_profile() {
  24. return drupal_get_profile();
  25. }
  26. function add_logger() {
  27. // If needed, prod module_implements() to recognize our system_watchdog() implementation.
  28. $dogs = drush_module_implements('watchdog');
  29. if (!in_array('system', $dogs)) {
  30. // Note that this resets module_implements cache.
  31. drush_module_implements('watchdog', FALSE, TRUE);
  32. }
  33. }
  34. function contrib_modules_paths() {
  35. return array(
  36. $this->conf_path() . '/modules',
  37. 'sites/all/modules',
  38. );
  39. }
  40. function contrib_themes_paths() {
  41. return array(
  42. $this->conf_path() . '/themes',
  43. 'sites/all/themes',
  44. );
  45. }
  46. function bootstrap_drupal_core($drupal_root) {
  47. define('DRUPAL_ROOT', $drupal_root);
  48. require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
  49. $core = DRUPAL_ROOT;
  50. return $core;
  51. }
  52. function bootstrap_drupal_database_validate() {
  53. return parent::bootstrap_drupal_database_validate() && $this->bootstrap_drupal_database_has_table('blocked_ips');
  54. }
  55. function bootstrap_drupal_database() {
  56. drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
  57. parent::bootstrap_drupal_database();
  58. }
  59. function bootstrap_drupal_configuration() {
  60. drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
  61. // Unset drupal error handler and restore drush's one.
  62. restore_error_handler();
  63. parent::bootstrap_drupal_configuration();
  64. }
  65. function bootstrap_drupal_full() {
  66. if (!drush_get_context('DRUSH_QUIET', FALSE)) {
  67. ob_start();
  68. }
  69. drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  70. if (!drush_get_context('DRUSH_QUIET', FALSE)) {
  71. ob_end_clean();
  72. }
  73. parent::bootstrap_drupal_full();
  74. }
  75. }