mirror of
https://github.com/Karaka-Management/oms-Admin.git
synced 2026-02-14 03:28:41 +00:00
impl. todos or move to Project.md
This commit is contained in:
parent
fc7fc8055c
commit
348cd2d874
|
|
@ -20,6 +20,8 @@ use phpOMS\DataStorage\Database\DatabasePool;
|
||||||
use phpOMS\DataStorage\Database\Query\Builder;
|
use phpOMS\DataStorage\Database\Query\Builder;
|
||||||
use phpOMS\Module\InstallerAbstract;
|
use phpOMS\Module\InstallerAbstract;
|
||||||
use phpOMS\Module\ModuleInfo;
|
use phpOMS\Module\ModuleInfo;
|
||||||
|
use phpOMS\Application\ApplicationAbstract;
|
||||||
|
use phpOMS\System\File\PathException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installer class.
|
* Installer class.
|
||||||
|
|
@ -172,5 +174,51 @@ final class Installer extends InstallerAbstract
|
||||||
*/
|
*/
|
||||||
public static function installExternal(ApplicationAbstract $app, array $data) : array
|
public static function installExternal(ApplicationAbstract $app, array $data) : array
|
||||||
{
|
{
|
||||||
|
if (!\is_file($data['path'] ?? '')) {
|
||||||
|
throw new PathException($data['path'] ?? '');
|
||||||
|
}
|
||||||
|
|
||||||
|
$adminFile = \file_get_contents($data['path'] ?? '');
|
||||||
|
if ($adminFile === false) {
|
||||||
|
throw new PathException($data['path'] ?? ''); // @codeCoverageIgnore
|
||||||
|
}
|
||||||
|
|
||||||
|
$adminData = \json_decode($adminFile, true) ?? [];
|
||||||
|
if ($adminData === false) {
|
||||||
|
throw new \Exception(); // @codeCoverageIgnore
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = [
|
||||||
|
'settings' => [],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($adminData as $admin) {
|
||||||
|
switch ($admin['type']) {
|
||||||
|
case 'setting':
|
||||||
|
$result['settings'][] = self::createSettings($app, $admin);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create settings.
|
||||||
|
*
|
||||||
|
* @param ApplicationAbstract $app Database instance
|
||||||
|
* @param array $settings Media info
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
private static function createSettings(ApplicationAbstract $app, array $setting) : array
|
||||||
|
{
|
||||||
|
unset($setting['type']);
|
||||||
|
$app->appSettings->create($setting);
|
||||||
|
|
||||||
|
return $setting;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,7 @@ If you have a good idea for improvement feel free to create a new issue with all
|
||||||
|
|
||||||
### Issues
|
### Issues
|
||||||
|
|
||||||
Feel free to grab any open issue implement it and create a new pull request. Most issues can be found in the code and have the following structure:
|
Feel free to grab any open issue implement it and create a new pull request. Most issues can be found in the `Project.md` file in the `Docs` repository.
|
||||||
|
|
||||||
```php
|
|
||||||
/**
|
|
||||||
* @todo Orange-Management/Orange-Management#ISSUE_NUMBER [d:difficulty]
|
|
||||||
* Description for the issue
|
|
||||||
*/
|
|
||||||
```
|
|
||||||
|
|
||||||
The issue information can be used to provide additional information such as priority, difficulty and type. For your first issue try to find a issue marked `[d:first]` or `[d:beginner]`.
|
The issue information can be used to provide additional information such as priority, difficulty and type. For your first issue try to find a issue marked `[d:first]` or `[d:beginner]`.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -528,7 +528,6 @@ final class ApiController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle Routes of already installed modules
|
// handle Routes of already installed modules
|
||||||
// @todo: what about navigation links, works for Api and Backend but only since the Navigation module is installed afterwards. Other applications don't have this and would not have the links?
|
|
||||||
foreach ($installed as $module => $data) {
|
foreach ($installed as $module => $data) {
|
||||||
$class = '\Modules\\' . $module . '\Admin\Installer';
|
$class = '\Modules\\' . $module . '\Admin\Installer';
|
||||||
|
|
||||||
|
|
@ -1140,6 +1139,15 @@ final class ApiController extends Controller
|
||||||
$queryLoad->execute();
|
$queryLoad->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// install receiving from application (receiving from module is already installed during the module installation)
|
||||||
|
$appManager = new ApplicationManager($this->app);
|
||||||
|
$receiving = $appManager->getProvidingForModule($module);
|
||||||
|
foreach ($receiving as $app => $modules) {
|
||||||
|
foreach ($modules as $module) {
|
||||||
|
$this->app->moduleManager->installProviding('/Web/' . $app, $module);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ModuleStatusUpdateType::UNINSTALL:
|
case ModuleStatusUpdateType::UNINSTALL:
|
||||||
$done = $module === 'Admin' ? false : $this->app->moduleManager->uninstall($module);
|
$done = $module === 'Admin' ? false : $this->app->moduleManager->uninstall($module);
|
||||||
|
|
@ -1657,10 +1665,8 @@ final class ApiController extends Controller
|
||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*
|
*
|
||||||
* @todo Orange-Management/Modules#64
|
|
||||||
* Create update functionality
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
|
* @todo implement
|
||||||
*/
|
*/
|
||||||
public function apiCheckForUpdates(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
|
public function apiCheckForUpdates(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user