From a13a66cfc7c5525cfaaf096017188c81ae2d50fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89ric=20Gaspar?=
<46165813+ericgaspar@users.noreply.github.com>
Date: Mon, 12 Oct 2020 20:47:58 +0200
Subject: [PATCH] Testing (#5)
* upgrade to 4.7.7
---
LICENSE | 674 +++++++++++++++++++++++
README.md | 80 ++-
README_fr.md | 73 +++
check_process | 17 +-
conf/nginx.conf | 7 +-
conf/php-fpm.conf | 2 +-
manifest.json | 17 +-
pull_request_template.md | 18 +
scripts/_common.sh | 4 +-
scripts/backup | 19 +-
scripts/change_url | 10 +-
scripts/install | 96 +---
scripts/remove | 20 +-
scripts/restore | 36 +-
scripts/upgrade | 58 +-
sources/root_access_disabled/adminer.php | 32 +-
sources/with_root_access/index.php | 32 +-
17 files changed, 966 insertions(+), 229 deletions(-)
create mode 100644 LICENSE
create mode 100644 README_fr.md
create mode 100644 pull_request_template.md
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..f288702
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
-Shipped Version: **4.7.6**
+> *This package allows you to install Adminer quickly and simply on a YunoHost server.
+If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
-Adminer (formerly phpMinAdmin better alternate to phpmyadmin) is a full-featured database management tool written in PHP.
-http://www.adminer.org
Replace phpMyAdmin with Adminer and you will get a tidier user interface, better support for MySQL features, higher performance and more security. See detailed comparison https://www.adminer.org/en/phpmyadmin/
-Adminer development priorities are: 1. Security, 2. User experience, 3. Performance, 4. Feature set, 5. Size.
+## Screenshots +![](https://www.adminer.org/static/screenshots/db.png) + +## Demo + +* [Official demo](https://demo.adminer.org/adminer.php?username=) + +## Configuration + +You need to know the root password from here `/etc/yunohost/mysql` or the app username and password from `setting.yml` under `/etc/yunohost/apps/appname` to login. +For themes download the adminer.css from the main website and put the file in the app folder. +If you have problems with drivers see here: https://www.adminer.org/en/drivers. + +## Documentation + + * Official documentation: Link to the official documentation of this app + * YunoHost documentation: If specific documentation is needed, feel free to contribute. + +## YunoHost specific features + +#### Multi-user support + + * Are LDAP and HTTP auth supported? **No** + * Can the app be used by multiple users? **Yes** + +#### Supported architectures + +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/adminer_%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/adminer/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/adminer_%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/adminer/) + +## Limitations + +* Any known limitations. + +## Additional information + +* Other info you would like to add about this app. + +## Links + + * Report a bug: https://github.com/YunoHost-Apps/adminer_ynh/issues + * App website: https://www.adminer.org/ + * Upstream app repository: https://github.com/vrana/adminer/ + * YunoHost website: https://yunohost.org/ + +--- + +## Developer info + +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/adminer_ynh/tree/testing). + +To try the testing branch, please proceed like that. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/adminer_ynh/tree/testing --debug +or +sudo yunohost app upgrade adminer -u https://github.com/YunoHost-Apps/adminer_ynh/tree/testing --debug +``` diff --git a/README_fr.md b/README_fr.md new file mode 100644 index 0000000..f1b5271 --- /dev/null +++ b/README_fr.md @@ -0,0 +1,73 @@ +# Adminer pour YunoHost + +[![Integration level](https://dash.yunohost.org/integration/adminer.svg)](https://dash.yunohost.org/appci/app/adminer) ![](https://ci-apps.yunohost.org/ci/badges/adminer.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/adminer.maintain.svg) +[![Installer Adminer avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=adminer) + +*[Read this readme in english.](./README.md)* + +> *Ce package vous permet d'installer Adminer rapidement et simplement sur un serveur YunoHost. +Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.* + +## Vue d'ensemble +Adminer (anciennement phpMinAdmin, meilleure alternative à phpMyAdmin) est un outil de gestion de base de données (MySQL, MariaDB, PostgreSQL, SQLite, MS SQL, Oracle, SimpleDB, Elasticsearch, MongoDB). Remplacez phpMyAdmin par Adminer et vous obtiendrez une interface utilisateur plus ordonnée, une meilleure prise en charge des fonctionnalités MySQL, des performances plus élevées et plus de sécurité. [Voir comparaison détaillée](https://www.adminer.org/en/phpmyadmin). + +**Version incluse :** 4.7.7 + +## Captures d'écran + +![](https://www.adminer.org/static/screenshots/db.png) + +## Démo + +* [Démo officielle](https://demo.adminer.org/adminer.php?username=) + +## Configuration + +Vous devez connaître le mot de passe root à partir d'ici `/etc/yunohost/mysql` ou le nom d'utilisateur et le mot de passe de l'application dans `setting.yml` sous `/etc/yunohost/apps/appname` pour vous connecter. +Pour les thèmes, téléchargez le fichier adminer.css depuis le site Web principal et placez le fichier dans le dossier de l'application. +Si vous rencontrez des problèmes avec les pilotes, consultez : https://www.adminer.org/en/drivers. + +## Documentation + + * Documentation officielle : Lien vers la documentation officielle de cette application. + * Documentation YunoHost : Si une documentation spécifique est nécessaire, n'hésitez pas à contribuer. + +## Caractéristiques spécifiques YunoHost + +#### Support multi-utilisateur + +* L'authentification LDAP et HTTP est-elle prise en charge ? **Non** +* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui** + +#### Supported architectures + +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/adminer_%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/adminer/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/adminer_%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/adminer/) + +## Limitations + +* Limitations connues. + +## Additional information + +* Autres informations que vous souhaitez ajouter sur cette application. + +## Liens + + * Signaler un bug : https://github.com/YunoHost-Apps/adminer_ynh/issues + * Site de l'application : https://www.adminer.org/ + * Dépôt de l'application principale : https://github.com/vrana/adminer/ + * Site web YunoHost : https://yunohost.org/ + +--- + +## Informations pour les développeurs + +Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/adminer_ynh/tree/testing). + +Pour essayer la branche testing, procédez comme suit. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/adminer_ynh/tree/testing --debug +or +sudo yunohost app upgrade adminer -u https://github.com/YunoHost-Apps/adminer_ynh/tree/testing --debug +``` diff --git a/check_process b/check_process index f065df1..22e930b 100644 --- a/check_process +++ b/check_process @@ -2,25 +2,24 @@ # https://github.com/YunoHost/package_check#syntax-check_process-file # Move this file from check_process.default to check_process when you have filled it. + ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) - path="/path" (PATH) - root_access=0 - is_public=1 (PUBLIC|public=1|private=0) + path="/path" (PATH) + is_public=1 (PUBLIC|public=1|private=0) + ; Checks pkg_linter=1 setup_sub_dir=1 setup_root=1 - setup_nourl=1 + setup_nourl=0 setup_private=1 setup_public=1 upgrade=1 backup_restore=1 multi_instance=1 - # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. - # incorrect_path=1 - port_already_use=0 (66) + port_already_use=0 change_url=1 ;;;; Levels # If the level 5 (Package linter) is forced to 1. Please add justifications here. @@ -28,3 +27,7 @@ ;;; Options Email= anmol@datamol.org Notification=change +;;; Upgrade options + ; commit=CommitHash + name=Name and date of the commit. + manifest_arg=domain=DOMAIN&path=PATH&is_public=1& diff --git a/conf/nginx.conf b/conf/nginx.conf index 8db2ad7..a5c309b 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,5 @@ -location __PATH__ { +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { # Path to source alias __FINALPATH__/ ; @@ -8,7 +9,6 @@ location __PATH__ { rewrite ^ https://$server_name$request_uri? permanent; } -### Example PHP configuration (remove it if not used) index index.php; # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file @@ -17,14 +17,13 @@ location __PATH__ { try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param REMOTE_USER $remote_user; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; } -### End of PHP configuration part # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index ab5dca9..ab1a471 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -33,7 +33,7 @@ group = __USER__ ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. ; Default Value: 511 (-1 on FreeBSD and OpenBSD) diff --git a/manifest.json b/manifest.json index b2439ae..3d4d90a 100644 --- a/manifest.json +++ b/manifest.json @@ -6,9 +6,9 @@ "en": "Database management in a single PHP file", "fr": "Gestionnaire de base de données en un seul fichier PHP" }, - "version": "4.7.6~ynh1", + "version": "4.7.7~ynh1", "url": "https://www.adminer.org/", - "license": "free", + "license": "Apache-2.0", "maintainer": { "name": "Anmol Sharma", "email": "anmol@datamol.org", @@ -20,9 +20,9 @@ "url": "https://github.com/jesuisfol/adminer_ynh" }, "requirements": { - "yunohost": ">= 3.5" + "yunohost": ">= 3.8.1" }, - "multi_instance": "true", + "multi_instance": true, "services": [ "nginx", "php7.0-fpm" @@ -48,15 +48,6 @@ "example": "/adminer", "default": "/adminer" }, - { - "name": "root_access", - "type": "boolean", - "ask": { - "en": "Allow root access(For security its disabled by default)?", - "fr": "Autoriser l'accès racine (pour la sécurité désactivée par défaut)?" - }, - "default": false - }, { "name": "is_public", "type": "boolean", diff --git a/pull_request_template.md b/pull_request_template.md new file mode 100644 index 0000000..6b3b094 --- /dev/null +++ b/pull_request_template.md @@ -0,0 +1,18 @@ +## Problem +- *Description of why you made this PR* + +## Solution +- *And how do you fix that problem* + +## PR Status +- [ ] Code finished. +- [ ] Tested with Package_check. +- [ ] Fix or enhancement tested. +- [ ] Upgrade from last version tested. +- [ ] Can be reviewed and tested. + +## Package_check results +--- +*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results* + +[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/adminer_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/adminer_ynh%20PR-NUM-%20(USERNAME)/) diff --git a/scripts/_common.sh b/scripts/_common.sh index c767d62..78111e4 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,8 +4,10 @@ # COMMON VARIABLES #================================================= +YNH_PHP_VERSION="7.3" + # dependencies used by the app -pkg_dependencies="php-mysql php-sqlite3 php-pgsql" +extra_php_dependencies="php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-sqlite3 php${YNH_PHP_VERSION}-pgsql" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 614e835..8ebe313 100644 --- a/scripts/backup +++ b/scripts/backup @@ -14,48 +14,45 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - true -} -# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 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 +#================================================= +ynh_print_info --message="Declaring files to be backed up..." #================================================= # STANDARD BACKUP STEPS #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_script_progression --message="Backing up the main app directory..." --time --weight=1 ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Backing up nginx web server configuration..." --time --weight=1 ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Backing up php-fpm configuration..." --time --weight=1 -ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last +ynh_script_progression --message="Backup script completed for Adminer. (YunoHost will then actually copy those files to the archive)." --last diff --git a/scripts/change_url b/scripts/change_url index 640edb7..8e46f09 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) @@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --time --weight=1 +ynh_script_progression --message="Backing up Adminer before changing its URL..." --weight=4 # Backup the current version of the app ynh_backup_before_upgrade @@ -67,7 +67,7 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=3 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -98,7 +98,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=3 ynh_systemd_action --service_name=nginx --action=reload @@ -106,4 +106,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --time --last +ynh_script_progression --message="Change of URL completed for Adminer" --last diff --git a/scripts/install b/scripts/install index 085658d..60074b8 100644 --- a/scripts/install +++ b/scripts/install @@ -13,39 +13,22 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - true -} -# 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 is_public=$YNH_APP_ARG_IS_PUBLIC -root_access=$YNH_APP_ARG_ROOT_ACCESS -### If it's a multi-instance app, meaning it can be installed several times independently -### The id of the app as stated in the manifest is available as $YNH_APP_ID -### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...) -### The app instance name is available as $YNH_APP_INSTANCE_NAME -### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample -### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2 -### - ynhexample__{N} for the subsequent installations, with N=3,4, ... -### The app instance name is probably what interests you most, since this is -### guaranteed to be unique. This is a good unique identifier to define installation path, -### db names, ... app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". -### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -55,108 +38,79 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --time --weight=1 +ynh_script_progression --message="Storing installation settings..." --weight=1 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=is_public --value=$is_public -ynh_app_setting_set --app=$app --key=root_access --value=$root_access - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --time --weight=1 - -### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package. -### Those deb packages will be installed as dependencies of this package. -### If you're not using this helper: -### - Remove the section "REMOVE DEPENDENCIES" in the remove script -### - Remove the variable "pkg_dependencies" in _common.sh -### - As well as the section "REINSTALL DEPENDENCIES" in the restore script -### - And the section "UPGRADE DEPENDENCIES" in the upgrade script - -ynh_install_app_dependencies $pkg_dependencies - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --time --weight=1 +ynh_script_progression --message="Setting up source files..." --weight=11 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src + mkdir -p $final_path -if [[ $root_access -eq 1 ]]; then -#copy files from with_root_access folder to the final_path - cp -a ../sources/with_root_access/. $final_path -else -#copy files from root_access_disabled folder to the final_path cp -a ../sources/root_access_disabled/. $final_path -fi #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --time --weight=1 +ynh_script_progression --message="Configuring system user..." --weight=2 # Create a system user ynh_system_user_create --username=$app +#================================================= +# GENERIC FINALIZATION +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= # Set permissions to app files -# Make some file and/or directory writeable by app user (nginx user) -find $final_path -type f | xargs sudo chmod 644 -find $final_path -type d | xargs sudo chmod 755 -chown -R $app: $final_path +chown -R www-data:www-data $final_path +chmod 755 -R $final_path/adminer.php #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --time --weight=1 - -### `ynh_add_nginx_config` will use the file conf/nginx.conf +ynh_script_progression --message="Configuring NGINX web server..." --weight=3 # Create a dedicated nginx config ynh_add_nginx_config - #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." --time --weight=1 - -### `ynh_add_fpm_config` is used to set up a PHP config. -### You can remove it if your app doesn't use PHP. -### `ynh_add_fpm_config` will use the files conf/php-fpm.conf -### If you're not using these lines: -### - You can remove these files in conf/. -### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script -### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script -### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script -### With the reload at the end of the script. -### - And the section "PHP-FPM CONFIGURATION" in the upgrade script +ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 # Create a dedicated php-fpm config -ynh_add_fpm_config +ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." --time --weight=1 +ynh_script_progression --message="Configuring SSOwat..." --weight=1 - -# Make app public if necessary +# Make app public if necessary or protect it if [ $is_public -eq 1 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" + ynh_permission_update --permission "main" --add "visitors" fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Installation of Adminer completed" --last diff --git a/scripts/remove b/scripts/remove index 6284d8e..0cdc7bf 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,25 +12,17 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 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) -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --time --weight=1 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --time --weight=1 +ynh_script_progression --message="Removing Adminer main directory..." --weight=3 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -38,7 +30,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 # Remove the dedicated nginx config ynh_remove_nginx_config @@ -46,7 +38,7 @@ ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing php-fpm configuration..." --time --weight=1 +ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1 # Remove the dedicated php-fpm config ynh_remove_fpm_config @@ -56,7 +48,7 @@ ynh_remove_fpm_config #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user ynh_system_user_delete --username=$app @@ -65,4 +57,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --time --last +ynh_script_progression --message="Removal of Adminer completed" --last diff --git a/scripts/restore b/scripts/restore index 21c43f5..579cde3 100644 --- a/scripts/restore +++ b/scripts/restore @@ -14,28 +14,24 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { - #### Remove this function if there's nothing to clean before calling the remove script. - true -} -# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." --time --weight=1 +ynh_script_progression --message="Loading settings..." --weight=1 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..." --time --weight=1 +ynh_script_progression --message="Validating restoration parameters..." --weight=1 ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" @@ -53,53 +49,45 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --time --weight=1 +ynh_script_progression --message="Restoring Adminer main directory..." --weight=1 ynh_restore_file --origin_path="$final_path" -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 - -# Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies - #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Recreating the dedicated system user..." --weight=2 # Create the dedicated user (if not existing) ynh_system_user_create --username=$app - #================================================= # STANDARD RESTORATION STEPS #================================================= # Restore permissions to app files -# you may need to make some file and/or directory writeable by app (nginx user) -sudo chown -R $app: "$final_path" +chown -R www-data:www-data $final_path +chmod 755 -R $final_path/adminer.php #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= +ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=5 -ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server and PHP-fpm..." --weight=1 -ynh_systemd_action --service_name=php7.0-fpm --action=reload +ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --time --last +ynh_script_progression --message="Restoration completed for Adminer" --last diff --git a/scripts/upgrade b/scripts/upgrade index d7cbefc..d324d8a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,21 +12,21 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME -# Retrieve app settings 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) is_public=$(ynh_app_setting_get --app=$app --key=is_public) root_access=$(ynh_app_setting_get --app=$app --key=root_access) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1 +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # Fix is_public as a boolean value if [ "$is_public" = "Yes" ]; then @@ -46,7 +46,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --time --weight=1 +ynh_script_progression --message="Backing up Adminer before upgrading (may take a while)..." --weight=3 # Backup the current version of the app ynh_backup_before_upgrade @@ -60,26 +60,30 @@ ynh_abort_if_errors #================================================= # CREATE DEDICATED USER #================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 -# Create a system user -ynh_system_user_create $app +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app # Copy source files -rm -rf $final_path +ynh_secure_remove $final_path + mkdir -p $final_path -if [[ $root_access -eq 1 ]]; then -#copy files from with_root_access folder to the final_path -cp -a ../sources/with_root_access/. $final_path -else -#copy files from root_access_disabled folder to the final_path + cp -a ../sources/root_access_disabled/. $final_path -fi -# Files owned by root, www-data can just read -find $final_path -type f | xargs sudo chmod 644 -find $final_path -type d | xargs sudo chmod 755 -chown -R $app: $final_path +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= +# Set permissions to app files +chmod 755 -R $final_path/adminer.php +chown -R www-data:www-data $final_path + +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config @@ -87,27 +91,15 @@ ynh_add_nginx_config #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading php-fpm configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 # Create a dedicated php-fpm config -ynh_add_fpm_config - -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." --time --weight=1 - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" -fi +ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -115,4 +107,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --time --last +ynh_script_progression --message="Upgrade of Adminer completed" --last diff --git a/sources/root_access_disabled/adminer.php b/sources/root_access_disabled/adminer.php index 9950cf2..7475f6c 100644 --- a/sources/root_access_disabled/adminer.php +++ b/sources/root_access_disabled/adminer.php @@ -5,7 +5,7 @@ * @copyright 2007 Jakub Vrana * @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 * @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other) -* @version 4.7.6 +* @version 4.7.7 */error_reporting(6135);$Zc=!preg_match('~^(unsafe_raw)?$~',ini_get("filter.default"));if($Zc||ini_get("filter.default_flags")){foreach(array('_GET','_POST','_COOKIE','_SERVER')as$X){$Li=filter_input_array(constant("INPUT$X"),FILTER_UNSAFE_RAW);if($Li)$$X=$Li;}}if(function_exists("mb_internal_encoding"))mb_internal_encoding("8bit");function connection(){global$h;return$h;}function adminer(){global$b;return$b;}function @@ -87,8 +87,10 @@ queries_redirect($Be,$Qe,$Gg){list($_g,$ji)=queries(null);return query_redirect($_g,$Be,$Qe,$Gg,false,!$Gg,$ji);}function format_time($Ih){return lang(1,max(0,microtime(true)-$Ih));}function +relative_uri(){return +preg_replace('~^[^?]*/([^?]*)~','\1',$_SERVER["REQUEST_URI"]);}function remove_from_uri($Sf=""){return -substr(preg_replace("~(?<=[?&])($Sf".(SID?"":"|".session_name()).")=[^&]*&~",'',"$_SERVER[REQUEST_URI]&"),0,-1);}function +substr(preg_replace("~(?<=[?&])($Sf".(SID?"":"|".session_name()).")=[^&]*&~",'',relative_uri()."&"),0,-1);}function pagination($D,$Nb){return" ".($D==$Nb?$D+1:''.($D+1)."");}function get_file($y,$Vb=false){$Xc=$_FILES[$y];if(!$Xc)return null;foreach($Xc @@ -172,8 +174,8 @@ lang($u,$mf=null){if(is_string($u)){$jg=array_search($u,get_translations("en")); vsprintf($jd,$Fa);}function switch_lang(){global$ca,$re;echo"\n";}if(isset($_POST["lang"])&&verify_token()){cookie("adminer_lang",$_POST["lang"]);$_SESSION["lang"]=$_POST["lang"];$_SESSION["translations"]=array();redirect(remove_from_uri());}$ca="en";if(isset($re[$_COOKIE["adminer_lang"]])){cookie("adminer_lang",$_COOKIE["adminer_lang"]);$ca=$_COOKIE["adminer_lang"];}elseif(isset($re[$_SESSION["lang"]]))$ca=$_SESSION["lang"];else{$va=array();preg_match_all('~([-a-z]+)(;q=([0-9.]+))?~',str_replace("_","-",strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"])),$Ie,PREG_SET_ORDER);foreach($Ie as$A)$va[$A[1]]=(isset($A[3])?$A[3]:1);arsort($va);foreach($va -as$y=>$zg){if(isset($re[$y])){$ca=$y;break;}$y=preg_replace('~-.*~','',$y);if(!isset($va[$y])&&isset($re[$y])){$ca=$y;break;}}}$zi=$_SESSION["translations"];if($_SESSION["translations_version"]!=824099529){$zi=array();$_SESSION["translations_version"]=824099529;}function -get_translations($qe){switch($qe){case"en":$g="A9Dy@s:G(ff :Sa2\"1..L'Im#s,KOP#I@%9i4o2ύ,9%Pb2ar\n2NC(r41C`(:Eb9Ai:&㙔yFY\r\n 8ZS=\$A`=܌0\ndF n:Zΰ)QmwOmfpQqaį#qw7SX3o\n>ZMzis;̒_:#|@46:\r-z|(j*0:-h/̸8)+r^1/Лη,ZӈKX9,p:>#(6qCI|Ȣ,(y , %b{ʢ9B)B+1>P\r62LP2\r\\*Jb=m1jHO\$4 jFoF4 #0z\r8a^\\N-|єp2\r:x7<ص^0#2jk6@ΎA&2u\n1lĠ+s%*2Ղs!%C1N%\nl7\"*R k<4L5@FPd;DBJ:4dpӱ9AH\n YaRH@(!z⺖!#I/۹0@+üzx5LsߥAQ,h@:VDrA-kQt'z[Wa!\naԍA052tA\$, )ZFÌ0?؍&S>==:?A5\n<)@[Lcԃb\rp*)+²?ZIPh\0 e+{==L3~8 \nnj &;\0F\n-G{V~ٔK҉. S:-AHܘo 8PT@-I˨NlL)\\Y_̪2dp!mm: >a [uߓ\"EH+6ԼvL ړU,\"tq=ŵw:&Dr;VL^#\rV p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