]> BookStack Code Mirror - bookstack/blobdiff - app/Console/Commands/RegeneratePermissions.php
Add APP_LOGGING
[bookstack] / app / Console / Commands / RegeneratePermissions.php
index 966ee4a820841429148a19c3724003492909742b..1dc25f9aa6e996f4a8db898b513dfe08207f83a3 100644 (file)
@@ -12,7 +12,7 @@ class RegeneratePermissions extends Command
      *
      * @var string
      */
-    protected $signature = 'bookstack:regenerate-permissions';
+    protected $signature = 'bookstack:regenerate-permissions {--database= : The database connection to use.}';
 
     /**
      * The console command description.
@@ -46,7 +46,14 @@ class RegeneratePermissions extends Command
      */
     public function handle()
     {
+        $connection = \DB::getDefaultConnection();
+        if ($this->option('database') !== null) {
+            \DB::setDefaultConnection($this->option('database'));
+        }
+
         $this->permissionService->buildJointPermissions();
+
+        \DB::setDefaultConnection($connection);
         $this->comment('Permissions regenerated');
     }
 }