Skip to content

Commit a924590

Browse files
authored
Kumbiaphp clean (#6315)
* Clean Kumbiaphp workerman raw * Clean dockerfiles
1 parent 8a73cb0 commit a924590

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

frameworks/PHP/kumbiaphp/bench/app/controllers/ku_controller.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ protected function before_filter()
1313

1414
public function index()
1515
{
16-
KuRaw::$db->execute([mt_rand(1, 10000)]);
17-
echo json_encode(KuRaw::$db->fetch());
16+
KuRaw::$random->execute([mt_rand(1, 10000)]);
17+
echo json_encode(KuRaw::$random->fetch());
1818
}
1919

2020
public function query($count = 1)
2121
{
2222
$count = min(max((int) $count, 1), 500);
2323

2424
while ($count--) {
25-
KuRaw::$db->execute([mt_rand(1, 10000)]);
26-
$worlds[] = KuRaw::$db->fetch();
25+
KuRaw::$random->execute([mt_rand(1, 10000)]);
26+
$worlds[] = KuRaw::$random->fetch();
2727
}
2828
echo json_encode($worlds);
2929
}
@@ -33,14 +33,14 @@ public function update($count = 1)
3333
$count = min(max((int) $count, 1), 500);
3434

3535
while ($count--) {
36-
$id = mt_rand(1, 10000);
3736

38-
KuRaw::$random->execute([$id]);
39-
$row = ['id' => $id, 'randomNumber' => KuRaw::$random->fetchColumn()];
37+
KuRaw::$random->execute([mt_rand(1, 10000)]);
38+
$row = KuRaw::$random->fetch();
4039
$row['randomNumber'] = mt_rand(1, 10000);
4140

4241
$worlds[] = $row;
4342
}
43+
4444
KuRaw::update($worlds);
4545

4646
echo json_encode($worlds);

frameworks/PHP/kumbiaphp/bench/app/libs/ku_raw.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public static function init()
2424
]
2525
);
2626

27-
self::$db = $pdo->prepare('SELECT id,randomNumber FROM World WHERE id = ?');
2827
self::$fortune = $pdo->prepare('SELECT id,message FROM Fortune');
2928
self::$random = $pdo->prepare('SELECT id,randomNumber FROM World WHERE id = ?');
3029
self::$instance = $pdo;
@@ -42,9 +41,9 @@ public static function update(array $worlds)
4241

4342
if (!isset(self::$update[$rows])) {
4443
$sql = 'UPDATE world SET randomNumber = CASE id'
45-
. str_repeat(' WHEN ?::INTEGER THEN ?::INTEGER ', $rows) .
46-
'END WHERE id IN ('
47-
. implode(', ', array_fill(0, $rows, '?::INTEGER')) . ')';
44+
. str_repeat(' WHEN ?::INTEGER THEN ?::INTEGER ', $rows)
45+
. 'END WHERE id IN ('
46+
. str_repeat('?::INTEGER,', $rows - 1) . '?::INTEGER)';
4847

4948
self::$update[$rows] = self::$instance->prepare($sql);
5049
}

frameworks/PHP/kumbiaphp/kumbiaphp-raw.dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ ARG DEBIAN_FRONTEND=noninteractive
55
RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
66
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
77
RUN apt-get update -yqq > /dev/null && \
8-
apt-get install -yqq nginx git unzip php8.0 php8.0-common php8.0-cli php8.0-fpm php8.0-mysql > /dev/null
8+
apt-get install -yqq nginx git unzip \
9+
php8.0-fpm php8.0-mysql > /dev/null
910

1011
COPY deploy/conf/* /etc/php/8.0/fpm/
1112

frameworks/PHP/kumbiaphp/kumbiaphp.dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ ARG DEBIAN_FRONTEND=noninteractive
55
RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
66
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
77
RUN apt-get update -yqq > /dev/null && \
8-
apt-get install -yqq nginx git unzip php8.0 php8.0-common php8.0-cli php8.0-fpm php8.0-mysql > /dev/null
8+
apt-get install -yqq nginx git unzip \
9+
php8.0-fpm php8.0-mysql > /dev/null
910

1011
COPY deploy/conf/* /etc/php/8.0/fpm/
1112

0 commit comments

Comments
 (0)