Browse Source

[kumbiaphp] Update to PHP 8 (#6179)

Joan Miquel 4 years ago
parent
commit
17b5927e60

+ 9 - 9
frameworks/PHP/kumbiaphp/bench/app/config/config.php

@@ -1,13 +1,13 @@
 <?php
 
 return [
-'application' => [
-    'name' => 'KUMBIA PROJECT',
-    'log_exceptions' => 'Off',
-    //'cache_template' => 'On',
-    'cache_driver' => 'nixfile',
-    'metadata_lifetime' => '+1 year',
-    'namespace_auth' => 'default',
-    //'routes' => 'On',
+    'application' => [
+        'name' => 'Bench',
+        'log_exceptions' => 'Off',
+        //'cache_template' => 'On',
+        'cache_driver' => 'nixfile',
+        'metadata_lifetime' => '+1 year',
+        'namespace_auth' => 'default',
+        //'routes' => 'On',
     ],
-];
+];

+ 2 - 2
frameworks/PHP/kumbiaphp/bench/app/controllers/db_controller.php

@@ -15,7 +15,7 @@ class DbController extends AppController
 
     public function query($count = 1)
     {
-        $count = min(max($count, 1), 500);
+        $count = min(max((int) $count, 1), 500);
 
         while ($count--) {
             $worlds[] = World::byId(mt_rand(1, 10000));
@@ -25,7 +25,7 @@ class DbController extends AppController
 
     public function update($count = 1)
     {
-        $count = min(max($count, 1), 500);
+        $count = min(max((int) $count, 1), 500);
 
         while ($count--) {
             $row = World::byId(mt_rand(1, 10000));

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

@@ -19,7 +19,7 @@ class KuController extends AppController
 
     public function query($count = 1)
     {
-        $count = min(max($count, 1), 500);
+        $count = min(max((int) $count, 1), 500);
 
         while ($count--) {
             KuRaw::$db->execute([mt_rand(1, 10000)]);
@@ -30,7 +30,7 @@ class KuController extends AppController
 
     public function update($count = 1)
     {
-        $count = min(max($count, 1), 500);
+        $count = min(max((int) $count, 1), 500);
 
         while ($count--) {
             $id = mt_rand(1, 10000);

+ 2 - 2
frameworks/PHP/kumbiaphp/bench/app/controllers/ra_controller.php

@@ -22,7 +22,7 @@ class RaController extends AppController
 
     public function query($count = 1)
     {
-        $count = min(max($count, 1), 500);
+        $count = min(max((int) $count, 1), 500);
         $res = $this->pdo->prepare('SELECT * FROM World WHERE id=?');
 
         while ($count--) {
@@ -34,7 +34,7 @@ class RaController extends AppController
 
     public function update($count = 1)
     {
-        $count = min(max($count, 1), 500);
+        $count = min(max((int) $count, 1), 500);
 
         $this->pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
         $sth = $this->pdo->prepare('SELECT id, randomNumber FROM World WHERE id=?');

+ 1 - 0
frameworks/PHP/kumbiaphp/deploy/nginx.conf

@@ -4,6 +4,7 @@ worker_processes  auto;
 error_log stderr error;
 #worker_rlimit_nofile 2000000;
 timer_resolution 1s;
+daemon off;
 
 events {
     worker_connections 16384;

+ 6 - 6
frameworks/PHP/kumbiaphp/kumbiaphp-raw.dockerfile

@@ -1,20 +1,20 @@
-FROM ubuntu:20.04
+FROM ubuntu:20.10
 
 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 php7.4 php7.4-common php7.4-cli php7.4-fpm php7.4-mysql  > /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
 
-COPY deploy/conf/* /etc/php/7.4/fpm/
+COPY deploy/conf/* /etc/php/8.0/fpm/
 
 ADD ./ /kumbiaphp
 WORKDIR /kumbiaphp
 
 RUN git clone -b v1.1.2 --single-branch --depth 1 -q https://github.com/KumbiaPHP/KumbiaPHP.git vendor/Kumbia
 
-RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/7.4/fpm/php-fpm.conf ; fi;
+RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/8.0/fpm/php-fpm.conf ; fi;
 
-CMD service php7.4-fpm start && \
-    nginx -c /kumbiaphp/deploy/nginx.conf -g "daemon off;"
+CMD service php8.0-fpm start && \
+    nginx -c /kumbiaphp/deploy/nginx.conf

+ 7 - 7
frameworks/PHP/kumbiaphp/kumbiaphp.dockerfile

@@ -1,21 +1,21 @@
-FROM ubuntu:20.04
+FROM ubuntu:20.10
 
 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 php7.4 php7.4-common php7.4-cli php7.4-fpm php7.4-mysql  > /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
 
-COPY deploy/conf/* /etc/php/7.4/fpm/
+COPY deploy/conf/* /etc/php/8.0/fpm/
 
 ADD ./ /kumbiaphp
 WORKDIR /kumbiaphp
 
 RUN git clone -b v1.1.2 --single-branch --depth 1 https://github.com/KumbiaPHP/KumbiaPHP.git vendor/Kumbia
-RUN git clone -b master --single-branch --depth 1 https://github.com/KumbiaPHP/ActiveRecord.git vendor/Kumbia/ActiveRecord
+RUN git clone -b dev --single-branch --depth 1 https://github.com/KumbiaPHP/ActiveRecord.git vendor/Kumbia/ActiveRecord
 
-RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/7.4/fpm/php-fpm.conf ; fi;
+RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/8.0/fpm/php-fpm.conf ; fi;
 
-CMD service php7.4-fpm start && \
-    nginx -c /kumbiaphp/deploy/nginx.conf -g "daemon off;"
+CMD service php8.0-fpm start && \
+    nginx -c /kumbiaphp/deploy/nginx.conf