better support for installing plugins via composer (#5112)

* merge installation and update commands
* generate metadata from array
* new command to list available packages
* added a management script to simplify updates
* added directory for dev files
* helper functions for installation and listing of packages
* run plugin database installers
This commit is contained in:
Kevin Papst
2024-10-14 21:44:42 +02:00
committed by GitHub
parent 255c7d77d6
commit 96043afd6a
18 changed files with 518 additions and 336 deletions

View File

@@ -109,7 +109,7 @@ class Kernel extends BaseKernel
throw new \Exception(\sprintf('Bundle "%s" does not implement %s, which is not supported since 2.0.', $bundleName, PluginInterface::class));
}
$meta = new PluginMetadata($fullPath);
$meta = PluginMetadata::createFromPath($fullPath);
if ($meta->getKimaiVersion() > Constants::VERSION_ID) {
throw new \Exception(\sprintf('Bundle "%s" requires minimum Kimai version %s, but yours is lower: %s (%s). Please update Kimai or use a lower Plugin version.', $bundleName, $meta->getKimaiVersion(), Constants::VERSION, Constants::VERSION_ID));
@@ -169,11 +169,8 @@ class Kernel extends BaseKernel
$routes->import($configDir . '/routes/' . $this->environment . '/*.yaml');
}
// load application routes
$routes->import($configDir . '/routes.yaml');
foreach ($this->getBundles() as $bundle) {
if (str_contains(\get_class($bundle), 'KimaiPlugin\\')) {
if ($bundle instanceof PluginInterface || str_contains(\get_class($bundle), 'KimaiPlugin\\')) {
if (is_dir($bundle->getPath() . '/Resources/config/')) {
$routes->import($bundle->getPath() . '/Resources/config/routes' . self::CONFIG_EXTS);
} elseif (is_dir($bundle->getPath() . '/config/')) {
@@ -181,5 +178,8 @@ class Kernel extends BaseKernel
}
}
}
// load application routes as last one, so bundles cannot override application ones
$routes->import($configDir . '/routes.yaml');
}
}