diff --git a/README.md b/README.md index b2e32d8..06ce8d0 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,44 @@ + + # Adminer for 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) -[![Install Adminer with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=adminer) +[![Install Adminer with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=adminer) *[Lire ce readme en français.](./README_fr.md)* -> *This package allows you to install Adminer quickly and simply on a YunoHost server. +> *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.* ## Overview -Adminer (formerly phpMinAdmin better alternate to phpMyAdmin) is a full-featured database management tool (MySQL, MariaDB, PostgreSQL, SQLite, MS SQL, Oracle, SimpleDB, Elasticsearch, MongoDB). 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). -**Shipped version:** 4.8.0 +Database management in a single PHP file + +**Shipped version:** 4.8.1~ynh1 + +**Demo:** https://demo.adminer.org/adminer.php?username= ## Screenshots -![](https://www.adminer.org/static/screenshots/db.png) +![](./doc/screenshots/screenshot.png) -## Demo - -* [Official demo](https://demo.adminer.org/adminer.php?username=) +## Disclaimers / important information ## 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 replace the file in the app folder. +For themes download the `adminer.css` from the main website and replace the file in the app folder. If you have problems with drivers see here: https://www.adminer.org/en/drivers. -## YunoHost specific features +## Documentation and resources -#### 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/) - -## 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/ - ---- +* Official app website: https://www.adminer.org/ +* Upstream app code repository: https://github.com/vrana/adminer/ +* YunoHost documentation for this app: https://yunohost.org/app_adminer +* Report a bug: https://github.com/YunoHost-Apps/adminer_ynh/issues ## Developer info @@ -58,3 +50,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/adminer_ynh/tree/test or sudo yunohost app upgrade adminer -u https://github.com/YunoHost-Apps/adminer_ynh/tree/testing --debug ``` + +**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/README_fr.md b/README_fr.md index 5ffa594..6466d03 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,65 +1,40 @@ # 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) +[![Niveau d'intégration](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.svg)](https://install-app.yunohost.org/?app=adminer) -*[Read this readme in english.](./README.md)* +*[Read this readme in english.](./README.md)* +*[Lire ce readme en français.](./README_fr.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.* +> *Ce package vous permet d'installer Adminer 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.* ## 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.8.0 +Gestionnaire de base de données en un seul fichier PHP + +**Version incluse :** 4.8.1~ynh1 + +**Démo :** https://demo.adminer.org/adminer.php?username= ## Captures d'écran -![](https://www.adminer.org/static/screenshots/db.png) +![](./doc/screenshots/screenshot.png) -## Démo - -* [Démo officielle](https://demo.adminer.org/adminer.php?username=) +## Avertissements / informations importantes ## 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. +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 +## Documentations et ressources - * 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/ - ---- +* Site officiel de l'app : https://www.adminer.org/ +* Dépôt de code officiel de l'app : https://github.com/vrana/adminer/ +* Documentation YunoHost pour cette app : https://yunohost.org/app_adminer +* Signaler un bug : https://github.com/YunoHost-Apps/adminer_ynh/issues ## Informations pour les développeurs @@ -68,6 +43,8 @@ Merci de faire vos pull request sur la [branche testing](https://github.com/Yuno Pour essayer la branche testing, procédez comme suit. ``` sudo yunohost app install https://github.com/YunoHost-Apps/adminer_ynh/tree/testing --debug -or +ou sudo yunohost app upgrade adminer -u https://github.com/YunoHost-Apps/adminer_ynh/tree/testing --debug ``` + +**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/check_process b/check_process index 44c97a8..26f0c64 100644 --- a/check_process +++ b/check_process @@ -1,13 +1,9 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - ;; Test complet ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) + domain="domain.tld" + path="/path" root_access=0 - is_public=1 (PUBLIC|public=1|private=0) - + is_public=1 ; Checks pkg_linter=1 setup_sub_dir=1 @@ -18,7 +14,6 @@ upgrade=1 backup_restore=1 multi_instance=1 - port_already_use=0 change_url=1 ;;; Options Email= anmol@datamol.org diff --git a/doc/.DS_Store b/doc/.DS_Store new file mode 100644 index 0000000..c90376b Binary files /dev/null and b/doc/.DS_Store differ diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..51982ab --- /dev/null +++ b/doc/DISCLAIMER.md @@ -0,0 +1,5 @@ +## 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 replace the file in the app folder. +If you have problems with drivers see here: https://www.adminer.org/en/drivers. diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md new file mode 100644 index 0000000..010d328 --- /dev/null +++ b/doc/DISCLAIMER_fr.md @@ -0,0 +1,5 @@ +## 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. diff --git a/doc/screenshots/screenshot.png b/doc/screenshots/screenshot.png new file mode 100644 index 0000000..09c3309 Binary files /dev/null and b/doc/screenshots/screenshot.png differ diff --git a/manifest.json b/manifest.json index 9e8a926..46b48eb 100644 --- a/manifest.json +++ b/manifest.json @@ -7,8 +7,14 @@ "fr": "Gestionnaire de base de données en un seul fichier PHP" }, - "version": "4.8.0~ynh1", + "version": "4.8.1~ynh1", "url": "https://www.adminer.org/", + "upstream": { + "license": "Apache-2.0", + "website": "https://www.adminer.org/", + "demo": "https://demo.adminer.org/adminer.php?username=", + "code": "https://github.com/vrana/adminer/" + }, "license": "Apache-2.0", "maintainer": { "name": "Anmol Sharma", @@ -21,7 +27,7 @@ "url": "https://github.com/jesuisfol/adminer_ynh" }, "requirements": { - "yunohost": ">= 4.1.7" + "yunohost": ">= 4.2.4" }, "multi_instance": true, "services": [ diff --git a/scripts/install b/scripts/install index 0c7f432..667f176 100644 --- a/scripts/install +++ b/scripts/install @@ -45,6 +45,14 @@ 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=root_access --value=$root_access +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." --weight=2 + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -63,23 +71,10 @@ if [[ $root_access -eq 1 ]]; then cp -a ../sources/root_access_disabled/. $final_path fi -#================================================= -# CREATE DEDICATED USER -#================================================= -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 -chown -R www-data:www-data $final_path -chmod 755 -R $final_path/adminer.php +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" +chmod 755 $final_path/adminer.php #================================================= # NGINX CONFIGURATION diff --git a/scripts/restore b/scripts/restore index 579cde3..16ba223 100644 --- a/scripts/restore +++ b/scripts/restore @@ -46,6 +46,14 @@ test ! -d $final_path \ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# RECREATE THE DEDICATED USER +#================================================= +ynh_script_progression --message="Recreating the dedicated system user..." --weight=2 + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -53,21 +61,10 @@ ynh_script_progression --message="Restoring Adminer main directory..." --weight= ynh_restore_file --origin_path="$final_path" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -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 -chown -R www-data:www-data $final_path -chmod 755 -R $final_path/adminer.php +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" +chmod 755 $final_path/adminer.php #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 53faa4c..c3adec7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,6 +22,26 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) root_access=$(ynh_app_setting_get --app=$app --key=root_access) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#================================================= +# CHECK VERSION +#================================================= + +upgrade_type=$(ynh_check_app_version_changed) + +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +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 +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 + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -40,48 +60,38 @@ if ynh_legacy_permissions_exists; then ynh_app_setting_delete --app=$app --key=is_public fi -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -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 -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 - #================================================= # CREATE DEDICATED USER #================================================= ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" -# Copy source files -ynh_secure_remove $final_path +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= -mkdir -p $final_path +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + # Copy source files + ynh_secure_remove $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 + 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 fi -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions to app files -chmod 755 -R $final_path/adminer.php -chown -R www-data:www-data $final_path +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" +chmod 755 $final_path/adminer.php #================================================= # NGINX CONFIGURATION diff --git a/sources/root_access_disabled/adminer.php b/sources/root_access_disabled/adminer.php index b9ce4d0..762aaaf 100644 --- a/sources/root_access_disabled/adminer.php +++ b/sources/root_access_disabled/adminer.php @@ -5,56 +5,56 @@ * @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.8.0 +* @version 4.8.1 */function -adminer_errors($Ac,$Cc){return!!preg_match('~^(Trying to access array offset on value of type null|Undefined array key)~',$Cc);}error_reporting(6135);set_error_handler('adminer_errors',2);$Yc=!preg_match('~^(unsafe_raw)?$~',ini_get("filter.default"));if($Yc||ini_get("filter.default_flags")){foreach(array('_GET','_POST','_COOKIE','_SERVER')as$X){$Hi=filter_input_array(constant("INPUT$X"),FILTER_UNSAFE_RAW);if($Hi)$$X=$Hi;}}if(function_exists("mb_internal_encoding"))mb_internal_encoding("8bit");function +adminer_errors($Cc,$Ec){return!!preg_match('~^(Trying to access array offset on value of type null|Undefined array key)~',$Ec);}error_reporting(6135);set_error_handler('adminer_errors',E_WARNING);$ad=!preg_match('~^(unsafe_raw)?$~',ini_get("filter.default"));if($ad||ini_get("filter.default_flags")){foreach(array('_GET','_POST','_COOKIE','_SERVER')as$X){$Ii=filter_input_array(constant("INPUT$X"),FILTER_UNSAFE_RAW);if($Ii)$$X=$Ii;}}if(function_exists("mb_internal_encoding"))mb_internal_encoding("8bit");function connection(){global$g;return$g;}function adminer(){global$b;return$b;}function version(){global$ia;return$ia;}function -idf_unescape($v){$pe=substr($v,-1);return -str_replace($pe.$pe,$pe,substr($v,1,-1));}function +idf_unescape($v){if(!preg_match('~^[`\'"]~',$v))return$v;$qe=substr($v,-1);return +str_replace($qe.$qe,$qe,substr($v,1,-1));}function escape_string($X){return substr(q($X),1,-1);}function number($X){return preg_replace('~[^0-9]+~','',$X);}function number_type(){return'((?$W){unset($sg[$z][$ge]);if(is_array($W)){$sg[$z][stripslashes($ge)]=$W;$sg[]=&$sg[$z][stripslashes($ge)];}else$sg[$z][stripslashes($ge)]=($Yc?$W:stripslashes($W));}}}}function -bracket_escape($v,$Na=false){static$ti=array(':'=>':1',']'=>':2','['=>':3','"'=>':4');return -strtr($v,($Na?array_flip($ti):$ti));}function -min_version($Yi,$Ce="",$h=null){global$g;if(!$h)$h=$g;$mh=$h->server_info;if($Ce&&preg_match('~([\d.]+)-MariaDB~',$mh,$C)){$mh=$C[1];$Yi=$Ce;}return(version_compare($mh,$Yi)>=0);}function +remove_slashes($tg,$ad=false){if(function_exists("get_magic_quotes_gpc")&&get_magic_quotes_gpc()){while(list($z,$X)=each($tg)){foreach($X +as$he=>$W){unset($tg[$z][$he]);if(is_array($W)){$tg[$z][stripslashes($he)]=$W;$tg[]=&$tg[$z][stripslashes($he)];}else$tg[$z][stripslashes($he)]=($ad?$W:stripslashes($W));}}}}function +bracket_escape($v,$Na=false){static$ui=array(':'=>':1',']'=>':2','['=>':3','"'=>':4');return +strtr($v,($Na?array_flip($ui):$ui));}function +min_version($Zi,$De="",$h=null){global$g;if(!$h)$h=$g;$nh=$h->server_info;if($De&&preg_match('~([\d.]+)-MariaDB~',$nh,$C)){$nh=$C[1];$Zi=$De;}return(version_compare($nh,$Zi)>=0);}function charset($g){return(min_version("5.5.3",0,$g)?"utf8mb4":"utf8");}function -script($xh,$si="\n"){return"$xh$si";}function -script_src($Mi){return"\n";}function +script($yh,$ti="\n"){return"$yh$ti";}function +script_src($Ni){return"\n";}function nonce(){return' nonce="'.get_nonce().'"';}function target_blank(){return' target="_blank" rel="noreferrer noopener"';}function h($P){return str_replace("\0","�",htmlspecialchars($P,ENT_QUOTES,'utf-8'));}function nl_br($P){return str_replace("\n","
",$P);}function -checkbox($D,$Y,$db,$le="",$tf="",$hb="",$me=""){$I="".($tf?script("qsl('input').onclick = function () { $tf };",""):"");return($le!=""||$hb?"$I".h($le)."":$I);}function -optionlist($zf,$fh=null,$Qi=false){$I="";foreach($zf -as$ge=>$W){$_f=array($ge=>$W);if(is_array($W)){$I.='';$_f=$W;}foreach($_f -as$z=>$X)$I.=''.h($X);if(is_array($W))$I.='';}return$I;}function -html_select($D,$zf,$Y="",$sf=true,$me=""){if($sf)return"".(is_string($sf)?script("qsl('select').onchange = function () { $sf };",""):"");$I="";foreach($zf +checkbox($D,$Y,$db,$me="",$uf="",$hb="",$ne=""){$I="".($uf?script("qsl('input').onclick = function () { $uf };",""):"");return($me!=""||$hb?"$I".h($me)."":$I);}function +optionlist($_f,$gh=null,$Ri=false){$I="";foreach($_f +as$he=>$W){$Af=array($he=>$W);if(is_array($W)){$I.='';$Af=$W;}foreach($Af +as$z=>$X)$I.=''.h($X);if(is_array($W))$I.='';}return$I;}function +html_select($D,$_f,$Y="",$tf=true,$ne=""){if($tf)return"".(is_string($tf)?script("qsl('select').onchange = function () { $tf };",""):"");$I="";foreach($_f as$z=>$X)$I.="";return$I;}function -select_input($Ia,$zf,$Y="",$sf="",$eg=""){$Xh=($zf?"select":"input");return"<$Xh$Ia".($zf?">