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

Namespace

Drush\Boot

Classes

Namesort descending Description
DrupalBoot6

File

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