diff --git a/dd-ctl b/dd-ctl index 9f71beb..dc8cf9c 100755 --- a/dd-ctl +++ b/dd-ctl @@ -14,6 +14,7 @@ if [ -z "$OPERATION" ]; then echo " Stop the project when started: ./dd-ctl down" echo " Apply customizations: ./dd-ctl customize" echo " Update SAML certificates: ./dd-ctl saml" + echo " Upgrade plugins: ./dd-ctl upgrade-plugins" exit 1 fi @@ -28,9 +29,11 @@ CUSTOM_PATH=$(pwd) . ./.env prepare_submodules(){ - git submodule update --init --recursive - cd isard-apps && git fetch && git reset --hard origin/$BRANCH && cd .. - cd isard-sso && git fetch && git reset --hard origin/$BRANCH && cd .. + if [ ! "$BRANCH" = "develop" ]; then + git submodule update --init --recursive + cd isard-apps && git fetch && git reset --hard origin/$BRANCH && cd .. + cd isard-sso && git fetch && git reset --hard origin/$BRANCH && cd .. + fi } prepare(){ @@ -247,6 +250,75 @@ extras_develop(){ config > devel.yml } +upgrade_plugins_moodle(){ + rm -rf /tmp/moodle + + mkdir -p /tmp/moodle/mod + mkdir -p /tmp/moodle/mod/assign/submission + mkdir -p /tmp/moodle/auth/saml2 + mkdir -p /tmp/moodle/theme/cbe + mkdir -p /tmp/moodle/blocks + + curl --location https://moodle.org/plugins/download.php/25078/mod_jitsi_moodle311_2021090100.zip > jitsi.zip + unzip jitsi.zip -d /tmp/moodle/mod/ + rm jitsi.zip + + curl --location https://moodle.org/plugins/download.php/24977/mod_bigbluebuttonbn_moodle311_2019101011.zip > bbb.zip + unzip bbb.zip -d /tmp/moodle/mod/ + rm bbb.zip + + curl --location https://github.com/isard-vdi/moodle-auth_saml2/archive/refs/heads/role_map.zip > auth_saml2.zip + unzip auth_saml2.zip -d /tmp/moodle/auth/ + mv /tmp/moodle/auth/moodle-auth_saml2-role_map/* /tmp/moodle/auth/saml2/ + rm -rf /tmp/moodle/auth/moodle-auth_saml2-role_map + rm auth_saml2.zip + + curl --location https://github.com/3iPunt/moodle_mod_tresipuntshare/archive/refs/heads/master.zip > tresipuntshare.zip + unzip tresipuntshare.zip -d /tmp/moodle/mod/ + mv /tmp/moodle/mod/moodle_mod_tresipuntshare-master /tmp/moodle/mod/tresipuntshare + rm tresipuntshare.zip + + curl --location https://github.com/3iPunt/moodle_mod_tresipuntvideo/archive/refs/heads/master.zip > tresipuntvideo.zip + unzip tresipuntvideo.zip -d /tmp/moodle/mod/ + mv /tmp/moodle/mod/moodle_mod_tresipuntvideo-master /tmp/moodle/mod/tresipuntvideo + rm tresipuntvideo.zip + + curl --location https://github.com/3iPunt/moodle_mod_tresipuntaudio/archive/refs/heads/master.zip > tresipuntaudio.zip + unzip tresipuntaudio.zip -d /tmp/moodle/mod/ + mv /tmp/moodle/mod/moodle_mod_tresipuntaudio-master /tmp/moodle/mod/tresipuntaudio + rm tresipuntaudio.zip + + curl --location https://github.com/3iPunt/moodle_assignsubmission_tipnc/archive/refs/heads/master.zip > assignsubmission_tipnc.zip + unzip assignsubmission_tipnc.zip -d /tmp/moodle/mod/assign/submission/ + mv /tmp/moodle/mod/assign/submission/moodle_assignsubmission_tipnc-master /tmp/moodle/mod/assign/submission/tipnc + rm assignsubmission_tipnc.zip + + curl --location https://gitlab.com/digitaldemocratic/digitaldemocratic/-/raw/master/custom.sample/moodle/plugins/block_tresipuntmodspend.zip?inline=false > block_tresipuntmodspend.zip + unzip block_tresipuntmodspend.zip -d /tmp/moodle/blocks/ + rm block_tresipuntmodspend.zip + + curl --location https://github.com/3iPunt/moodle_theme_cbe/archive/refs/heads/master.zip > tresipunt_theme_cbe.zip + unzip tresipunt_theme_cbe.zip -d /tmp/moodle/theme/cbe/ + mv /tmp/moodle/theme/cbe/moodle_theme_cbe-master/* /tmp/moodle/theme/cbe/ + rm tresipunt_theme_cbe.zip + + mkdir -p /tmp/moodle/local/tresipuntimportgc + cp -R local_plugins/moodle/tresipuntimportgc/* /tmp/moodle/local/tresipuntimportgc/ + + cp -R /tmp/moodle/* /opt/digitaldemocratic/src/moodle/ + rm -rf /tmp/moodle +} + +upgrade_plugins_wp(){ +## MU-PLUGINS WP + rm -rf /tmp/muplugins-google-sites-master + curl --location https://gitlab.com/muplugins-multiste1/muplugins-google-sites/-/archive/master/muplugins-google-sites-master.zip > muplugins.zip + unzip muplugins.zip -d /tmp/ + cp -R /tmp/muplugins-google-sites-master/mu-plugins/* /opt/digitaldemocratic/src/wordpress/wp-content/mu-plugins/ + rm muplugins.zip + rm /tmp/muplugins-google-sites-master -rf +} + if [ "$OPERATION" = "prepare" ]; then prepare_submodules prepare @@ -302,6 +374,11 @@ if [ "$OPERATION" = "all" ]; then echo " - ./dd-ctl customize" fi +if [ "$OPERATION" = "upgrade-plugins" ]; then + upgrade_plugins_moodle + upgrade_plugins_wp +fi + if [ "$OPERATION" = "all-develop" ]; then prepare build