mirror of
https://github.com/Karaka-Management/oms-Navigation.git
synced 2026-02-14 15:58:41 +00:00
add app to installer
This commit is contained in:
parent
1d1e03943e
commit
a98e51dd45
|
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\Navigation\Admin\Install;
|
namespace Modules\Navigation\Admin\Install;
|
||||||
|
|
||||||
use phpOMS\DataStorage\Database\DatabasePool;
|
use phpOMS\Application\ApplicationAbstract;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search class.
|
* Search class.
|
||||||
|
|
@ -30,14 +30,14 @@ final class Search
|
||||||
* Install navigation providing
|
* Install navigation providing
|
||||||
*
|
*
|
||||||
* @param string $path Module path
|
* @param string $path Module path
|
||||||
* @param DatabasePool $dbPool Database pool for database interaction
|
* @param ApplicationAbstract $app Application
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public static function install(string $path, DatabasePool $dbPool) : void
|
public static function install(string $path, ApplicationAbstract $app) : void
|
||||||
{
|
{
|
||||||
\Modules\Search\Admin\Installer::installExternal($dbPool, ['path' => __DIR__ . '/SearchCommands.php']);
|
\Modules\Search\Admin\Installer::installExternal($app, ['path' => __DIR__ . '/SearchCommands.php']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ use Modules\Navigation\Models\NavElementMapper;
|
||||||
use phpOMS\DataStorage\Database\DatabasePool;
|
use phpOMS\DataStorage\Database\DatabasePool;
|
||||||
use phpOMS\Module\InstallerAbstract;
|
use phpOMS\Module\InstallerAbstract;
|
||||||
use phpOMS\System\File\PathException;
|
use phpOMS\System\File\PathException;
|
||||||
|
use phpOMS\Application\ApplicationAbstract;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installer class.
|
* Installer class.
|
||||||
|
|
@ -33,7 +34,7 @@ final class Installer extends InstallerAbstract
|
||||||
/**
|
/**
|
||||||
* Install data from providing modules.
|
* Install data from providing modules.
|
||||||
*
|
*
|
||||||
* @param DatabasePool $dbPool Database pool
|
* @param ApplicationAbstract $app Application
|
||||||
* @param array $data Module info
|
* @param array $data Module info
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
|
|
@ -43,10 +44,10 @@ final class Installer extends InstallerAbstract
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public static function installExternal(DatabasePool $dbPool, array $data) : array
|
public static function installExternal(ApplicationAbstract $app, array $data) : array
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$dbPool->get()->con->query('select 1 from `nav`');
|
$app->dbPool->get()->con->query('select 1 from `nav`');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return []; // @codeCoverageIgnore
|
return []; // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +63,7 @@ final class Installer extends InstallerAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($navData as $link) {
|
foreach ($navData as $link) {
|
||||||
self::installLink($dbPool, $link);
|
self::installLink($app->dbPool, $link);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user