From 3006e4345d7f8c81d0a9dede39ce4e1e273445d1 Mon Sep 17 00:00:00 2001 From: Gofannon Date: Thu, 18 Aug 2022 21:47:53 +0200 Subject: [PATCH] Change method to "automatic upgrade" of plugins --- scripts/_common.sh | 2 +- scripts/upgrade | 30 +++++++++++++++++++++--------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 52b12cb..07ff399 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -17,7 +17,7 @@ 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_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" diff --git a/scripts/upgrade b/scripts/upgrade index 3c56493..46b23af 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -283,15 +283,27 @@ fi # TODO Taken from old "upgrade" script. Should check if it is needed and what it does # Update all plugins - for name_plugin in $(sudo -s cat $final_path/lib/plugins/*/plugin.info.txt | grep url | awk -F ':' '{print $3}'); - do - # 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 - if [ -s "${name_plugin}.zip" ]; then - unzip ${name_plugin}.zip - cp -a splitbrain-dokuwiki-plugin-${name_plugin}*/. "$final_path/lib/plugins/$name_plugin/" - fi - done + ###for name_plugin in $(sudo -s cat $final_path/lib/plugins/*/plugin.info.txt | grep url | awk -F ':' '{print $3}'); + ###do + ### # 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 + ### if [ -s "${name_plugin}.zip" ]; then + ### unzip ${name_plugin}.zip + ### 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 #=================================================