Skip to content

Commit 2f5c932

Browse files
committed
Fixed bug in upgrade script
1 parent 44a5a6a commit 2f5c932

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed
Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
<?php /** @noinspection SqlNoDataSourceInspection */
22

3+
use DBA\Config;
34
use DBA\Factory;
5+
use DBA\QueryFilter;
46

57
if (!isset($PRESENT["v0.14.x_pagination"])) {
6-
Factory::getAgentFactory()->getDB()->query("INSERT INTO `Config` (`configId`, `configSectionId`, `item`, `value`) VALUES
7-
(78, 3, 'defaultPageSize', '10000');");
8-
Factory::getAgentFactory()->getDB()->query("INSERT INTO `Config` (`configId`, `configSectionId`, `item`, `value`) VALUES
9-
(79, 3, 'maxPageSize', '50000');");
10-
$EXECUTED["v0.14.x_pagination"];
8+
$qF = new QueryFilter(Config::ITEM, DConfig::DEFAULT_PAGE_SIZE, "=");
9+
$item = Factory::getConfigFactory()->filter([Factory::FILTER => $qF], true);
10+
if (!$item) {
11+
$config = new Config(null, 3, DConfig::DEFAULT_PAGE_SIZE, '10000');
12+
Factory::getConfigFactory()->save($config);
13+
}
14+
$qF = new QueryFilter(Config::ITEM, DConfig::MAX_PAGE_SIZE, "=");
15+
$item = Factory::getConfigFactory()->filter([Factory::FILTER => $qF], true);
16+
if (!$item) {
17+
$config = new Config(null, 3, DConfig::MAX_PAGE_SIZE, '50000');
18+
Factory::getConfigFactory()->save($config);
19+
}
1120
}

0 commit comments

Comments
 (0)