Skip to content

Commit

Permalink
Add DSM 6 wizard checks for multiple PHP profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
mreid-tt committed Nov 14, 2023
1 parent ba9ad9c commit c02a42e
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 7 deletions.
50 changes: 50 additions & 0 deletions spk/selfoss/src/wizard/install_uifile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

quote_json ()
{
sed -e 's|\\|\\\\|g' -e 's|\"|\\\"|g'
}

page_append ()
{
if [ -z "$1" ]; then
echo "$2"
elif [ -z "$2" ]; then
echo "$1"
else
echo "$1,$2"
fi
}

# Check for multiple PHP profiles
check_php_profiles ()
{
PHP_CFG_PATH="/usr/syno/etc/packages/WebStation/PHPSettings.json"
if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -lt 7 ]; then
if jq -e 'to_entries | map(select((.key | startswith("com-synocommunity-packages-")) and .key != "com-synocommunity-packages-selfoss")) | length > 0' "${PHP_CFG_PATH}" >/dev/null; then
return 0 # true
else
return 1 # false
fi
fi
}

PAGE_PHP_PROFILES=$(/bin/cat<<EOF
{
"step_title": "Multiple PHP profiles",
"items": [{
"desc": "Attention: Multiple PHP profiles detected; the package webpage will not display until a DSM restart is performed to load new configurations."
}]
}
EOF
)

main () {
local install_page=""
if check_php_profiles; then
install_page=$(page_append "$install_page" "$PAGE_PHP_PROFILES")
fi
echo "[$install_page]" > "${SYNOPKG_TEMP_LOGFILE}"
}

main "$@"
50 changes: 50 additions & 0 deletions spk/selfoss/src/wizard/install_uifile_fre.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

quote_json ()
{
sed -e 's|\\|\\\\|g' -e 's|\"|\\\"|g'
}

page_append ()
{
if [ -z "$1" ]; then
echo "$2"
elif [ -z "$2" ]; then
echo "$1"
else
echo "$1,$2"
fi
}

# Check for multiple PHP profiles
check_php_profiles ()
{
PHP_CFG_PATH="/usr/syno/etc/packages/WebStation/PHPSettings.json"
if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -lt 7 ]; then
if jq -e 'to_entries | map(select((.key | startswith("com-synocommunity-packages-")) and .key != "com-synocommunity-packages-selfoss")) | length > 0' "${PHP_CFG_PATH}" >/dev/null; then
return 0 # true
else
return 1 # false
fi
fi
}

PAGE_PHP_PROFILES=$(/bin/cat<<EOF
{
"step_title": "Plusieurs profils PHP",
"items": [{
"desc": "Attention : Plusieurs profils PHP détectés ; la page Web du package ne s'affichera pas tant qu'un redémarrage de DSM n'aura pas été effectué pour charger de nouvelles configurations."
}]
}
EOF
)

main () {
local install_page=""
if check_php_profiles; then
install_page=$(page_append "$install_page" "$PAGE_PHP_PROFILES")
fi
echo "[$install_page]" > "${SYNOPKG_TEMP_LOGFILE}"
}

main "$@"
4 changes: 1 addition & 3 deletions spk/selfoss/src/wizard/uninstall_uifile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[{
"step_title": "Remove selfoss database",
"items": [{
"desc": "Attention: The selfoss database will be removed during package uninstallation. All feeds will be deleted."
}, {
"desc": "Optional: Use the 'Export sources' function within 'Settings' to keep a backup of your feeds."
"desc": "Attention: The selfoss database will be deleted when uninstalling the package, resulting in the removal of all feeds. Optionally, safeguard your feeds by utilizing the 'Export sources' function in the 'Settings' menu to create a backup."
}]
}]
6 changes: 2 additions & 4 deletions spk/selfoss/src/wizard/uninstall_uifile_fre
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[{
"step_title": "Suppression de la base de donnée selfoss",
"step_title": "Supprimer la base de données Selfoss",
"items": [{
"desc": "Si vous supprimez la base de donnée selfoss, tous les flux seront supprimées."
}, {
"desc": "Facultatif: Utilisez la fonction « Exporter les sources » dans « Paramètres » pour conserver une sauvegarde de vos flux."
"desc": "Attention : La base de données selfoss sera supprimée lors de la désinstallation du package, entraînant la suppression de tous les flux. Vous pouvez éventuellement sauvegarder vos flux en utilisant la fonction « Exporter les sources » dans le menu « Paramètres » pour créer une sauvegarde."
}]
}]

0 comments on commit c02a42e

Please sign in to comment.