mirror of
https://github.com/Karaka-Management/oms-Navigation.git
synced 2026-02-11 06:18:41 +00:00
Use default database connection
This commit is contained in:
parent
6398457368
commit
c4e15599be
|
|
@ -38,10 +38,10 @@ class Installer extends InstallerAbstract
|
||||||
{
|
{
|
||||||
parent::install(__DIR__ . '/..', $dbPool, $info);
|
parent::install(__DIR__ . '/..', $dbPool, $info);
|
||||||
|
|
||||||
switch ($dbPool->get('core')->getType()) {
|
switch ($dbPool->get()->getType()) {
|
||||||
case DatabaseType::MYSQL:
|
case DatabaseType::MYSQL:
|
||||||
$dbPool->get('core')->con->prepare(
|
$dbPool->get()->con->prepare(
|
||||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'nav` (
|
'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'nav` (
|
||||||
`nav_id` int(11) NOT NULL,
|
`nav_id` int(11) NOT NULL,
|
||||||
`nav_pid` varchar(40) NOT NULL,
|
`nav_pid` varchar(40) NOT NULL,
|
||||||
`nav_name` varchar(40) NOT NULL,
|
`nav_name` varchar(40) NOT NULL,
|
||||||
|
|
@ -74,7 +74,7 @@ class Installer extends InstallerAbstract
|
||||||
public static function installExternal(DatabasePool $dbPool, array $data)
|
public static function installExternal(DatabasePool $dbPool, array $data)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$dbPool->get('core')->con->query('select 1 from `' . $dbPool->get('core')->prefix . 'nav`');
|
$dbPool->get()->con->query('select 1 from `' . $dbPool->get()->prefix . 'nav`');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -97,8 +97,8 @@ class Installer extends InstallerAbstract
|
||||||
*/
|
*/
|
||||||
private static function installLink($dbPool, $data)
|
private static function installLink($dbPool, $data)
|
||||||
{
|
{
|
||||||
$sth = $dbPool->get('core')->con->prepare(
|
$sth = $dbPool->get()->con->prepare(
|
||||||
'INSERT INTO `' . $dbPool->get('core')->prefix . 'nav` (`nav_id`, `nav_pid`, `nav_name`, `nav_type`, `nav_subtype`, `nav_icon`, `nav_uri`, `nav_target`, `nav_from`, `nav_order`, `nav_parent`, `nav_permission`) VALUES
|
'INSERT INTO `' . $dbPool->get()->prefix . 'nav` (`nav_id`, `nav_pid`, `nav_name`, `nav_type`, `nav_subtype`, `nav_icon`, `nav_uri`, `nav_target`, `nav_from`, `nav_order`, `nav_parent`, `nav_permission`) VALUES
|
||||||
(:id, :pid, :name, :type, :subtype, :icon, :uri, :target, :from, :order, :parent, :perm);'
|
(:id, :pid, :name, :type, :subtype, :icon, :uri, :target, :from, :order, :parent, :perm);'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -117,7 +117,7 @@ class Installer extends InstallerAbstract
|
||||||
|
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
|
|
||||||
$lastInsertID = $dbPool->get('core')->con->lastInsertId();
|
$lastInsertID = $dbPool->get()->con->lastInsertId();
|
||||||
|
|
||||||
foreach ($data['children'] as $link) {
|
foreach ($data['children'] as $link) {
|
||||||
$parent = ($link['parent'] == null ? $lastInsertID : $link['parent']);
|
$parent = ($link['parent'] == null ? $lastInsertID : $link['parent']);
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class Uninstall extends UninstallAbstract
|
||||||
|
|
||||||
$query = new Builder($dbPool->get());
|
$query = new Builder($dbPool->get());
|
||||||
|
|
||||||
$query->prefix($dbPool->get('core')->getPrefix())->drop(
|
$query->prefix($dbPool->get()->getPrefix())->drop(
|
||||||
'nav'
|
'nav'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user