protected DbImportCommand::runScript(Connection $connection, $script)
Run the database script.
\Drupal\Core\Database\Connection $connection: Connection used by the script when included.
string $script: Path to dump script.
protected function runScript(Connection $connection, $script) { $old_key = Database::setActiveConnection($connection->getKey()); if (substr($script, -3) == '.gz') { $script = "compress.zlib://$script"; } try { require $script; } catch (SchemaObjectExistsException $e) { throw new \RuntimeException('An existing Drupal installation exists at this location. Try removing all tables or changing the database prefix in your settings.php file.'); } Database::setActiveConnection($old_key); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Command!DbImportCommand.php/function/DbImportCommand::runScript/8.1.x