Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / drush / drush / src / Boot / DrupalBoot7.php
1 <?php
2
3 namespace Drush\Boot;
4
5 use Psr\Log\LoggerInterface;
6
7 class DrupalBoot7 extends DrupalBoot
8 {
9
10     public function validRoot($path)
11     {
12         if (!empty($path) && is_dir($path) && file_exists($path . '/index.php')) {
13             // Drupal 7 root.
14             // We check for the presence of 'modules/field/field.module' to differentiate this from a D6 site
15             $candidate = 'includes/common.inc';
16             if (file_exists($path . '/' . $candidate) && file_exists($path . '/misc/drupal.js') && file_exists($path . '/modules/field/field.module')) {
17                 return $candidate;
18             }
19         }
20     }
21
22     public function getVersion($drupal_root)
23     {
24         $path = $drupal_root . '/includes/bootstrap.inc';
25         if (is_file($path)) {
26             require_once $path;
27             if (defined('VERSION')) {
28                 return VERSION;
29             }
30         }
31     }
32
33     public function getProfile()
34     {
35         return drupal_get_profile();
36     }
37
38     public function addLogger()
39     {
40     }
41
42     public function bootstrapDrupalCore($drupal_root)
43     {
44         define('DRUPAL_ROOT', $drupal_root);
45         require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
46         $core = DRUPAL_ROOT;
47
48         return $core;
49     }
50
51     public function bootstrapDrupalDatabaseValidate()
52     {
53         return parent::bootstrapDrupalDatabaseValidate() && $this->bootstrapDrupalDatabaseHasTable('blocked_ips');
54     }
55
56     public function bootstrapDrupalDatabase()
57     {
58         drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
59         parent::bootstrapDrupalDatabase();
60     }
61
62     public function bootstrapDrupalConfiguration()
63     {
64         drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
65
66         // Unset drupal error handler and restore drush's one.
67         restore_error_handler();
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         parent::bootstrapDrupalFull();
83     }
84 }