From d7c1938556589dd5783c3f566dd311c3a968806d Mon Sep 17 00:00:00 2001 From: Daniel Hansson Date: Sat, 29 Sep 2018 12:43:05 +0200 Subject: [PATCH] make it possible to install fts multiple times (#671) * change from psql to occ_command Saving in commit for future reference: USER=$(grep 'dbuser' $NCPATH/config/config.php | awk '{print $3}' | sed "s/[',]//g") PASS=$(grep 'dbpassword' $NCPATH/config/config.php | awk '{print $3}' | sed "s/[',]//g") PGPASSWORD="$PASS" psql -U "$USER" -h 127.0.0.1 nextcloud_db -c 'DROP TABLE IF EXISTS oc_fulltextsearch_ticks CASCADE;' --- apps/fulltextsearch.sh | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/apps/fulltextsearch.sh b/apps/fulltextsearch.sh index d42d9f09..52bdd219 100644 --- a/apps/fulltextsearch.sh +++ b/apps/fulltextsearch.sh @@ -48,12 +48,36 @@ then deluser --group solr fi +# Reset Full Text Search to be able to index again, and also remove the app to be able to install it again +if [ -d $NC_APPS_PATH/fulltextsearch ] +then + echo "Removing old version of Full Text Search and resetting the app..." + occ_command fulltextsearch:reset + occ_command app:disable fulltextsearch + rm -rf $NC_APPS_PATH/fulltextsearch +fi +if [ -d $NC_APPS_PATH/fulltextsearch_elasticsearch ] +then + occ_command app:disable fulltextsearch_elasticsearch + rm -rf $NC_APPS_PATH/fulltextsearch_elasticsearch +fi +if [ -d $NC_APPS_PATH/files_fulltextsearch ] +then + occ_command app:disable files_fulltextsearch + rm -rf $NC_APPS_PATH/files_fulltextsearch +fi + # Check & install docker apt update -q4 & spinner_loading install_docker set_max_count mkdir -p "$RORDIR" -docker pull "$nc_fts" +if docker ps -a | grep "$fts_es_name" +then + docker stop "$fts_es_name" && docker rm "$fts_es_name" && docker pull "$nc_fts" +else + docker pull "$nc_fts" +fi # Create configuration YML cat << YML_CREATE > /opt/es/readonlyrest.yml