1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/dokuwiki_ynh.git synced 2024-09-03 18:26:20 +02:00

Merge pull request #92 from Gofannon/igor

This commit is contained in:
tituspijean 2022-09-14 18:19:18 +02:00 committed by GitHub
commit 686356d943
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 181 additions and 111 deletions

View file

@ -10,6 +10,26 @@
------------ ------------
# [2022.07.31a~ynh1] - 2022-09-XX
## Added
- New DokuWiki version `2022-07-31a "Igor"` with **Hotfix 2022-07-31a**
- New automated tests for "check_process" CI
## Changed
- Use PHP8.1 as default (PHP7.4 is bulleyes will be EOL "28 Nov 2022" so bump the version)
- Change method to "automatic upgrade" of plugins
- Cleanning 'admin permission' handling
- redo how php is managed: ynh_add_fpm_config + php config files
- Sync with reference package 'example_ynh'
## Removed
- automatic installation of plugin "logautherror" (not compatible)
- support for YunoHost below 11 (no time to test against older versions)
# [2020-07-29~ynh4] - 2021-01-19 # [2020-07-29~ynh4] - 2021-01-19
### Added ### Added

View file

@ -5,7 +5,7 @@ It shall NOT be edited by hand.
# Dokuwiki for YunoHost # Dokuwiki for YunoHost
[![Integration level](https://dash.yunohost.org/integration/dokuwiki.svg)](https://dash.yunohost.org/appci/app/dokuwiki) ![](https://ci-apps.yunohost.org/ci/badges/dokuwiki.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/dokuwiki.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/dokuwiki.svg)](https://dash.yunohost.org/appci/app/dokuwiki) ![Working status](https://ci-apps.yunohost.org/ci/badges/dokuwiki.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/dokuwiki.maintain.svg)
[![Install Dokuwiki with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=dokuwiki) [![Install Dokuwiki with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=dokuwiki)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
@ -31,7 +31,7 @@ DokuWiki is a simple to use and highly versatile Open Source wiki software that
## Screenshots ## Screenshots
![](./doc/screenshots/DokuWiki_Screenshot.png) ![Screenshot of Dokuwiki](./doc/screenshots/DokuWiki_Screenshot.png)
## Disclaimers / important information ## Disclaimers / important information
@ -41,21 +41,22 @@ DokuWiki is a simple to use and highly versatile Open Source wiki software that
## Documentation and resources ## Documentation and resources
* Official app website: https://www.dokuwiki.org * Official app website: <https://www.dokuwiki.org>
* Official admin documentation: https://www.dokuwiki.org/manual * Official admin documentation: <https://www.dokuwiki.org/manual>
* Upstream app code repository: https://github.com/splitbrain/dokuwiki * Upstream app code repository: <https://github.com/splitbrain/dokuwiki>
* YunoHost documentation for this app: https://yunohost.org/app_dokuwiki * YunoHost documentation for this app: <https://yunohost.org/app_dokuwiki>
* Report a bug: https://github.com/YunoHost-Apps/dokuwiki_ynh/issues * Report a bug: <https://github.com/YunoHost-Apps/dokuwiki_ynh/issues>
## Developer info ## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/dokuwiki_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/dokuwiki_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/dokuwiki_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/dokuwiki_ynh/tree/testing --debug
or or
sudo yunohost app upgrade dokuwiki -u https://github.com/YunoHost-Apps/dokuwiki_ynh/tree/testing --debug sudo yunohost app upgrade dokuwiki -u https://github.com/YunoHost-Apps/dokuwiki_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps **More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,10 +1,14 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Dokuwiki pour YunoHost # Dokuwiki pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/dokuwiki.svg)](https://dash.yunohost.org/appci/app/dokuwiki) ![](https://ci-apps.yunohost.org/ci/badges/dokuwiki.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/dokuwiki.maintain.svg) [![Niveau d'intégration](https://dash.yunohost.org/integration/dokuwiki.svg)](https://dash.yunohost.org/appci/app/dokuwiki) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/dokuwiki.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/dokuwiki.maintain.svg)
[![Installer Dokuwiki avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=dokuwiki) [![Installer Dokuwiki avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=dokuwiki)
*[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 Dokuwiki rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet d'installer Dokuwiki 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.* Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
@ -27,7 +31,7 @@ DokuWiki est un logiciel wiki Open Source simple à utiliser et très polyvalent
## Captures d'écran ## Captures d'écran
![](./doc/screenshots/DokuWiki_Screenshot.png) ![Capture d'écran de Dokuwiki](./doc/screenshots/DokuWiki_Screenshot.png)
## Avertissements / informations importantes ## Avertissements / informations importantes
@ -37,21 +41,22 @@ DokuWiki est un logiciel wiki Open Source simple à utiliser et très polyvalent
## Documentations et ressources ## Documentations et ressources
* Site officiel de l'app : https://www.dokuwiki.org * Site officiel de l'app : <https://www.dokuwiki.org>
* Documentation officielle de l'admin : https://www.dokuwiki.org/manual * Documentation officielle de l'admin : <https://www.dokuwiki.org/manual>
* Dépôt de code officiel de l'app : https://github.com/splitbrain/dokuwiki * Dépôt de code officiel de l'app : <https://github.com/splitbrain/dokuwiki>
* Documentation YunoHost pour cette app : https://yunohost.org/app_dokuwiki * Documentation YunoHost pour cette app : <https://yunohost.org/app_dokuwiki>
* Signaler un bug : https://github.com/YunoHost-Apps/dokuwiki_ynh/issues * Signaler un bug : <https://github.com/YunoHost-Apps/dokuwiki_ynh/issues>
## Informations pour les développeurs ## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/dokuwiki_ynh/tree/testing). Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/dokuwiki_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit. Pour essayer la branche testing, procédez comme suit.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/dokuwiki_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/dokuwiki_ynh/tree/testing --debug
ou ou
sudo yunohost app upgrade dokuwiki -u https://github.com/YunoHost-Apps/dokuwiki_ynh/tree/testing --debug sudo yunohost app upgrade dokuwiki -u https://github.com/YunoHost-Apps/dokuwiki_ynh/tree/testing --debug
``` ```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps **Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -14,15 +14,20 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
# Laster released version. See https://github.com/YunoHost-Apps/dokuwiki_ynh/commits/master # Latest released version. See https://github.com/YunoHost-Apps/dokuwiki_ynh/commits/master
upgrade=1 from_commit=500a7d3fa9c008a2b75d0f6bec519e41fed97da0 upgrade=1 from_commit=500a7d3fa9c008a2b75d0f6bec519e41fed97da0
upgrade=1 from_commit=f45c459b287c8f045c08e65cea412cfc2cae38f4
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
change_url=1 change_url=1
actions=0
config_panel=0
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none
;;; Upgrade options ;;; Upgrade options
; commit=01add99d3d903ca6d07f863045edf2ba46cf18d5 ; commit=500a7d3fa9c008a2b75d0f6bec519e41fed97da0
name=Create check_process name=[fix] dedicated named location per $app (#63)
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=Yes&language=en& manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=Yes&language=en&
; commit=f45c459b287c8f045c08e65cea412cfc2cae38f4
name=add config panel

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/splitbrain/dokuwiki/archive/release_stable_2020-07-29.tar.gz SOURCE_URL=https://download.dokuwiki.org/src/dokuwiki/dokuwiki-2022-07-31a.tgz
SOURCE_SUM=cc1cd9f00095fea327baa79d8f02c904fe1c37bc3f8fd9999eaf646ee9928884 SOURCE_SUM=48ed2ae11fa4a0ae8338af9aedc837601b34e21c0be15d16e2d6228ca7a91f23
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

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

@ -0,0 +1,7 @@
; Additional 'php.ini' parameters for this YunoHost package/application
; Common values to change to increase file upload limit
; Tips: you need to do modify nginx config too: "client_max_body_size"
php_admin_value[upload_max_filesize] = 25M
php_admin_value[post_max_size] = 25M
;source: https://www.dokuwiki.org/faq:uploadsize

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/mallchin/dokuwiki_plugin_logautherror/archive/master.zip
SOURCE_SUM=bc51d4da781d0aabab8e086e51f3cb77ac983eb4366f4c8f5247bb863d4a3bb2
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -9,7 +9,7 @@
"es": "Sistema de Wiki de uso sencillicimo y compatible con los estándares", "es": "Sistema de Wiki de uso sencillicimo y compatible con los estándares",
"it": "Wiki aderente agli standard, semplice da usare, finalizzato principalmente alla creazione di documentazione di qualsiasi tipo" "it": "Wiki aderente agli standard, semplice da usare, finalizzato principalmente alla creazione di documentazione di qualsiasi tipo"
}, },
"version": "2020.07.29~ynh6", "version": "2022.07.31a~ynh1",
"url": "https://www.dokuwiki.org", "url": "https://www.dokuwiki.org",
"upstream": { "upstream": {
"license": "GPL-2.0-or-later", "license": "GPL-2.0-or-later",
@ -29,12 +29,12 @@
"email": "opi@zeropi.net" "email": "opi@zeropi.net"
}], }],
"requirements": { "requirements": {
"yunohost": ">= 4.3.0" "yunohost": ">= 11.0.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
"nginx", "nginx",
"php7.3-fpm" "php8.1-fpm"
], ],
"arguments": { "arguments": {
"install" : [ "install" : [
@ -55,7 +55,11 @@
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"default": true "default": true,
"help": {
"en": "Makes the wiki accessible directly from the Internet for everyone, without intermediate YunoHost authentication",
"fr": "Rend le wiki accessible directement depuis Internet pour tout le monde, sans authentification YunoHost intermédiaire"
}
}, },
{ {
"name": "language", "name": "language",

View file

@ -3,10 +3,26 @@
#================================================= #=================================================
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
# PHP APP SPECIFIC
#=================================================
# Depending on its version, YunoHost uses different default PHP version:
## YunoHost version "11.X" => PHP 7.4
## YunoHost version "4.X" => PHP 7.3
#
# This behaviour can be overridden by setting the YNH_PHP_VERSION variable
#YNH_PHP_VERSION=7.3
#YNH_PHP_VERSION=7.4
#YNH_PHP_VERSION=8.0
YNH_PHP_VERSION=8.1
# For more information, see the PHP application helper: https://github.com/YunoHost/yunohost/blob/dev/helpers/php#L3-L6
# Or this app package depending on PHP: https://github.com/YunoHost-Apps/grav_ynh/blob/master/scripts/_common.sh
# PHP dependencies used by the app (must be on a single line)
php_dependencies="php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-cli"
# or, if you do not need a custom YNH_PHP_VERSION:
###php_dependencies="php$YNH_DEFAULT_PHP_VERSION-deb1 php$YNH_DEFAULT_PHP_VERSION-deb2"
YNH_PHP_VERSION="7.3" # dependencies used by the app (must be on a single line)
pkg_dependencies="$php_dependencies"
pkg_dependencies="php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-gd"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -78,6 +78,16 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$final_path"
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
# Create a dedicated PHP-FPM config
fpm_usage=low
fpm_footprint=low
ynh_add_fpm_config --usage="$fpm_usage" --footprint="$fpm_footprint"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -86,15 +96,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
#================================================= #=================================================
@ -117,8 +118,6 @@ ynh_script_progression --message="Configuring DokuWiki..." --weight=2
# This File cannot be modified directly by DokuWiki, only by hand or by YunoHost # This File cannot be modified directly by DokuWiki, only by hand or by YunoHost
# It will only be updated by YunoHost package or directly by adventurous users # It will only be updated by YunoHost package or directly by adventurous users
# Create the "admin" group and add the "admin" user
ynh_permission_create --permission "admin" --allowed "$admin_user"
# Customize admin group in case of multiple wiki install managed by different admins # Customize admin group in case of multiple wiki install managed by different admins
# dokuwiki.admin; dokuwiki__1.admin; etc # dokuwiki.admin; dokuwiki__1.admin; etc
@ -143,20 +142,20 @@ ynh_add_config --template="../conf/acl.auth.php" --destination="$final_path/conf
# Other files will be read ony and owned by root. # Other files will be read ony and owned by root.
# See https://www.dokuwiki.org/install:permissions # See https://www.dokuwiki.org/install:permissions
cp $final_path/conf/local.php.dist $final_path/conf/local.php.bak cp --archive $final_path/conf/local.php.dist $final_path/conf/local.php.bak
cp $final_path/conf/users.auth.php.dist $final_path/conf/users.auth.php cp --archive $final_path/conf/users.auth.php.dist $final_path/conf/users.auth.php
# This file might be used by plugins like https://www.dokuwiki.org/plugin:siteexport # This file might be used by plugins like https://www.dokuwiki.org/plugin:siteexport
# Create it to be more "user friendly" as over the top security is not the main goal here # Create it to be more "user friendly" as over the top security is not the main goal here
# This file could be use for bad behaviour. # This file could be use for bad behaviour.
# See https://www.dokuwiki.org/devel:preload?s[]=preload # See https://www.dokuwiki.org/devel:preload?s[]=preload
cp $final_path/inc/preload.php.dist $final_path/inc/preload.php cp --archive $final_path/inc/preload.php.dist $final_path/inc/preload.php
# There is no template .dist provided inside DokuWiki installation folder # There is no template .dist provided inside DokuWiki installation folder
# Create "empty" files to be able to manage linux permissions # Create "empty" files to be able to manage linux permissions
# Files content is taken from an existing DokuWiki installation # Files content is taken from an existing DokuWiki installation
cp ../conf/plugins.local.php $final_path/conf cp --archive ../conf/plugins.local.php $final_path/conf
cp ../conf/plugins.local.php $final_path/conf/plugins.local.php.bak cp --archive ../conf/plugins.local.php $final_path/conf/plugins.local.php.bak
#================================================= #=================================================
# STORE THE CHECKSUM OF THE CONFIG FILE # STORE THE CHECKSUM OF THE CONFIG FILE
@ -166,13 +165,6 @@ cp ../conf/plugins.local.php $final_path/conf/plugins.local.php.bak
#ynh_store_file_checksum --file="$final_path/conf/local.protected.php" #ynh_store_file_checksum --file="$final_path/conf/local.protected.php"
### Files '$final_path/conf/local.php' and '$final_path/conf/acl.auth.php' can be modified by user, no need to store checksum as they cannot be overwritten safely by the upgrade script ### Files '$final_path/conf/local.php' and '$final_path/conf/acl.auth.php' can be modified by user, no need to store checksum as they cannot be overwritten safely by the upgrade script
#=================================================
# INSTALL LOGAUTHERROR PLUGIN FOR FAIL2BAN
#=================================================
ynh_script_progression --message="Installing logautherror plugin for Fail2Ban..." --weight=2
ynh_setup_source --dest_dir="$final_path/lib/plugins/logautherror" --source_id=logautherror
# #================================================= # #=================================================
# # GENERIC FINALIZATION # # GENERIC FINALIZATION
# #================================================= # #=================================================
@ -234,6 +226,10 @@ then
ynh_permission_update --permission="main" --add="visitors" ynh_permission_update --permission="main" --add="visitors"
fi fi
# Create the "admin" permission and add the "admin_user" to it
# More users can be added to the group from the YunoHost webadmin
ynh_permission_create --permission "admin" --allowed "$admin_user"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================

View file

@ -45,6 +45,14 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2
# 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=1
# Remove metapackage and its dependencies if no other package need them
ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE FAIL2BAN CONFIGURATION # REMOVE FAIL2BAN CONFIGURATION
#================================================= #=================================================

View file

@ -26,8 +26,8 @@ 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)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
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)
@ -41,12 +41,6 @@ test ! -d $final_path \
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
@ -91,24 +85,6 @@ chown -R $app:www-data "$final_path"
# # Allow to install templates # # Allow to install templates
# chown -R $app:root $final_path/lib/tpl # chown -R $app:root $final_path/lib/tpl
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=5
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# RESTORE FAIL2BAN CONFIGURATION # RESTORE FAIL2BAN CONFIGURATION
#================================================= #=================================================
@ -118,6 +94,34 @@ ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
ynh_systemd_action --action=restart --service_name=fail2ban ynh_systemd_action --action=restart --service_name=fail2ban
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=5
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
# TODO: not in example_ynh, not needed?
#ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
@ -125,7 +129,7 @@ ynh_systemd_action --action=restart --service_name=fail2ban
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM.." --weight=2 ynh_script_progression --message="Reloading NGINX web server and PHP-FPM.." --weight=2
ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================

View file

@ -143,22 +143,22 @@ if [ ! -f "$final_path/conf/local.php.bak" ]; then
# if template exists # if template exists
if [ -f "$final_path/conf/local.php.dist" ]; then if [ -f "$final_path/conf/local.php.dist" ]; then
# Copy template to create default file # Copy template to create default file
cp "$final_path/conf/local.php.dist" "$final_path/conf/local.php.bak" cp --archive "$final_path/conf/local.php.dist" "$final_path/conf/local.php.bak"
fi fi
fi fi
if [ ! -f "$final_path/conf/users.auth.php" ]; then if [ ! -f "$final_path/conf/users.auth.php" ]; then
if [ -f "$final_path/conf/users.auth.php.dist" ]; then if [ -f "$final_path/conf/users.auth.php.dist" ]; then
cp $final_path/conf/users.auth.php.dist $final_path/conf/users.auth.php cp --archive $final_path/conf/users.auth.php.dist $final_path/conf/users.auth.php
fi fi
fi fi
if [ ! -f "$final_path/conf/plugins.local.php" ]; then if [ ! -f "$final_path/conf/plugins.local.php" ]; then
cp ../conf/plugins.local.php $final_path/conf cp --archive ../conf/plugins.local.php $final_path/conf
fi fi
if [ ! -f "$final_path/conf/plugins.local.php.bak" ]; then if [ ! -f "$final_path/conf/plugins.local.php.bak" ]; then
cp ../conf/plugins.local.php $final_path/conf/plugins.local.php.bak cp --archive ../conf/plugins.local.php $final_path/conf/plugins.local.php.bak
fi fi
@ -166,10 +166,18 @@ if [ ! -f "$final_path/inc/preload.php" ]; then
# if template exists # if template exists
if [ -f "$final_path/inc/preload.php.dist" ]; then if [ -f "$final_path/inc/preload.php.dist" ]; then
# Copy template to create default file # Copy template to create default file
cp "$final_path/inc/preload.php.dist" "$final_path/inc/preload.php" cp --archive "$final_path/inc/preload.php.dist" "$final_path/inc/preload.php"
fi fi
fi fi
# purge "LOGAUTHERROR PLUGIN" as not compatible and not maintained anymore
# See https://www.dokuwiki.org/plugin:logautherror
if [ -d "$final_path/lib/plugins/logautherror" ]; then
ynh_script_progression --message="Purge "LOGAUTHERROR PLUGIN" as not maintained anymore" --weight=1
ynh_secure_remove --file "$final_path/lib/plugins/logautherror"
fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
@ -275,15 +283,27 @@ fi
# TODO Taken from old "upgrade" script. Should check if it is needed and what it does # TODO Taken from old "upgrade" script. Should check if it is needed and what it does
# Update all plugins # Update all plugins
for name_plugin in $(sudo -s cat $final_path/lib/plugins/*/plugin.info.txt | grep url | awk -F ':' '{print $3}'); ###for name_plugin in $(sudo -s cat $final_path/lib/plugins/*/plugin.info.txt | grep url | awk -F ':' '{print $3}');
do ###do
# Get a official plugin for dokuwiki, not update a no-official ### # Get a official plugin for dokuwiki, not update a no-official
wget -nv --quiet "https://github.com/splitbrain/dokuwiki-plugin-$name_plugin/zipball/master" -O "${name_plugin}.zip" -o /dev/null || true ### wget -nv --quiet "https://github.com/splitbrain/dokuwiki-plugin-$name_plugin/zipball/master" -O "${name_plugin}.zip" -o /dev/null || true
if [ -s "${name_plugin}.zip" ]; then ### if [ -s "${name_plugin}.zip" ]; then
unzip ${name_plugin}.zip ### unzip ${name_plugin}.zip
cp -a splitbrain-dokuwiki-plugin-${name_plugin}*/. "$final_path/lib/plugins/$name_plugin/" ### cp -a splitbrain-dokuwiki-plugin-${name_plugin}*/. "$final_path/lib/plugins/$name_plugin/"
### fi
###done
# if "file" exists and is executable
# Stolen from https://github.com/YunoHost-Apps/grav_ynh/blob/testing/scripts/upgrade#L189
if [ -x "$final_path/bin/plugin.php" ]; then
pushd "$final_path"
ynh_exec_warn_less ynh_exec_as $app php${YNH_PHP_VERSION} bin/plugin.php --no-colors extension upgrade || ynh_print_warn --message="Automatic plugin upgrade has failed, you can upgrade them from your DokuWiki admin panel."
popd
else
ynh_print_warn --message="Automatic plugin cannot be done, you have to upgrade them from your DokuWiki admin panel."
fi fi
done
fi fi
#================================================= #=================================================
@ -295,10 +315,7 @@ fi
ynh_backup_if_checksum_is_different --file="$final_path/conf/local.protected.php" ynh_backup_if_checksum_is_different --file="$final_path/conf/local.protected.php"
# Always overwrite local file with the one from package. # Always overwrite local file with the one from package.
cp ../conf/local.protected.php $final_path/conf cp --archive ../conf/local.protected.php $final_path/conf
# Create the "admin" group and add the "admin" user
#ynh_permission_create --permission "admin" --allowed "$admin_user"
# Customize admin group in case of multiple wiki install managed by different admins # Customize admin group in case of multiple wiki install managed by different admins
# dokuwiki.admin; dokuwiki__1.admin; etc # dokuwiki.admin; dokuwiki__1.admin; etc
@ -307,13 +324,6 @@ ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_fil
# Recalculate and store the checksum of the file for the next upgrade. # Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/conf/local.protected.php" ynh_store_file_checksum --file="$final_path/conf/local.protected.php"
#=================================================
# INSTALL LOGAUTHERROR PLUGIN FOR FAIL2BAN
#=================================================
ynh_script_progression --message="Upgrading logautherror plugin for Fail2Ban..." --weight=2
ynh_setup_source --dest_dir="$final_path/lib/plugins/logautherror" --source_id=logautherror
# #================================================= # #=================================================
# # GENERIC FINALIZATION # # GENERIC FINALIZATION
# #================================================= # #=================================================