Skip to content

Commit

Permalink
Use the current or release directory for execute drush
Browse files Browse the repository at this point in the history
  • Loading branch information
joelpittet committed Nov 28, 2024
1 parent d86a85a commit dbb97f8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions recipes/drupal8.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@
}

// Skip when there are no tables in the database.
if (test('[[ -z "$(./vendor/bin/drush sql:query \'SHOW TABLES\')" ]]')) {
if (test('[[ -z "$({{release_or_current_path}}/vendor/bin/drush sql:query \'SHOW TABLES\')" ]]')) {
writeln("<fg=yellow;options=bold;>Warning: </><fg=yellow;>Your database is empty! Skipping...</>");
return;
}

$destination = has('previous_release') ? '{{previous_release}}' : '{{release_path}}';
run("mkdir -p $destination/config/backup");

cd('{{release_or_current_path}}');
run("./vendor/bin/drush -y config:export --destination=$destination");
run("{{release_or_current_path}}/vendor/bin/drush -y config:export --destination=$destination");
writeln('Backup saved to ' . $destination);
});
before('deploy:drush', 'drush:config:backup');

0 comments on commit dbb97f8

Please sign in to comment.