backdrop-contrib / bee

:bee: Bee is a command line utility for Backdrop CMS. It includes commands that allow developers to interact with Backdrop sites.
GNU General Public License v2.0
16 stars 22 forks source link

Unhandled fatal errors if db operations called outside backdrop root and without specifying root #437

Closed yorkshire-pudding closed 2 weeks ago

yorkshire-pudding commented 2 weeks ago

Steps to reproduce

  1. Navigate outside the Backdrop root
  2. run bee db-drop
  3. run bee db-export
  4. run bee db-import (with a valid file)
  5. run bee sql

Expected result A useful error message such as that for bee status:

 ⚠️  No Backdrop installation found. Run this command again from within a Backdrop installation, or use the '--root' global option.

Actual result Fatal errors such as:

user@machine:~/projects/bee$ lando bee sql
PHP Fatal error:  Uncaught Error: Class "Database" not found in /app/commands/db.bee.inc:279
Stack trace:
#0 /app/includes/command.inc(107): sql_bee_callback(Array, Array)
#1 /app/bee.php(31): bee_process_command()
#2 {main}
  thrown in /app/commands/db.bee.inc on line 279

Fatal error: Uncaught Error: Class "Database" not found in /app/commands/db.bee.inc:279
Stack trace:
#0 /app/includes/command.inc(107): sql_bee_callback(Array, Array)
#1 /app/bee.php(31): bee_process_command()
#2 {main}
  thrown in /app/commands/db.bee.inc on line 279

Note: db-query is fine. it returns:

 ✘  The required bootstrap level for 'db-query' is not ready.