Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if [[ ! -e "${SIMVA_DATA_HOME}/limesurvey/.initialized" ]]; then
DB_PASSWORD=$SIMVA_LIMESURVEY_MYSQL_PASSWORD

if [[ ${SIMVA_LIMESURVEY_VERSION%.*} > 5 ]]; then
declare -A plugins=(["LimeSurveyWebhook"]=${SIMVA_LIMESURVEY_WEBHOOK_PLUGIN_VERSION} ["AuthOAuth2"]=${SIMVA_LIMESURVEY_AUTHOAUTH2_PLUGIN_VERSION} ["LimeSurveyXAPITracker"]=${SIMVA_LIMESURVEY_XAPITRACKER_PLUGIN_VERSION});
declare -A plugins=(["LimeSurveyWebhook"]=${SIMVA_LIMESURVEY_WEBHOOK_PLUGIN_VERSION} ["AuthOAuth2"]=${SIMVA_LIMESURVEY_AUTHOAUTH2_PLUGIN_VERSION} ["LimeSurveyXAPITracker"]=${SIMVA_LIMESURVEY_XAPITRACKER_PLUGIN_VERSION} ["SurveyGuardian"]=${SIMVA_LIMESURVEY_SURVEYGUARDIAN_PLUGIN_VERSION});
for key in "${!plugins[@]}"; do
ext_name=$key
ext_version=${plugins[$key]}
Expand Down Expand Up @@ -53,4 +53,20 @@ if [[ ! -e "${SIMVA_DATA_HOME}/limesurvey/.initialized" ]]; then
"
fi
fi

SurveyGuardian=$("${SIMVA_HOME}/bin/run-command.sh" mysql -u $DB_USER -p"$DB_PASSWORD" -e "
USE $DB_NAME;
SELECT id FROM \`plugins\` WHERE name='$SURVEYGUARDIAN_PLUGIN_NAME' AND active=1 and version='$SURVEYGUARDIAN_PLUGIN_VERSION';");
echo $SurveyGuardian;
if [[ ! $SurveyGuardian == *"id"* ]]; then
echo "Inserting plugin $SURVEYGUARDIAN_PLUGIN_NAME into the plugins table..."
"${SIMVA_HOME}/bin/run-command.sh" mysql -u $DB_USER -p"$DB_PASSWORD" -e "
USE $DB_NAME;
INSERT INTO \`plugins\` (name, plugin_type, active, priority, version)
VALUES ('$SURVEYGUARDIAN_PLUGIN_NAME', 'user', 1, 0, '$SURVEYGUARDIAN_PLUGIN_VERSION');
"
echo "Plugin $SURVEYGUARDIAN_PLUGIN_NAME has been installed and its settings have been added!"
else
echo "Plugin $SURVEYGUARDIAN_PLUGIN_NAME settings have already been added!"
fi
fi
20 changes: 19 additions & 1 deletion docker-stacks/03-limesurvey/etc/hooks/before-install.d/20-install-limesurvey-plugins.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ if [[ ! -d "${PLUGINS_DIR}" ]]; then
fi

DEPLOYMENT_DIR="${SIMVA_DATA_HOME}/limesurvey/data/plugins"
UPLOAD_DIR="${SIMVA_DATA_HOME}/limesurvey/data/upload/plugins"

declare -A plugins=(["LimeSurveyWebhook"]=${SIMVA_LIMESURVEY_WEBHOOK_PLUGIN_VERSION} ["AuthOAuth2"]=${SIMVA_LIMESURVEY_AUTHOAUTH2_PLUGIN_VERSION} ["LimeSurveyXAPITracker"]=${SIMVA_LIMESURVEY_XAPITRACKER_PLUGIN_VERSION});
declare -A plugins=(["LimeSurveyWebhook"]=${SIMVA_LIMESURVEY_WEBHOOK_PLUGIN_VERSION} ["AuthOAuth2"]=${SIMVA_LIMESURVEY_AUTHOAUTH2_PLUGIN_VERSION} ["LimeSurveyXAPITracker"]=${SIMVA_LIMESURVEY_XAPITRACKER_PLUGIN_VERSION} ["SurveyGuardian"]=${SIMVA_LIMESURVEY_SURVEYGUARDIAN_PLUGIN_VERSION});

for key in "${!plugins[@]}"; do
ext_name=$key
Expand All @@ -31,4 +32,21 @@ for key in "${!plugins[@]}"; do
tmp_dir=$(mktemp -d)
unzip "${PLUGINS_DIR}/${ext_zip}" -d $tmp_dir
rsync -avh --delete --itemize-changes ${tmp_dir}/ "${DEPLOYMENT_DIR}/$ext_name"
if [[ $ext_name = "SurveyGuardian" ]]; then
if [[ ! -e "${UPLOAD_DIR}/$ext_name/assets/" ]]; then
mkdir -p "${UPLOAD_DIR}/$ext_name/assets/"
fi
if [[ -e "${UPLOAD_DIR}/$ext_name/assets/survey-tables/" ]]; then
mv ${UPLOAD_DIR}/$ext_name/assets/survey-tables/* "${UPLOAD_DIR}/$ext_name/survey-tables/"
fi

rsync -avh --delete --itemize-changes "${DEPLOYMENT_DIR}/$ext_name/assets" "${UPLOAD_DIR}/$ext_name";
if [[ -e "${UPLOAD_DIR}/$ext_name/survey-tables/" ]]; then
mv ${UPLOAD_DIR}/$ext_name/survey-tables/* "${UPLOAD_DIR}/$ext_name/assets/survey-tables/"
else
mkdir -p "${UPLOAD_DIR}/$ext_name/assets/survey-tables/"
fi
fi
done


1 change: 1 addition & 0 deletions docker-stacks/etc/simva.install.d/simva-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export SIMVA_KAFKA_EXTENSIONS_VERSION="1.0.0"
export SIMVA_LIMESURVEY_AUTHOAUTH2_PLUGIN_VERSION="1.5.0"
export SIMVA_LIMESURVEY_WEBHOOK_PLUGIN_VERSION="1.1.0"
export SIMVA_LIMESURVEY_XAPITRACKER_PLUGIN_VERSION="1.0.0"
export SIMVA_LIMESURVEY_SURVEYGUARDIAN_PLUGIN_VERSION="1.0.0"

#################################
# OS and Architecture detection #
Expand Down