Skip to content

Commit

Permalink
ownCloud: Update PHP FPM in DSM 6 (#5920)
Browse files Browse the repository at this point in the history
* Fix for PHP FPM in DSM 6
* Fix archive permissions and data share in DSM 6
* Fix for multiple PHP profiles in DSM 6
* Match restore folders with backup folders
* Add DSM 6 wizard checks for multiple PHP profiles
  • Loading branch information
mreid-tt authored Nov 21, 2023
1 parent 239497f commit 37c5640
Show file tree
Hide file tree
Showing 9 changed files with 220 additions and 82 deletions.
11 changes: 9 additions & 2 deletions spk/owncloud/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SPK_NAME = owncloud
SPK_VERS = 10.13.2
SPK_REV = 12
SPK_REV = 13
SPK_ICON = src/owncloud.png

DEPENDS = cross/owncloud
Expand All @@ -18,7 +18,7 @@ HOMEPAGE = https://owncloud.org/

LICENSE = AGPL

WIZARDS_TEMPLATES_DIR = src/wizard_templates/
WIZARDS_TEMPLATES_DIR = src/wizard_templates
SERVICE_WIZARD_SHARENAME = wizard_data_share
USE_DATA_SHARE_WORKER = yes

Expand All @@ -32,6 +32,13 @@ DSM_UI_DIR = app
DSM_UI_CONFIG = src/app/config
CONF_DIR = src/conf/

include ../../mk/spksrc.common.mk

# Alternate conf dir for DSM 6
ifeq ($(call version_lt, ${TCVERSION}, 7.0),1)
CONF_DIR = src/conf_6/
endif

SERVICE_SETUP = src/service-setup.sh
STARTABLE = no

Expand Down
11 changes: 11 additions & 0 deletions spk/owncloud/src/conf_6/resource
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"data-share": {
"shares": [{
"name": "{{wizard_data_share}}",
"permission": {
"rw": ["http"]
},
"once": true
}]
}
}
236 changes: 161 additions & 75 deletions spk/owncloud/src/service-setup.sh

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions spk/owncloud/src/web/owncloud.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
"max_spare_servers": 3,
"min_spare_servers": 1,
"mode": "dynamic",
"start_servers": 2,
"user_owncloud": true
"start_servers": 2
},
"open_basedir": "",
"php_settings": {},
Expand Down
29 changes: 28 additions & 1 deletion spk/owncloud/src/wizard_templates/install_uifile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ fi
SHAREDIR="${SYNOPKG_PKGNAME}"
DIR_VALID="/^[\\w _-]+$/"

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

Expand Down Expand Up @@ -138,6 +139,19 @@ EOF
echo "$DEACTIVAETE" | quote_json
}

# 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-owncloud")) | length > 0' "${PHP_CFG_PATH}" >/dev/null; then
return 0 # true
else
return 1 # false
fi
fi
}

PAGE_ADMIN_CONFIG=$(/bin/cat<<EOF
{
"step_title": "{{{OWNCLOUD_INSTALL_RESTORE_STEP_TITLE}}}",
Expand Down Expand Up @@ -242,9 +256,22 @@ PAGE_ADMIN_CONFIG=$(/bin/cat<<EOF
EOF
)

PAGE_PHP_PROFILES=$(/bin/cat<<EOF
{
"step_title": "{{PHP_PROFILES_TITLE}}",
"items": [{
"desc": "{{PHP_PROFILES_DESCRIPTION}}"
}]
}
EOF
)

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

Expand Down
3 changes: 3 additions & 0 deletions spk/owncloud/src/wizard_templates/install_uifile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ OWNCLOUD_TRUSTED_DOMAIN_3_LABEL: "Domain or IP address"

OWNCLOUD_CONFIRM_RESTORE_STEP_TITLE: "ownCloud confirm restore"
OWNCLOUD_CONFIRM_RESTORE_DESCRIPTION: "The installation will now proceed, and your previous configuration will be restored from the backup. Please verify that the file path is accurate and that the user 'sc-owncloud' has read permissions for that path; otherwise, a new installation will be initiated."

PHP_PROFILES_TITLE: "Multiple PHP profiles"
PHP_PROFILES_DESCRIPTION: "Attention: Multiple PHP profiles detected; the package webpage will not display until a DSM restart is performed to load new configurations."
3 changes: 3 additions & 0 deletions spk/owncloud/src/wizard_templates/install_uifile_fre.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ OWNCLOUD_TRUSTED_DOMAIN_3_LABEL: "Domaine ou adresse IP"

OWNCLOUD_CONFIRM_RESTORE_STEP_TITLE: "Confirmer la restauration ownCloud"
OWNCLOUD_CONFIRM_RESTORE_DESCRIPTION: "L'installation va maintenant se poursuivre et votre configuration précédente sera restaurée à partir de la sauvegarde. Veuillez vérifier que le chemin du fichier est exact et que l'utilisateur « sc-owncloud » dispose des autorisations de lecture pour ce chemin ; sinon, une nouvelle installation sera lancée."

PHP_PROFILES_TITLE: "Plusieurs profils PHP"
PHP_PROFILES_DESCRIPTION: "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."
3 changes: 2 additions & 1 deletion spk/owncloud/src/wizard_templates/uninstall_uifile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ if [ $SYNOPKG_DSM_VERSION_MAJOR -lt 7 ]; then
fi
fi

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

Expand Down
3 changes: 2 additions & 1 deletion spk/owncloud/src/wizard_templates/upgrade_uifile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
OC_NEW_VER=$(echo ${SYNOPKG_PKGVER} | cut -d '-' -f 1)
OC_OLD_VER=$(echo ${SYNOPKG_OLD_PKGVER} | cut -d '-' -f 1)

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

Expand Down

0 comments on commit 37c5640

Please sign in to comment.