Browse Source

[php] Mako update to PHP 8.5 (#10329)

* [php] Mako update to PHP 8.5

* Update directory structure and fix deprecations

* Delete frameworks/PHP/mako/composer.lock

---------

Co-authored-by: Frederic G. Østby <[email protected]>
Joan Miquel 2 weeks ago
parent
commit
d690f9e3ce

+ 1 - 1
frameworks/PHP/mako/app/controllers/Index.php → frameworks/PHP/mako/app/http/controllers/Index.php

@@ -1,6 +1,6 @@
 <?php
 <?php
 
 
-namespace app\controllers;
+namespace app\http\controllers;
 
 
 use mako\http\routing\Controller;
 use mako\http\routing\Controller;
 use mako\view\ViewFactory;
 use mako\view\ViewFactory;

+ 0 - 0
frameworks/PHP/mako/app/routing/constraints.php → frameworks/PHP/mako/app/http/routing/constraints.php


+ 0 - 0
frameworks/PHP/mako/app/routing/middleware.php → frameworks/PHP/mako/app/http/routing/middleware.php


+ 1 - 1
frameworks/PHP/mako/app/routing/routes.php → frameworks/PHP/mako/app/http/routing/routes.php

@@ -1,6 +1,6 @@
 <?php
 <?php
 
 
-use app\controllers\Index;
+use app\http\controllers\Index;
 
 
 /** @var \mako\http\routing\Routes $routes */
 /** @var \mako\http\routing\Routes $routes */
 
 

+ 1 - 1
frameworks/PHP/mako/app/init.php

@@ -4,7 +4,7 @@
  * Configure PHP error reporting.
  * Configure PHP error reporting.
  * @see http://php.net/manual/en/function.error-reporting.php
  * @see http://php.net/manual/en/function.error-reporting.php
  */
  */
-error_reporting(E_ALL | E_STRICT);
+error_reporting(E_ALL);
 
 
 /*
 /*
  * Choose if errors that are NOT caught by the Mako error and exception handlers should be
  * Choose if errors that are NOT caught by the Mako error and exception handlers should be

+ 1 - 1
frameworks/PHP/mako/app/models/Fortune.php

@@ -5,5 +5,5 @@ namespace app\models;
 use mako\database\midgard\ORM;
 use mako\database\midgard\ORM;
 
 
 class Fortune extends ORM {
 class Fortune extends ORM {
-	protected $tableName = 'Fortune';
+	protected string $tableName = 'Fortune';
 }
 }

+ 1 - 1
frameworks/PHP/mako/app/models/World.php

@@ -5,5 +5,5 @@ namespace app\models;
 use mako\database\midgard\ORM;
 use mako\database\midgard\ORM;
 
 
 class World extends ORM {
 class World extends ORM {
-	protected $tableName = 'World';
+	protected string $tableName = 'World';
 }
 }

+ 1 - 1
frameworks/PHP/mako/composer.json

@@ -1,7 +1,7 @@
 {
 {
     "require": {
     "require": {
         "php": ">=7.4.0",
         "php": ">=7.4.0",
-        "mako/framework": "^9.0"
+        "mako/framework": "^11.0"
     },
     },
 	"autoload": {
 	"autoload": {
         "psr-4": {
         "psr-4": {

+ 5 - 5
frameworks/PHP/mako/mako.dockerfile

@@ -1,4 +1,4 @@
-FROM ubuntu:22.04
+FROM ubuntu:24.04
 
 
 ARG DEBIAN_FRONTEND=noninteractive
 ARG DEBIAN_FRONTEND=noninteractive
 
 
@@ -7,16 +7,16 @@ RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null && \
     apt-get update -yqq > /dev/null && apt-get upgrade -yqq > /dev/null
     apt-get update -yqq > /dev/null && apt-get upgrade -yqq > /dev/null
 
 
 RUN apt-get install -yqq nginx git unzip \
 RUN apt-get install -yqq nginx git unzip \
-    php8.3-cli php8.3-fpm php8.3-mysql php8.3-mbstring php8.3-xml php8.3-curl > /dev/null
+    php8.5-cli php8.5-fpm php8.5-mysql php8.5-mbstring php8.5-xml php8.5-curl > /dev/null
 
 
 COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
 COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
 
 
-COPY deploy/conf/* /etc/php/8.3/fpm/
+COPY deploy/conf/* /etc/php/8.5/fpm/
 
 
 ADD ./ /mako
 ADD ./ /mako
 WORKDIR /mako
 WORKDIR /mako
 
 
-RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/8.3/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.5/fpm/php-fpm.conf ; fi;
 
 
 RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --ignore-platform-reqs --quiet
 RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --ignore-platform-reqs --quiet
 
 
@@ -24,5 +24,5 @@ RUN chmod -R 777 app
 
 
 EXPOSE 8080
 EXPOSE 8080
 
 
-CMD service php8.3-fpm start && \
+CMD service php8.5-fpm start && \
     nginx -c /mako/deploy/nginx.conf
     nginx -c /mako/deploy/nginx.conf

+ 2 - 1
frameworks/PHP/mako/public/index.php

@@ -1,5 +1,6 @@
 <?php
 <?php
 
 
+use mako\application\CurrentApplication;
 use mako\application\web\Application;
 use mako\application\web\Application;
 
 
 /**
 /**
@@ -10,4 +11,4 @@ include dirname(__DIR__) . '/app/init.php';
 /*
 /*
  * Start and run the application.
  * Start and run the application.
  */
  */
-Application::start(MAKO_APPLICATION_PATH)->run();
+CurrentApplication::set(new Application(MAKO_APPLICATION_PATH))->run();