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