Génériser gestion versions de PHP (multi-php) #75

Open
opened 2022-07-01 11:44:56 +02:00 by lpoujol · 2 comments
Owner

Il faudrait voir si on peut rendre plus générique les 'if [ "$php_version" = XX ]; then' ... utilisés dans web-add.sh (et ses frères et soeurs).

Ca éviterait de devoir le mettre-à-jour lors de l'ajout d'un nouveau conteneur.

Il faudrait voir si on peut rendre plus générique les 'if [ "$php_version" = XX ]; then' ... utilisés dans web-add.sh (et ses frères et soeurs). Ca éviterait de devoir le mettre-à-jour lors de l'ajout d'un nouveau conteneur.
Owner

Paths were standardized for new php version from 7.0 onward in Debian so it is definitely possible :

In the case of e76ea90d89/scripts/web-add.sh (L428-L442) it can be massively simplified as :

if [ "${php_version}" -lt '70' ]; then
    pool_path="/etc/php5/fpm/pool.d/"
else
   php_dot_version=<logic to get the dot in the php version>
   pool_path="/etc/php/${php_dot_version}/fpm/pool.d/"
fi

And in the case of e76ea90d89/scripts/web-add.sh (L601-L622) it can be massively simplified as :

if [ "${php_version}" -lt '70' ]; then
    initscript_path="/etc/init.d/php5-fpm"
    binary="php5-fpm"
else
    php_dot_version=<logic to get the dot in the php version>
    initscript_path="/etc/init.d/php${php_dot_version}-fpm"
    binary="php-fpm${php_dot_version}"
fi

And for e76ea90d89/scripts/web-add.sh (L772-L793) it is exactly the same thing as the previous one.

This would remove the need to update evoadmin-web to support any new version of PHP (well, at least until 10.0) which would massively reduce the overhead that currently exists when adding support of new PHP version in things using evoadmin-web.

The main problem is therefor to find how to get the dotted version number of PHP from a dot-less version number.

Paths were standardized for new php version from 7.0 onward in Debian so it is definitely possible : In the case of https://gitea.evolix.org/evolix/evoadmin-web/src/commit/e76ea90d89706699ace21811c9720d853f1961e8/scripts/web-add.sh#L428-L442 it can be massively simplified as : ```sh if [ "${php_version}" -lt '70' ]; then pool_path="/etc/php5/fpm/pool.d/" else php_dot_version=<logic to get the dot in the php version> pool_path="/etc/php/${php_dot_version}/fpm/pool.d/" fi ``` And in the case of https://gitea.evolix.org/evolix/evoadmin-web/src/commit/e76ea90d89706699ace21811c9720d853f1961e8/scripts/web-add.sh#L601-L622 it can be massively simplified as : ```sh if [ "${php_version}" -lt '70' ]; then initscript_path="/etc/init.d/php5-fpm" binary="php5-fpm" else php_dot_version=<logic to get the dot in the php version> initscript_path="/etc/init.d/php${php_dot_version}-fpm" binary="php-fpm${php_dot_version}" fi ``` And for https://gitea.evolix.org/evolix/evoadmin-web/src/commit/e76ea90d89706699ace21811c9720d853f1961e8/scripts/web-add.sh#L772-L793 it is exactly the same thing as the previous one. This would remove the need to update evoadmin-web to support any new version of PHP (well, at least until 10.0) which would massively reduce the overhead that currently exists when adding support of new PHP version in things using evoadmin-web. The main problem is therefor to find how to get the dotted version number of PHP from a dot-less version number.
Owner

I started to do it in ansible-roles, 👍 to move forward in Evoadmin-web too.

I started to do it in ansible-roles, 👍 to move forward in Evoadmin-web too.
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: evolix/evoadmin-web#75
No description provided.