Skip to content

Commit

Permalink
Improve dumpProgram handling in mysql database driver, and fix for nu…
Browse files Browse the repository at this point in the history
…ll param to ucfirst for 13.x (#6023)

* Use dumpProgram in an additional place in SqlMysql

* Fix null param to ucfirst() fatal error when DB information is missing. (#5918)

---------

Co-authored-by: Supreetam Laha <[email protected]>
  • Loading branch information
LordAro and Supreetam09 authored Jun 6, 2024
1 parent 5631ea5 commit 7d2746d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Sql/SqlBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ public static function create(array $options = []): ?SqlBase
public static function getInstance($db_spec, $options): ?self
{
$driver = $db_spec['driver'];
$class_name = 'Drush\Sql\Sql' . ucfirst($driver);
if (class_exists($class_name)) {
$class_name = !empty($driver) ? 'Drush\Sql\Sql' . ucfirst($driver) : null;
if ($class_name && class_exists($class_name)) {
$instance = method_exists($class_name, 'make') ? $class_name::make($db_spec, $options) : new $class_name($db_spec, $options);
// Inject config
$instance->setConfig(Drush::config());
Expand Down
2 changes: 1 addition & 1 deletion src/Sql/SqlMysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public function dumpCmd($table_selection): string

// Run mysqldump again and append output if we need some structure only tables.
if (!empty($structure_tables)) {
$exec .= " && mysqldump " . $only_db_name . " --no-data $extra " . implode(' ', $structure_tables);
$exec .= " && " . $this->dumpProgram() . " " . $only_db_name . " --no-data $extra " . implode(' ', $structure_tables);
$parens = true;
}
}
Expand Down

0 comments on commit 7d2746d

Please sign in to comment.