You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Boot/DrupalBoot.php
-71Lines changed: 0 additions & 71 deletions
Original file line number
Diff line number
Diff line change
@@ -169,77 +169,6 @@ public function bootstrapDrupalConfiguration()
169
169
*/
170
170
publicfunctionbootstrapDrupalDatabaseValidate()
171
171
{
172
-
// Drupal requires PDO, and Drush requires php 5.6+ which ships with PDO
173
-
// but PHP may be compiled with --disable-pdo.
174
-
if (!class_exists('\PDO')) {
175
-
$this->logger->log(LogLevel::BOOTSTRAP, dt('PDO support is required.'));
176
-
returnfalse;
177
-
}
178
-
try {
179
-
$sql = SqlBase::create();
180
-
// Drush requires a database client program during its Drupal bootstrap.
181
-
$command = $sql->command();
182
-
if (drush_program_exists($command) === false) {
183
-
$this->logger->warning(dt('The command \'!command\' is required for preflight but cannot be found. Please install it and retry.', ['!command' => $command]));
184
-
returnfalse;
185
-
}
186
-
if (!$sql->query('SELECT 1;', null, drush_bit_bucket())) {
187
-
$message = dt("Drush was not able to start (bootstrap) the Drupal database.\n");
188
-
$message .= dt("Hint: This may occur when Drush is trying to:\n");
189
-
$message .= dt(" * bootstrap a site that has not been installed or does not have a configured database. In this case you can select another site with a working database setup by specifying the URI to use with the --uri parameter on the command line. See `drush topic docs-aliases` for details.\n");
190
-
$message .= dt(" * connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed shell. See http://drupal.org/node/1428638 for details.\n");
191
-
$message .= dt('More information may be available by running `drush status`');
// Drupal requires PDO, and Drush requires php 5.6+ which ships with PDO
159
+
// but PHP may be compiled with --disable-pdo.
160
+
if (!class_exists('\PDO')) {
161
+
$this->logger->log(LogLevel::BOOTSTRAP, dt('PDO support is required.'));
162
+
returnfalse;
163
+
}
164
+
165
+
try {
166
+
// @todo Log queries in addition to logging failure messages?
167
+
$connection = Database::getConnection();
168
+
$connection->query('SELECT 1;');
169
+
} catch (\Exception$e) {
170
+
$this->logger->log(LogLevel::BOOTSTRAP, 'Unable to connect to database. More information may be available by running `drush status`. This may occur when Drush is trying to bootstrap a site that has not been installed or does not have a configured database. In this case you can select another site with a working database setup by specifying the URI to use with the --uri parameter on the command line. See `drush topic docs-aliases` for details.');
171
+
returnfalse;
172
+
}
173
+
if (!$connection->schema()->tableExists('key_value')) {
174
+
$this->logger->log(LogLevel::BOOTSTRAP, 'key_value table not found. Database may be empty.');
0 commit comments