Browse Source

Kumbiaphp clean (#6315)

* Clean Kumbiaphp workerman raw

* Clean dockerfiles
Joan Miquel 4 years ago
parent
commit
a924590dd6

+ 7 - 7
frameworks/PHP/kumbiaphp/bench/app/controllers/ku_controller.php

@@ -13,8 +13,8 @@ class KuController extends AppController
 
 
     public function index()
     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)
     public function query($count = 1)
@@ -22,8 +22,8 @@ class KuController extends AppController
         $count = min(max((int) $count, 1), 500);
         $count = min(max((int) $count, 1), 500);
 
 
         while ($count--) {
         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);
         echo json_encode($worlds);
     }
     }
@@ -33,14 +33,14 @@ class KuController extends AppController
         $count = min(max((int) $count, 1), 500);
         $count = min(max((int) $count, 1), 500);
 
 
         while ($count--) {
         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);
             $row['randomNumber'] = mt_rand(1, 10000);
 
 
             $worlds[] = $row;
             $worlds[] = $row;
         }
         }
+        
         KuRaw::update($worlds);
         KuRaw::update($worlds);
 
 
         echo json_encode($worlds);
         echo json_encode($worlds);

+ 3 - 4
frameworks/PHP/kumbiaphp/bench/app/libs/ku_raw.php

@@ -24,7 +24,6 @@ class KuRaw
             ]
             ]
         );
         );
 
 
-        self::$db        = $pdo->prepare('SELECT id,randomNumber FROM World WHERE id = ?');
         self::$fortune   = $pdo->prepare('SELECT id,message FROM Fortune');
         self::$fortune   = $pdo->prepare('SELECT id,message FROM Fortune');
         self::$random    = $pdo->prepare('SELECT id,randomNumber FROM World WHERE id = ?');
         self::$random    = $pdo->prepare('SELECT id,randomNumber FROM World WHERE id = ?');
         self::$instance  = $pdo;
         self::$instance  = $pdo;
@@ -42,9 +41,9 @@ class KuRaw
 
 
         if (!isset(self::$update[$rows])) {
         if (!isset(self::$update[$rows])) {
             $sql = 'UPDATE world SET randomNumber = CASE id'
             $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);
             self::$update[$rows] = self::$instance->prepare($sql);
         }
         }

+ 2 - 1
frameworks/PHP/kumbiaphp/kumbiaphp-raw.dockerfile

@@ -5,7 +5,8 @@ ARG DEBIAN_FRONTEND=noninteractive
 RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
 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 LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
 RUN apt-get update -yqq > /dev/null && \
 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/
 COPY deploy/conf/* /etc/php/8.0/fpm/
 
 

+ 2 - 1
frameworks/PHP/kumbiaphp/kumbiaphp.dockerfile

@@ -5,7 +5,8 @@ ARG DEBIAN_FRONTEND=noninteractive
 RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
 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 LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
 RUN apt-get update -yqq > /dev/null && \
 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/
 COPY deploy/conf/* /etc/php/8.0/fpm/