1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mediawiki_ynh.git synced 2024-09-03 19:46:05 +02:00

Merge pull request #55 from YunoHost-Apps/testing

apply last example_ynh
This commit is contained in:
yalh76 2022-04-14 08:10:09 +02:00 committed by GitHub
commit f55b464b48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 72 additions and 139 deletions

View file

@ -15,9 +15,10 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview ## Overview
Wiki package originally for use on Wikipedia MediaWiki is a free and open-source wiki software package written in PHP. It serves as the platform for Wikipedia and the other Wikimedia projects, used by hundreds of millions of people each month. MediaWiki is localised in over 350 languages and its reliability and robust feature set have earned it a large and vibrant community of third-party users and developers.
**Shipped version:** 1.37.1~ynh1
**Shipped version:** 1.37.2~ynh1
**Demo:** https://www.wikipedia.org/, https://www.mediawiki.org/wiki/Project:Sandbox **Demo:** https://www.wikipedia.org/, https://www.mediawiki.org/wiki/Project:Sandbox
@ -44,15 +45,6 @@ Some of the extensions are marked as "disabled and unused" because they are not
* Is HTTP auth supported?: **no** * Is HTTP auth supported?: **no**
* Can the app be used by multiple users?: **yes** * Can the app be used by multiple users?: **yes**
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mediawiki.svg)](https://ci-apps.yunohost.org/ci/apps/mediawiki/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mediawiki.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mediawiki/)
### How to configure this app:
* Through the admin panel: Log in then click on `Preferences`
## Documentation and resources ## Documentation and resources
* Official app website: https://www.mediawiki.org * Official app website: https://www.mediawiki.org

View file

@ -11,9 +11,10 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
## Vue d'ensemble ## Vue d'ensemble
Wiki développé à lorigine pour Wikipédia MediaWiki est un progiciel wiki gratuit et open-source écrit en PHP. Il sert de plate-forme pour Wikipedia et les autres projets Wikimedia, utilisés par des centaines de millions de personnes chaque mois. MediaWiki est localisé dans plus de 350 langues et sa fiabilité et son ensemble de fonctionnalités robustes lui ont valu une communauté importante et dynamique d'utilisateurs et de développeurs tiers.
**Version incluse :** 1.37.1~ynh1
**Version incluse :** 1.37.2~ynh1
**Démo :** https://www.wikipedia.org/, https://www.mediawiki.org/wiki/Project:Sandbox **Démo :** https://www.wikipedia.org/, https://www.mediawiki.org/wiki/Project:Sandbox
@ -40,16 +41,6 @@ Certaines extensions sont marquées comme "désactivées et inutilisées" car el
* L'authentification HTTP est-elle prise en charge ? **Non** * L'authentification HTTP est-elle prise en charge ? **Non**
* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui** * L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui**
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mediawiki.svg)](https://ci-apps.yunohost.org/ci/apps/mediawiki/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mediawiki.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mediawiki/)
### Comment configurer cette application :
* Via le panneau d'administration : Connectez-vous puis cliquez sur `Préférences`
## Documentations et ressources ## Documentations et ressources
* Site officiel de l'app : https://www.mediawiki.org * Site officiel de l'app : https://www.mediawiki.org

View file

@ -2,12 +2,11 @@
; Manifest ; Manifest
domain="domain.tld" domain="domain.tld"
path="/path" path="/path"
admin="john"
is_public=1 is_public=1
language="fr" language="fr"
admin="john"
password="jztI4OHHr2RfhrqK5wgX" password="jztI4OHHr2RfhrqK5wgX"
wiki_name="MyYunoWiki" wiki_name="MyYunoWiki"
port="666"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=1
@ -18,7 +17,7 @@
upgrade=1 upgrade=1
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
incorrect_path=1 port_already_use=0
change_url=1 change_url=1
;;; Options ;;; Options
Email= Email=

View file

@ -26,7 +26,7 @@ $wgSitename = "__WIKI_NAME__";
## For more information on customizing the URLs ## For more information on customizing the URLs
## (like /w/index.php/Page_title to /wiki/Page_title) please see: ## (like /w/index.php/Page_title to /wiki/Page_title) please see:
## https://www.mediawiki.org/wiki/Manual:Short_URL ## https://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "__PATH__"; $wgScriptPath = "__MEDIAWIKI_PATH__";
## The protocol and server name to use in fully-qualified URLs ## The protocol and server name to use in fully-qualified URLs
$wgServer = "https://__DOMAIN__"; $wgServer = "https://__DOMAIN__";

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://releases.wikimedia.org/mediawiki/1.37/mediawiki-1.37.1.tar.gz SOURCE_URL=https://releases.wikimedia.org/mediawiki/1.37/mediawiki-1.37.2.tar.gz
SOURCE_SUM=53436e92dc30adb14b6797d8139d20696a5461525f38a375c83e435cf042e2e7 SOURCE_SUM=583f074bcafcec17da50142a56f5bbfde5c3366977d61d912d7e56fcca3bda1b
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/LDAPAuthentication2-REL1_35-dabdf22.tar.gz SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/LDAPAuthentication2-REL1_38-502759b.tar.gz
SOURCE_SUM=e53b1bd791b288e0531bdec5ca58386b7d7287899f4677073bf5c93a2b778b3f SOURCE_SUM=2212a2baa6b070d08fe36b8f3cf236a76a7aa58cdc5953c65a9a66d16cee3dc6
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=false SOURCE_IN_SUBDIR=false

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/LDAPAuthorization-REL1_37-ba9cdb5.tar.gz SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/LDAPAuthorization-REL1_38-068c368.tar.gz
SOURCE_SUM=b5134407376f33e0c43c7c85fb965757a6ffd83d13280ff26e84d1ced4747bb8 SOURCE_SUM=402949ab8a5e4d636d7f510194909c38199b189385c6bce794703d0cb8f8272d
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=false SOURCE_IN_SUBDIR=false

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/LDAPGroups-REL1_37-f622040.tar.gz SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/LDAPGroups-REL1_38-f4edda5.tar.gz
SOURCE_SUM=e198ac995b383d461086c848fb6adf1064b593647fd61199daa22af56b60df47 SOURCE_SUM=80101ec40e3dad5bc206f95baf5391a07e0957bac399037500602c84fbf5f070
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=false SOURCE_IN_SUBDIR=false

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/LDAPProvider-REL1_35-a801161.tar.gz SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/LDAPProvider-REL1_38-78f283a.tar.gz
SOURCE_SUM=e0ef72d68ba6c89123212bdd06a3739b4f733d3b45e5caa3a0a295a8225a15ea SOURCE_SUM=a0d72d6da668c014b665f8f2263d0008a5abf636228888ddf6d6b4a5ad0f9031
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=false SOURCE_IN_SUBDIR=false

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/LDAPUserInfo-REL1_37-a4b1bcf.tar.gz SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/LDAPUserInfo-REL1_38-f4255f4.tar.gz
SOURCE_SUM=0e236e5d0498079c722e1bcff398b7e46ef5a165ebe0f201ebbc6195d066746e SOURCE_SUM=802e13ce3e8da41191f6b7969ca7120cf044ff266b76ab877588be34cb7e97c4
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=false SOURCE_IN_SUBDIR=false

View file

@ -10,7 +10,6 @@ location __PATH__/ {
index index.php; index index.php;
try_files $uri $uri/ @rewrite___NAME__; try_files $uri $uri/ @rewrite___NAME__;
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;

View file

@ -229,7 +229,7 @@ pm.max_spare_servers = 3
; last request memory: 0 ; last request memory: 0
; ;
; Note: There is a real-time FPM status monitoring sample web page available ; Note: There is a real-time FPM status monitoring sample web page available
; It's available in: /usr/share/php/__PHPVERSION__/fpm/status.html ; It's available in: /usr/share/php/7.0/fpm/status.html
; ;
; Note: The value must start with a leading slash (/). The value can be ; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use the .php extension or it ; anything, but it may not be a good idea to use the .php extension or it

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/PluggableAuth-REL1_37-5757eca.tar.gz SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/PluggableAuth-REL1_38-b537019.tar.gz
SOURCE_SUM=d81edf9033db3a98bc51384b43f6926dfda78b456844db31d800f6d5884511e7 SOURCE_SUM=b1919f93578af63135efb13d7b04b6d028e8bd6a254e669b873ca978a6ad8c53
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=false SOURCE_IN_SUBDIR=false

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
MediaWiki is a free and open-source wiki software package written in PHP. It serves as the platform for Wikipedia and the other Wikimedia projects, used by hundreds of millions of people each month. MediaWiki is localised in over 350 languages and its reliability and robust feature set have earned it a large and vibrant community of third-party users and developers.

1
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1 @@
MediaWiki est un progiciel wiki gratuit et open-source écrit en PHP. Il sert de plate-forme pour Wikipedia et les autres projets Wikimedia, utilisés par des centaines de millions de personnes chaque mois. MediaWiki est localisé dans plus de 350 langues et sa fiabilité et son ensemble de fonctionnalités robustes lui ont valu une communauté importante et dynamique d'utilisateurs et de développeurs tiers.

View file

@ -14,12 +14,3 @@ Some of the extensions are marked as "disabled and unused" because they are not
* Is LDAP supported?: **yes** * Is LDAP supported?: **yes**
* Is HTTP auth supported?: **no** * Is HTTP auth supported?: **no**
* Can the app be used by multiple users?: **yes** * Can the app be used by multiple users?: **yes**
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mediawiki.svg)](https://ci-apps.yunohost.org/ci/apps/mediawiki/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mediawiki.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mediawiki/)
### How to configure this app:
* Through the admin panel: Log in then click on `Preferences`

View file

@ -14,13 +14,3 @@ Certaines extensions sont marquées comme "désactivées et inutilisées" car el
* L'authentification LDAP est-elle prise en charge ? **Oui** * L'authentification LDAP est-elle prise en charge ? **Oui**
* L'authentification HTTP est-elle prise en charge ? **Non** * L'authentification HTTP est-elle prise en charge ? **Non**
* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui** * L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui**
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mediawiki.svg)](https://ci-apps.yunohost.org/ci/apps/mediawiki/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mediawiki.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mediawiki/)
### Comment configurer cette application :
* Via le panneau d'administration : Connectez-vous puis cliquez sur `Préférences`

View file

@ -6,7 +6,7 @@
"en": "Wiki package originally for use on Wikipedia", "en": "Wiki package originally for use on Wikipedia",
"fr": "Wiki développé à lorigine pour Wikipédia" "fr": "Wiki développé à lorigine pour Wikipédia"
}, },
"version": "1.37.1~ynh1", "version": "1.37.2~ynh1",
"url": "https://www.mediawiki.org", "url": "https://www.mediawiki.org",
"upstream": { "upstream": {
"license": "GPL-2.0-or-later", "license": "GPL-2.0-or-later",
@ -31,7 +31,7 @@
"mysql" "mysql"
], ],
"arguments": { "arguments": {
"install" : [ "install": [
{ {
"name": "domain", "name": "domain",
"type": "domain" "type": "domain"
@ -42,10 +42,6 @@
"example": "/wiki", "example": "/wiki",
"default": "/wiki" "default": "/wiki"
}, },
{
"name": "admin",
"type": "user"
},
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
@ -65,6 +61,10 @@
"choices": ["fr", "en"], "choices": ["fr", "en"],
"default": "fr" "default": "fr"
}, },
{
"name": "admin",
"type": "user"
},
{ {
"name": "password", "name": "password",
"type": "password", "type": "password",

View file

@ -13,9 +13,6 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
@ -25,14 +22,16 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
admin_password=$YNH_APP_ARG_PASSWORD
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE language=$YNH_APP_ARG_LANGUAGE
admin=$YNH_APP_ARG_ADMIN
admin_password=$YNH_APP_ARG_PASSWORD
wiki_name=$YNH_APP_ARG_WIKI_NAME wiki_name=$YNH_APP_ARG_WIKI_NAME
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
secret=$(ynh_string_random --length=64)
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
@ -51,10 +50,11 @@ 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=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=admin_password --value=$admin_password ynh_app_setting_set --app=$app --key=admin_password --value=$admin_password
ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=wiki_name --value=$wiki_name ynh_app_setting_set --app=$app --key=wiki_name --value=$wiki_name
ynh_app_setting_set --app=$app --key=secret --value=$secret
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -71,7 +71,7 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Configuring system user..." --weight=2 ynh_script_progression --message="Configuring system user..." --weight=2
# Create a system user # Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# CREATE A MYSQL DATABASE # CREATE A MYSQL DATABASE
@ -145,32 +145,21 @@ fi
"$wiki_name" "$admin" "$wiki_name" "$admin"
#================================================= #=================================================
# REPLACE CONFIGURATION SETTINGS # ADD A CONFIGURATION
#================================================= #=================================================
cp ../conf/LocalSettings.php "$final_path/LocalSettings.php" ynh_script_progression --message="Adding a configuration file..."
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__WIKI_NAME__" --replace_string="$wiki_name"
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__ADMIN__" --replace_string="$admin"
if [ "$path_url" = "/" ]; then if [ "$path_url" = "/" ]; then
# MediaWiki expects a "" for the root URL which is typically assumed to be # MediaWiki expects a "" for the root URL which is typically assumed to be
# "/" by other application packages. Therefore, we assume end-users will do # "/" by other application packages. Therefore, we assume end-users will do
# this as well and make sure to ensure an "" in all cases where "/" is # this as well and make sure to ensure an "" in all cases where "/" is
# specified # specified
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__PATH__" --replace_string="" mediawiki_path=""
else else
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__PATH__" --replace_string="$path_url" mediawiki_path="$path_url"
fi fi
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__DOMAIN__" --replace_string="$domain" ynh_add_config --template="../conf/LocalSettings.php" --destination="$final_path/LocalSettings.php"
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__DB_NAME__" --replace_string="$db_name"
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__DB_USER__" --replace_string="$db_name"
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__DB_PWD__" --replace_string="$db_pwd"
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__LANGUAGE__" --replace_string="$language"
secret=$(ynh_string_random 64)
ynh_app_setting_set $app secret "$secret"
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__SECRET__" --replace_string="$secret"
"php$phpversion" "$final_path/maintenance/update.php" "php$phpversion" "$final_path/maintenance/update.php"

View file

@ -32,14 +32,6 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=4
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=10
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
@ -64,6 +56,14 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
# Remove the dedicated PHP-FPM config # Remove the dedicated PHP-FPM config
ynh_remove_fpm_config ynh_remove_fpm_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=10
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -39,14 +39,15 @@ fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1 ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#================================================= #=================================================
# RESTORE THE NGINX CONFIGURATION # RESTORE THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring the NGINX configuration..." ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
@ -56,7 +57,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_script_progression --message="Recreating the dedicated system user..." --weight=2 ynh_script_progression --message="Recreating the dedicated system user..." --weight=2
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR

View file

@ -18,13 +18,15 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
language=$(ynh_app_setting_get --app=$app --key=language)
admin=$(ynh_app_setting_get --app=$app --key=admin) admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
wiki_name=$(ynh_app_setting_get --app=$app --key=wiki_name) wiki_name=$(ynh_app_setting_get --app=$app --key=wiki_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
secret=$(ynh_app_setting_get --app=$app --key=secret)
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
@ -32,6 +34,7 @@ fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
@ -80,6 +83,14 @@ if [ -z "$fpm_usage" ]; then
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
fi fi
# Removed in dec. 2020
ldap_user=$(ynh_app_setting_get --app=$app --key=ldap_user)
if [[ -n "$ldap_user" ]]; then
yunohost user delete "$ldap_user"
ynh_app_setting_delete --app=$app --key=ldap_user
ynh_app_setting_delete --app=$app --key=ldap_password
fi
# Cleaning legacy permissions # Cleaning legacy permissions
if ynh_legacy_permissions_exists; then if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all ynh_legacy_permissions_delete_all
@ -87,23 +98,13 @@ if ynh_legacy_permissions_exists; then
ynh_app_setting_delete --app=$app --key=is_public ynh_app_setting_delete --app=$app --key=is_public
fi fi
if ! ynh_permission_exists --permission="admin"; then
# Create the required permissions
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
fi
# Create a permission if needed
if ! ynh_permission_exists --permission="api"; then
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true"
fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -158,14 +159,6 @@ ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_
#================================================= #=================================================
# REMOVE LEGACY LDAP USER # REMOVE LEGACY LDAP USER
#================================================= #=================================================
# Removed in dec. 2020
ldap_user=$(ynh_app_setting_get --app=$app --key=ldap_user)
if [[ -n "$ldap_user" ]]; then
yunohost user delete "$ldap_user"
ynh_app_setting_delete --app=$app --key=ldap_user
ynh_app_setting_delete --app=$app --key=ldap_password
fi
#================================================= #=================================================
# STORE THE CONFIG FILE CHECKSUM # STORE THE CONFIG FILE CHECKSUM
#================================================= #=================================================
@ -176,31 +169,17 @@ ynh_backup_if_checksum_is_different --file="$final_path/LocalSettings.php"
#================================================= #=================================================
ynh_script_progression --message="Upgrading application files..." --weight=4 ynh_script_progression --message="Upgrading application files..." --weight=4
rm "$final_path/LocalSettings.php"
cp ../conf/LocalSettings.php "$final_path/LocalSettings.php"
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__WIKI_NAME__" --replace_string="$wiki_name"
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__ADMIN__" --replace_string="$admin"
if [ "$path_url" = "/" ]; then if [ "$path_url" = "/" ]; then
# MediaWiki expects a "" for the root URL which is typically assumed to be # MediaWiki expects a "" for the root URL which is typically assumed to be
# "/" by other application packages. Therefore, we assume end-users will do # "/" by other application packages. Therefore, we assume end-users will do
# this as well and make sure to ensure an "" in all cases where "/" is # this as well and make sure to ensure an "" in all cases where "/" is
# specified # specified
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__PATH__" --replace_string="" mediawiki_path=""
else else
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__PATH__" --replace_string="$path_url" mediawiki_path="$path_url"
fi fi
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__DOMAIN__" --replace_string="$domain" ynh_add_config --template="../conf/LocalSettings.php" --destination="$final_path/LocalSettings.php"
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__DB_NAME__" --replace_string="$db_name"
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__DB_USER__" --replace_string="$db_name"
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__DB_PWD__" --replace_string="$db_pwd"
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__LANGUAGE__" --replace_string="$language"
secret=$(ynh_string_random 64)
ynh_app_setting_set $app secret "$secret"
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__SECRET__" --replace_string="$secret"
# Check for admin password being too short for the new mediawiki requirements # Check for admin password being too short for the new mediawiki requirements
password_length=$(ynh_app_setting_get --app=$app --key=admin_password | awk '{print length}') password_length=$(ynh_app_setting_get --app=$app --key=admin_password | awk '{print length}')