Skip to content
Open
16 changes: 16 additions & 0 deletions conf/collected_addresses.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
INSERT INTO collected_addresses (
changed,
email,
name,
user_id,
type
) SELECT
cc.changed,
cc.email,
cc.name,
cc.user_id,
1
FROM collected_contacts cc
LEFT JOIN collected_addresses ca
ON (cc.email = ca.email) AND (cc.user_id = ca.user_id)
WHERE ca.email IS NULL;
19 changes: 9 additions & 10 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,15 @@ ram.runtime = "50M"
[resources.apt]
packages = [
"mariadb-server",
"php8.5",
"php8.5-ldap",
"php8.5-mysql",
"php8.5-cli",
"php8.5-intl",
"php8.5-zip",
"php8.5-gd",
"php8.5-mbstring",
"php8.5-dom",
"php8.5-curl"
"php8.3-ldap",
"php8.3-mysql",
"php8.3-cli",
"php8.3-intl",
"php8.3-zip",
"php8.3-gd",
"php8.3-mbstring",
"php8.3-dom",
"php8.3-curl"
]

[resources.database]
Expand Down
3 changes: 2 additions & 1 deletion scripts/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# COMMON VARIABLES AND CUSTOM HELPERS
#=================================================

timezone=$(timedatectl show --value --property=Timezone)

# Plugins version
contextmenu_version=3.3.1
automatic_addressbook_version=v0.4.3
carddav_version=5.1.2
10 changes: 3 additions & 7 deletions scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ ynh_mysql_db_shell < "$install_dir/SQL/mysql.initial.sql"
#=================================================
ynh_script_progression "Configuring Roundcube..."

timezone=$(cat /etc/timezone)
ynh_app_setting_set_default --key="timezone" --value="$timezone"

deskey=$(ynh_string_random --length=24)

ynh_config_add --template="config.inc.php" --destination="$install_dir/config/config.inc.php"

#=================================================
Expand All @@ -69,13 +67,11 @@ export COMPOSER_ALLOW_SUPERUSER=1
ynh_composer_exec require kolab/net_ldap3

# Install contextmenu and automatic_addressbook plugins
# https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook
# https://plugins.roundcube.net/packages/johndoh/contextmenu
ynh_composer_exec require \
johndoh/contextmenu $contextmenu_version \
sblaisot/automatic_addressbook $automatic_addressbook_version
johndoh/contextmenu $contextmenu_version

installed_plugins+=" 'contextmenu', 'automatic_addressbook',"
installed_plugins+=" 'contextmenu',"

ynh_config_add --template="enigma.config.inc.php" --destination="$install_dir/plugins/enigma/config.inc.php"
mkdir -p "$install_dir/plugins/enigma/home"
Expand Down
32 changes: 17 additions & 15 deletions scripts/upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,16 @@ fi
# If language doesn't exist, create it
ynh_app_setting_set_default --key=language --value="en_GB"

#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================

# Get the current version of roundcube
oldversion=$(grep RCMAIL_VERSION "$install_dir/program/include/iniset.php" | cut -d\' -f4)

#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Upgrading source files..."

# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="composer.json composer.lock config/config.inc.php logs/ plugins/"

chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
Expand All @@ -55,10 +54,8 @@ ynh_config_add_nginx
#=================================================
ynh_script_progression "Reconfiguring Roundcube..."

timezone=$(cat /etc/timezone)
ynh_app_setting_set_default --key="timezone" --value="$timezone"

deskey=$(ynh_string_random --length=24)

ynh_config_add --template="config.inc.php" --destination="$install_dir/config/config.inc.php"

#=================================================
Expand All @@ -72,10 +69,10 @@ if [ -f "$install_dir/composer.lock" ]; then
fi

# Install composer.json
cp "$install_dir/composer.json-dist" "$install_dir/composer.json"
#cp "$install_dir/composer.json-dist" "$install_dir/composer.json"

chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#chmod -R o-rwx "$install_dir"
#chown -R $app:www-data "$install_dir"

# Upgrade composer itself
ynh_composer_exec install --no-dev
Expand Down Expand Up @@ -105,13 +102,11 @@ mkdir -p "$install_dir/"{logs,temp}
ynh_composer_exec require kolab/net_ldap3

# Update or install contextmenu and automatic_addressbook plugins
# https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook
# https://plugins.roundcube.net/packages/johndoh/contextmenu
ynh_composer_exec update --no-dev --prefer-dist \
johndoh/contextmenu $contextmenu_version \
sblaisot/automatic_addressbook $automatic_addressbook_version
johndoh/contextmenu $contextmenu_version

installed_plugins+=" 'contextmenu', 'automatic_addressbook',"
installed_plugins+=" 'contextmenu',"

ynh_config_add --template="enigma.config.inc.php" --destination="$install_dir/plugins/enigma/config.inc.php"
mkdir -p "$install_dir/plugins/enigma/home"
Expand Down Expand Up @@ -153,6 +148,13 @@ then
fi
fi

#=================================================
# PLUG IN MIGRATION
#=================================================
ynh_script_progression "Ccollected addresses migration..."

ynh_mysql_db_shell < "../conf/collected_addresses.sql"

#=================================================
# UPDATE ROUNDCUBE CONFIGURATION
#=================================================
Expand Down
2 changes: 1 addition & 1 deletion tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ test_format = 1.0
args.with_carddav = 1


#test_upgrade_from.255335f9e9a001d5abec7192f07d168e30b3c3fb.name = "1.6.0~ynh3"
test_upgrade_from.255335f9e9a001d5abec7192f07d168e30b3c3fb.name = "1.6.0~ynh3"