DrupalBoot6.php

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

This file is required for recognizing a D6 root and showing deprecation error.

Namespace

Drush\Boot

Classes

Namesort descending Description
DrupalBoot6

File

lib/Drush/Boot/DrupalBoot6.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * This file is required for recognizing a D6 root and showing deprecation error.
  5. */
  6. namespace Drush\Boot;
  7. use Psr\Log\LoggerInterface;
  8. class DrupalBoot6 extends DrupalBoot {
  9. function valid_root($path) {
  10. if (!empty($path) && is_dir($path) && file_exists($path . '/index.php')) {
  11. // Drupal 6 root.
  12. // We check for the absence of 'modules/field/field.module' to differentiate this from a D7 site.
  13. // n.b. we want D5 and earlier to match here, if possible, so that we can print a 'not supported'
  14. // error durring bootstrap. If someone later adds a commandfile that adds a boot class for
  15. // Drupal 5, it will be tested first, so we shouldn't get here.
  16. $candidate = 'includes/common.inc';
  17. if (file_exists($path . '/' . $candidate) && file_exists($path . '/misc/drupal.js') && !file_exists($path . '/modules/field/field.module')) {
  18. return $candidate;
  19. }
  20. }
  21. }
  22. function get_version($drupal_root) {
  23. $path = $drupal_root . '/modules/system/system.module';
  24. if (is_file($path)) {
  25. require_once $path;
  26. if (defined('VERSION')) {
  27. return VERSION;
  28. }
  29. }
  30. }
  31. function get_profile() {
  32. return variable_get('install_profile', 'standard');
  33. }
  34. function add_logger() {
  35. // If needed, prod module_implements() to recognize our system_watchdog() implementation.
  36. $dogs = drush_module_implements('watchdog');
  37. if (!in_array('system', $dogs)) {
  38. // Note that this resets module_implements cache.
  39. drush_module_implements('watchdog', FALSE, TRUE);
  40. }
  41. }
  42. function contrib_modules_paths() {
  43. return array(
  44. $this->conf_path() . '/modules',
  45. 'sites/all/modules',
  46. );
  47. }
  48. function contrib_themes_paths() {
  49. return array(
  50. $this->conf_path() . '/themes',
  51. 'sites/all/themes',
  52. );
  53. }
  54. function bootstrap_drupal_core($drupal_root) {
  55. define('DRUPAL_ROOT', $drupal_root);
  56. require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
  57. $core = DRUPAL_ROOT;
  58. return $core;
  59. }
  60. function bootstrap_drupal_database_validate() {
  61. return parent::bootstrap_drupal_database_validate() && $this->bootstrap_drupal_database_has_table('cache');
  62. }
  63. function bootstrap_drupal_database() {
  64. drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
  65. parent::bootstrap_drupal_database();
  66. }
  67. function bootstrap_drupal_configuration() {
  68. drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
  69. parent::bootstrap_drupal_configuration();
  70. }
  71. function bootstrap_drupal_full() {
  72. if (!drush_get_context('DRUSH_QUIET', FALSE)) {
  73. ob_start();
  74. }
  75. drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  76. if (!drush_get_context('DRUSH_QUIET', FALSE)) {
  77. ob_end_clean();
  78. }
  79. // Unset drupal error handler and restore drush's one.
  80. restore_error_handler();
  81. parent::bootstrap_drupal_full();
  82. }
  83. }