From 92f754dafab10a9126a98a9849bd82fb62e1952b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 20 May 2024 20:47:12 +0200 Subject: [PATCH] Use standard redis helpers --- manifest.json | 2 +- scripts/_common.sh | 44 +------------------------------------------- 2 files changed, 2 insertions(+), 44 deletions(-) diff --git a/manifest.json b/manifest.json index 7ef2b34..ee37eed 100644 --- a/manifest.json +++ b/manifest.json @@ -22,7 +22,7 @@ "url": "" }, "requirements": { - "yunohost": ">= 4.3.0" + "yunohost": ">= 11.2.12" }, "multi_instance": true, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 53b54d6..31cb962 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -443,7 +443,7 @@ ynh_cleanup_ruby () { required_ruby_versions="${installed_app_ruby_version}\n${required_ruby_versions}" fi done - + # Remove no more needed Ruby versions local installed_ruby_versions=$(rbenv versions --bare --skip-aliases | grep -Ev '/') for installed_ruby_version in $installed_ruby_versions @@ -464,45 +464,3 @@ ynh_cleanup_ruby () { ynh_secure_remove --file="/etc/profile.d/rbenv.sh" fi } - -#================================================= -# REDIS HELPERS -#================================================= - -# get the first available redis database -# -# usage: ynh_redis_get_free_db -# | returns: the database number to use -ynh_redis_get_free_db() { - local result max db - result=$(redis-cli INFO keyspace) - - # get the num - max=$(cat /etc/redis/redis.conf | grep ^databases | grep -Eow "[0-9]+") - - db=0 - # default Debian setting is 15 databases - for i in $(seq 0 "$max") - do - if ! echo "$result" | grep -q "db$i" - then - db=$i - break 1 - fi - db=-1 - done - - test "$db" -eq -1 && ynh_die --message="No available Redis databases..." - - echo "$db" -} - -# Create a master password and set up global settings -# Please always call this script in install and restore scripts -# -# usage: ynh_redis_remove_db database -# | arg: database - the database to erase -ynh_redis_remove_db() { - local db=$1 - redis-cli -n "$db" flushall -}