From 96938f46a3835c14a1047fc4ff21322ed653009f Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+github@gmail.com>
Date: Wed, 23 Feb 2022 12:36:58 +0100
Subject: [PATCH] create plugin path for database only right before storing it
 in the database (otherwise the command cannot find vital files), fixes #701

---
 cli/Commands/Plugins/PluginRegister.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cli/Commands/Plugins/PluginRegister.php b/cli/Commands/Plugins/PluginRegister.php
index 5167fa3939f..a9ae129a5e6 100644
--- a/cli/Commands/Plugins/PluginRegister.php
+++ b/cli/Commands/Plugins/PluginRegister.php
@@ -45,8 +45,6 @@ class PluginRegister extends AbstractPluginCommand
         }
 
         // determine the plugin path
-        $basepath = \Config::get()->PLUGINS_PATH;
-        $pluginpath = $origin . '/' . $pluginclass;
         $pluginregistered = $pluginManager->getPluginInfo($pluginclass);
 
         // create database schema if needed
@@ -67,6 +65,8 @@ class PluginRegister extends AbstractPluginCommand
             $migrator->migrateTo(null);
         }
 
+        $pluginpath = $origin . '/' . $pluginclass;
+
         // now register the plugin in the database
         $pluginid = $pluginManager->registerPlugin($manifest['pluginname'], $pluginclass, $pluginpath);
 
-- 
GitLab