Skip to content

Commit

Permalink
Kumbiaphp clean (#6315)
Browse files Browse the repository at this point in the history
* Clean Kumbiaphp workerman raw

* Clean dockerfiles
  • Loading branch information
joanhey authored Jan 23, 2021
1 parent 8a73cb0 commit a924590
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
14 changes: 7 additions & 7 deletions frameworks/PHP/kumbiaphp/bench/app/controllers/ku_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ protected function before_filter()

public function index()
{
KuRaw::$db->execute([mt_rand(1, 10000)]);
echo json_encode(KuRaw::$db->fetch());
KuRaw::$random->execute([mt_rand(1, 10000)]);
echo json_encode(KuRaw::$random->fetch());
}

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

while ($count--) {
KuRaw::$db->execute([mt_rand(1, 10000)]);
$worlds[] = KuRaw::$db->fetch();
KuRaw::$random->execute([mt_rand(1, 10000)]);
$worlds[] = KuRaw::$random->fetch();
}
echo json_encode($worlds);
}
Expand All @@ -33,14 +33,14 @@ public function update($count = 1)
$count = min(max((int) $count, 1), 500);

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

KuRaw::$random->execute([$id]);
$row = ['id' => $id, 'randomNumber' => KuRaw::$random->fetchColumn()];
KuRaw::$random->execute([mt_rand(1, 10000)]);
$row = KuRaw::$random->fetch();
$row['randomNumber'] = mt_rand(1, 10000);

$worlds[] = $row;
}

KuRaw::update($worlds);

echo json_encode($worlds);
Expand Down
7 changes: 3 additions & 4 deletions frameworks/PHP/kumbiaphp/bench/app/libs/ku_raw.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public static function init()
]
);

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

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

self::$update[$rows] = self::$instance->prepare($sql);
}
Expand Down
3 changes: 2 additions & 1 deletion frameworks/PHP/kumbiaphp/kumbiaphp-raw.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
RUN apt-get update -yqq > /dev/null && \
apt-get install -yqq nginx git unzip php8.0 php8.0-common php8.0-cli php8.0-fpm php8.0-mysql > /dev/null
apt-get install -yqq nginx git unzip \
php8.0-fpm php8.0-mysql > /dev/null

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

Expand Down
3 changes: 2 additions & 1 deletion frameworks/PHP/kumbiaphp/kumbiaphp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
RUN apt-get update -yqq > /dev/null && \
apt-get install -yqq nginx git unzip php8.0 php8.0-common php8.0-cli php8.0-fpm php8.0-mysql > /dev/null
apt-get install -yqq nginx git unzip \
php8.0-fpm php8.0-mysql > /dev/null

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

Expand Down

0 comments on commit a924590

Please sign in to comment.