1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/phpinfo_ynh.git synced 2024-09-03 19:56:23 +02:00

Merge pull request #14 from YunoHost-Apps/version-2

Version 2
This commit is contained in:
eric_G 2023-11-11 23:05:15 +01:00 committed by GitHub
commit 3f0739b011
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 89 additions and 297 deletions

View file

@ -5,7 +5,8 @@ It shall NOT be edited by hand.
# Phpinfo for YunoHost
[![Integration level](https://dash.yunohost.org/integration/phpinfo.svg)](https://dash.yunohost.org/appci/app/phpinfo) ![Working status](https://ci-apps.yunohost.org/ci/badges/phpinfo.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/phpinfo.maintain.svg)
[![Integration level](https://dash.yunohost.org/integration/phpinfo.svg)](https://dash.yunohost.org/appci/app/phpinfo) ![Working status](https://ci-apps.yunohost.org/ci/badges/phpinfo.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/phpinfo.maintain.svg)
[![Install Phpinfo with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=phpinfo)
*[Lire ce readme en français.](./README_fr.md)*

View file

@ -5,22 +5,23 @@ It shall NOT be edited by hand.
# Phpinfo pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/phpinfo.svg)](https://dash.yunohost.org/appci/app/phpinfo) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/phpinfo.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/phpinfo.maintain.svg)
[![Niveau dintégration](https://dash.yunohost.org/integration/phpinfo.svg)](https://dash.yunohost.org/appci/app/phpinfo) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/phpinfo.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/phpinfo.maintain.svg)
[![Installer Phpinfo avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=phpinfo)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer Phpinfo rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
> *Ce package vous permet dinstaller Phpinfo rapidement et simplement sur un serveur YunoHost.
Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment linstaller et en profiter.*
## Vue d'ensemble
## Vue densemble
Simple phpinfo
**Version incluse :** 1.0~ynh4
## Documentations et ressources
* Site officiel de l'app : <https://www.php.net/manual/fr/function.phpinfo.php>
* Site officiel de lapp : <https://www.php.net/manual/fr/function.phpinfo.php>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_phpinfo>
* Signaler un bug : <https://github.com/YunoHost-Apps/phpinfo_ynh/issues>
@ -36,4 +37,4 @@ ou
sudo yunohost app upgrade phpinfo -u https://github.com/YunoHost-Apps/phpinfo_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>
**Plus dinfos sur le packaging dapplications :** <https://yunohost.org/packaging_apps>

View file

@ -1,37 +0,0 @@
;; Test complet avec php 7.3
; Manifest
domain="domain.tld"
path="/path"
phpversion="7.4"
; Checks
pkg_linter=1
setup_sub_dir=1
setup_root=0
setup_nourl=0
setup_private=0
setup_public=0
upgrade=1
backup_restore=1
multi_instance=1
incorrect_path=0
port_already_use=0
change_url=0
;; Test avec php 7.4
; Manifest
domain="domain.tld"
path="/path"
phpversion="7.4"
; Checks
setup_sub_dir=1
backup_restore=1
;; Test avec php 8.0
; Manifest
domain="domain.tld"
path="/path"
phpversion="8.0"
; Checks
setup_sub_dir=1
backup_restore=1
;;; Options
Email=
Notification=none

4
conf/extra_php-fpm.conf Normal file
View file

@ -0,0 +1,4 @@
; Additional php.ini defines, specific to this pool of workers.
php_admin_value[upload_max_filesize] = 50M
php_admin_value[post_max_size] = 50M

View file

@ -2,7 +2,7 @@
location __PATH__/ {
# Path to source
alias __FINALPATH__/;
alias __INSTALL_DIR__/;
index index.php;

View file

View file

@ -1,52 +0,0 @@
{
"name": "Phpinfo",
"id": "phpinfo",
"packaging_format": 1,
"description": {
"en": "Simple phpinfo",
"fr": "Simple phpinfo"
},
"version": "1.0~ynh4",
"url": "https://www.php.net/manual/fr/function.phpinfo.php",
"upstream": {
"license": "GPL-3.0-or-later",
"website": "https://www.php.net/manual/fr/function.phpinfo.php"
},
"license": "GPL-3.0-or-later",
"maintainer": {
"name": "Maniack Crudelis",
"email": "maniackc_dev@crudelis.fr"
},
"requirements": {
"yunohost": ">= 11.0.9"
},
"multi_instance": true,
"services": [
"nginx",
"php7.4-fpm"
],
"arguments": {
"install" : [
{
"name": "domain",
"type": "domain"
},
{
"name": "path",
"type": "path",
"example": "/phpinfo",
"default": "/phpinfo"
},
{
"name": "phpversion",
"type": "string",
"ask": {
"en": "Choose the version of PHP to use.",
"fr": "Choisissez la version de PHP à utiliser."
},
"choices": ["7.3", "7.4", "8.0", "8.1"],
"default": "7.4"
}
]
}
}

50
manifest.toml Normal file
View file

@ -0,0 +1,50 @@
packaging_format = 2
id = "phpinfo"
name = "Phpinfo"
description.en = "Simple phpinfo"
description.fr = "Simple phpinfo"
version = "1.0~ynh4"
maintainers = ["Maniack Crudelis"]
[upstream]
license = "GPL-3.0-or-later"
website = "https://www.php.net/manual/fr/function.phpinfo.php"
[integration]
yunohost = ">= 11.1.21"
architectures = "all"
multi_instance = true
ldap = false
sso = false
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
[install]
[install.domain]
type = "domain"
[install.path]
type = "path"
default = "/phpinfo"
[install.phpversion]
ask.en = "Choose the version of PHP to use."
ask.fr = "Choisissez la version de PHP à utiliser."
type = "string"
choices = ["7.4", "8.0", "8.1", "8.2"]
default = "8.0"
[resources]
[resources.system_user]
[resources.install_dir]
[resources.permissions]
main.url = "/"
[resources.apt]
packages = "php8.0-fpm"

View file

@ -4,8 +4,6 @@
# COMMON VARIABLES
#=================================================
YNH_PHP_VERSION=7.4
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -10,24 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
@ -37,7 +19,7 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$final_path"
ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION

View file

@ -9,51 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
phpversion=$YNH_APP_ARG_PHPVERSION
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..."
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# STANDARD MODIFICATIONS
#=================================================
@ -61,14 +16,11 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
mkdir -p $install_dir
cp ../sources/index.php /$install_dir/.
mkdir -p $final_path
cp ../sources/index.php /$final_path/.
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# PHP-FPM CONFIGURATION
@ -86,13 +38,6 @@ ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,26 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
@ -45,16 +25,6 @@ ynh_script_progression --message="Removing PHP-FPM configuration..."
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -10,53 +10,15 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..."
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
ynh_restore_file --origin_path="$install_dir"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION

View file

@ -9,49 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -60,13 +23,12 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..."
mkdir -p $final_path
cp -f ../sources/index.php /$final_path/.
mkdir -p $install_dir
cp -f ../sources/index.php /$install_dir/.
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# PHP-FPM CONFIGURATION
@ -84,13 +46,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

13
tests.toml Normal file
View file

@ -0,0 +1,13 @@
test_format = 1.0
[default]
# ------------
# Tests to run
# ------------
exclude = ["install.private", "change_url"]
# -------------------------------
# Default args to use for install
# -------------------------------