Allow plugins loading from another location
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Kanboard\Core\Plugin;
|
namespace Kanboard\Core\Plugin;
|
||||||
|
|
||||||
|
use Composer\Autoload\ClassLoader;
|
||||||
use DirectoryIterator;
|
use DirectoryIterator;
|
||||||
use PDOException;
|
use PDOException;
|
||||||
use LogicException;
|
use LogicException;
|
||||||
@@ -39,6 +40,10 @@ class Loader extends \Kanboard\Core\Base
|
|||||||
public function scan()
|
public function scan()
|
||||||
{
|
{
|
||||||
if (file_exists(PLUGINS_DIR)) {
|
if (file_exists(PLUGINS_DIR)) {
|
||||||
|
$loader = new ClassLoader();
|
||||||
|
$loader->addPsr4('Kanboard\Plugin\\', PLUGINS_DIR);
|
||||||
|
$loader->register();
|
||||||
|
|
||||||
$dir = new DirectoryIterator(PLUGINS_DIR);
|
$dir = new DirectoryIterator(PLUGINS_DIR);
|
||||||
|
|
||||||
foreach ($dir as $fileinfo) {
|
foreach ($dir as $fileinfo) {
|
||||||
@@ -69,7 +74,6 @@ class Loader extends \Kanboard\Core\Base
|
|||||||
$instance = new $class($this->container);
|
$instance = new $class($this->container);
|
||||||
|
|
||||||
Tool::buildDic($this->container, $instance->getClasses());
|
Tool::buildDic($this->container, $instance->getClasses());
|
||||||
|
|
||||||
Tool::buildDICHelpers($this->container, $instance->getHelpers());
|
Tool::buildDICHelpers($this->container, $instance->getHelpers());
|
||||||
|
|
||||||
$instance->initialize();
|
$instance->initialize();
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
"autoload" : {
|
"autoload" : {
|
||||||
"classmap" : ["app/"],
|
"classmap" : ["app/"],
|
||||||
"psr-4" : {
|
"psr-4" : {
|
||||||
"Kanboard\\Plugin\\": "plugins/",
|
|
||||||
"Kanboard\\" : "app/"
|
"Kanboard\\" : "app/"
|
||||||
},
|
},
|
||||||
"files" : [
|
"files" : [
|
||||||
|
|||||||
Reference in New Issue
Block a user