Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / drush / drush / src / Boot / DrupalBoot6.php
1 <?php
2
3 /**
4  * @file
5  *   This file is required for recognizing a D6 root and showing deprecation error.
6  */
7
8 namespace Drush\Boot;
9
10 use Psr\Log\LoggerInterface;
11
12 class DrupalBoot6 extends DrupalBoot
13 {
14
15     public function validRoot($path)
16     {
17         if (!empty($path) && is_dir($path) && file_exists($path . '/index.php')) {
18             // Drupal 6 root.
19             // We check for the absence of 'modules/field/field.module' to differentiate this from a D7 site.
20             // n.b. we want D5 and earlier to match here, if possible, so that we can print a 'not supported'
21             // error during bootstrap.  If someone later adds a commandfile that adds a boot class for
22             // Drupal 5, it will be tested first, so we shouldn't get here.
23             $candidate = 'includes/common.inc';
24             if (file_exists($path . '/' . $candidate) && file_exists($path . '/misc/drupal.js') && !file_exists($path . '/modules/field/field.module')) {
25                 return $candidate;
26             }
27         }
28     }
29
30     public function getVersion($drupal_root)
31     {
32         $path = $drupal_root . '/modules/system/system.module';
33         if (is_file($path)) {
34             require_once $path;
35             if (defined('VERSION')) {
36                 return VERSION;
37             }
38         }
39     }
40
41     public function addLogger()
42     {
43     }
44
45     public function bootstrapDrupalCore($drupal_root)
46     {
47         define('DRUPAL_ROOT', $drupal_root);
48         require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
49         $core = DRUPAL_ROOT;
50
51         return $core;
52     }
53
54     public function bootstrapDrupalDatabaseValidate()
55     {
56         return parent::bootstrapDrupalDatabaseValidate() && $this->bootstrapDrupalDatabaseHasTable('cache');
57     }
58
59     public function bootstrapDrupalDatabase()
60     {
61         drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
62         parent::bootstrapDrupalDatabase();
63     }
64
65     public function bootstrapDrupalConfiguration()
66     {
67         drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
68
69         parent::bootstrapDrupalConfiguration();
70     }
71
72     public function bootstrapDrupalFull()
73     {
74         if (!drush_get_context('DRUSH_QUIET', false)) {
75             ob_start();
76         }
77         drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
78         if (!drush_get_context('DRUSH_QUIET', false)) {
79             ob_end_clean();
80         }
81
82         // Unset drupal error handler and restore drush's one.
83         restore_error_handler();
84
85         parent::bootstrapDrupalFull();
86     }
87 }