From 9454ffb02c02c913100f42c80ea8a4985d19d6e0 Mon Sep 17 00:00:00 2001
From: mreid-tt <943378+mreid-tt@users.noreply.github.com>
Date: Sat, 21 Sep 2024 11:16:17 -0400
Subject: [PATCH] Use MySQL for initial setup
---
spk/owncloud/Makefile | 2 +-
spk/owncloud/src/conf/resource | 26 +-
spk/owncloud/src/conf_6/resource | 18 ++
spk/owncloud/src/service-setup.sh | 245 +++++++-----------
spk/owncloud/src/web/owncloud.json | 8 +-
.../src/wizard_templates/install_uifile.sh | 84 +++++-
.../src/wizard_templates/install_uifile.yml | 7 +
.../wizard_templates/install_uifile_fre.yml | 7 +
.../src/wizard_templates/uninstall_uifile.sh | 10 +
.../src/wizard_templates/uninstall_uifile.yml | 2 +
.../wizard_templates/uninstall_uifile_fre.yml | 2 +
.../src/wizard_templates/upgrade_uifile.sh | 61 ++++-
.../src/wizard_templates/upgrade_uifile.yml | 3 +
.../wizard_templates/upgrade_uifile_fre.yml | 3 +
14 files changed, 301 insertions(+), 177 deletions(-)
diff --git a/spk/owncloud/Makefile b/spk/owncloud/Makefile
index bb79b46e0b79..c39d9a3d5e00 100644
--- a/spk/owncloud/Makefile
+++ b/spk/owncloud/Makefile
@@ -8,7 +8,7 @@ DEPENDS = cross/owncloud
override ARCH=
REQUIRED_MIN_DSM = 6.0
-SPK_DEPENDS = WebStation:PHP7.4:Apache2.4
+SPK_DEPENDS = WebStation:PHP7.4:MariaDB10:Apache2.4:redis
MAINTAINER = SynoCommunity
DESCRIPTION = ownCloud is a personal cloud which runs on your own server and gives you freedom and control over your own data.
diff --git a/spk/owncloud/src/conf/resource b/spk/owncloud/src/conf/resource
index 4286ad3ea478..8cbf60a40b86 100644
--- a/spk/owncloud/src/conf/resource
+++ b/spk/owncloud/src/conf/resource
@@ -1,4 +1,22 @@
{
+ "mariadb10-db": {
+ "admin-account-m10": "root",
+ "admin-pw-m10": "{{wizard_mysql_password_root}}",
+ "create-db": {
+ "db-collision": "skip",
+ "db-name": "{{wizard_mysql_name_db}}",
+ "flag": "{{wizard_mysql_create_db}}"
+ },
+ "drop-db-uninst": true,
+ "drop-user-uninst": true,
+ "grant-user": {
+ "db-name": "{{wizard_mysql_name_db}}",
+ "flag": "{{wizard_mysql_grant_user}}",
+ "host": "localhost",
+ "user-name": "{{wizard_mysql_name_user}}",
+ "user-pw": "{{wizard_mysql_password_user}}"
+ }
+ },
"webservice": {
"migrate": {
"root": [{
@@ -40,17 +58,13 @@
"intl",
"ldap",
"openssl",
- "pdo_sqlite",
- "sqlite3",
+ "pdo_mysql",
+ "redis",
"ssh2",
"zip",
"zlib"
],
"group": "http",
- "php_settings": {
- "error_log": "/var/services/web_packages/owncloud/php_errors.log",
- "max_execution_time": "900"
- },
"profile_desc": "PHP Profile for ownCloud",
"profile_name": "ownCloud Profile",
"user": "sc-owncloud"
diff --git a/spk/owncloud/src/conf_6/resource b/spk/owncloud/src/conf_6/resource
index 50f4e05291f8..e842cb76c61a 100644
--- a/spk/owncloud/src/conf_6/resource
+++ b/spk/owncloud/src/conf_6/resource
@@ -1,4 +1,22 @@
{
+ "mariadb10-db": {
+ "admin-account-m10": "root",
+ "admin-pw-m10": "{{wizard_mysql_password_root}}",
+ "create-db": {
+ "db-collision": "skip",
+ "db-name": "{{wizard_mysql_name_db}}",
+ "flag": "{{wizard_mysql_create_db}}"
+ },
+ "drop-db-uninst": true,
+ "drop-user-uninst": true,
+ "grant-user": {
+ "db-name": "{{wizard_mysql_name_db}}",
+ "flag": "{{wizard_mysql_grant_user}}",
+ "host": "localhost",
+ "user-name": "{{wizard_mysql_name_user}}",
+ "user-pw": "{{wizard_mysql_password_user}}"
+ }
+ },
"data-share": {
"shares": [{
"name": "{{wizard_data_share}}",
diff --git a/spk/owncloud/src/service-setup.sh b/spk/owncloud/src/service-setup.sh
index 70ff46aa0145..3b9e6648804d 100755
--- a/spk/owncloud/src/service-setup.sh
+++ b/spk/owncloud/src/service-setup.sh
@@ -14,15 +14,25 @@ if [ -z "${SYNOPKG_PKGTMP}" ]; then
fi
# Others
+MYSQL="/usr/local/mariadb10/bin/mysql"
+MYSQLDUMP="/usr/local/mariadb10/bin/mysqldump"
+MYSQL_USER="${SYNOPKG_PKGNAME}"
+MYSQL_DATABASE="${SYNOPKG_PKGNAME}"
WEB_ROOT="${WEB_DIR}/${SYNOPKG_PKGNAME}"
SYNOSVC="/usr/syno/sbin/synoservice"
-SYNOSHR="/usr/syno/sbin/synoshare"
if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then
WEB_USER="http"
WEB_GROUP="http"
fi
+# Function to compare two version numbers
+version_greater_equal() {
+ v1=$(echo "$1" | awk -F. '{ printf "%d%03d%03d\n", $1, $2, $3 }')
+ v2=$(echo "$2" | awk -F. '{ printf "%d%03d%03d\n", $1, $2, $3 }')
+ [ "$v1" -ge "$v2" ]
+}
+
set_owncloud_permissions ()
{
if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then
@@ -64,52 +74,19 @@ exec_occ() {
return $?
}
-exec_eff_occ() {
- PHP="/usr/local/bin/php74"
- OCC="${WEB_ROOT}/occ"
- COMMAND="${PHP} ${OCC} $*"
- if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then
- # Escape backslashes for DSM 6
- ESCAPED_COMMAND=$(echo "$COMMAND" | sed 's/\\/\\\\/g')
- /bin/su "$EFF_USER" -s /bin/sh -c "$ESCAPED_COMMAND"
- else
- $COMMAND
- fi
- return $?
-}
-
-exec_sql() {
- SQLITE="/bin/sqlite3"
- COMMAND="${SQLITE} $*"
- if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then
- /bin/su "$WEB_USER" -s /bin/sh -c "$COMMAND"
- else
- $COMMAND
- fi
- return $?
-}
-
-exec_eff_sql() {
- SQLITE="/bin/sqlite3"
- COMMAND="${SQLITE} $*"
- if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then
- /bin/su "$EFF_USER" -s /bin/sh -c "$COMMAND"
- else
- $COMMAND
- fi
- return $?
-}
-
setup_owncloud_instance()
{
if [ "${SYNOPKG_PKG_STATUS}" = "INSTALL" ]; then
# Setup configuration file
exec_occ maintenance:install \
- --database "sqlite" \
+ --database "mysql" \
--database-name "${SYNOPKG_PKGNAME}" \
- --data-dir "${DATA_DIR}" \
+ --database-host "localhost:/run/mysqld/mysqld10.sock" \
+ --database-user "${wizard_mysql_name_user}" \
+ --database-pass "${wizard_mysql_password_user}" \
--admin-user "${wizard_owncloud_admin_username}" \
- --admin-pass "${wizard_owncloud_admin_password}" 2>&1
+ --admin-pass "${wizard_owncloud_admin_password}" \
+ --data-dir "${DATA_DIR}" 2>&1
# Get the trusted domains
DOMAINS="$(exec_occ config:system:get trusted_domains)"
@@ -141,7 +118,7 @@ setup_owncloud_instance()
fi
done
- # Enable HTTP Strict Transport Security in Apache configuration file
+ # Configure HTTP Strict Transport Security
APACHE_CONF="${WEB_ROOT}/.htaccess"
if [ -f "${APACHE_CONF}" ]; then
{
@@ -151,19 +128,50 @@ setup_owncloud_instance()
} >> "${APACHE_CONF}"
fi
- # Configure background jobs using cron
+ # Configure background jobs
exec_occ system:cron
# Configure memory caching
- MEMCACHE_VAL="\\OC\\Memcache\\APCu"
- exec_occ config:system:set memcache.local --value="$MEMCACHE_VAL"
+ MEMCACHE_LOCAL_VAL="\\OC\\Memcache\\APCu"
+ exec_occ config:system:set memcache.local --value="$MEMCACHE_LOCAL_VAL"
+
+ # Configure file locking
+ MEMCACHE_LOCKING_VAL="\\OC\\Memcache\\Redis"
+ exec_occ config:system:set memcache.locking --value="$MEMCACHE_LOCKING_VAL"
+ exec_occ config:system:set filelocking.enabled --value="true"
fi
}
validate_preinst ()
{
- # Check for valid backup to restore
+ # Check for modification to PHP template defaults on DSM 6
+ if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then
+ WS_TMPL_DIR="/var/packages/WebStation/target/misc"
+ WS_TMPL_FILE="php74_fpm.mustache"
+ WS_TMPL_PATH="${WS_TMPL_DIR}/${WS_TMPL_FILE}"
+ # Check for PHP template defaults
+ if ! grep -q -E '^user = http$' "${WS_TMPL_PATH}" || ! grep -q -E '^listen\.owner = http$' "${WS_TMPL_PATH}"; then
+ echo "PHP template defaults have been modified. Installation is not supported."
+ exit 1
+ fi
+ fi
+
if [ "${SYNOPKG_PKG_STATUS}" = "INSTALL" ]; then
+ # Check database
+ if ! ${MYSQL} -u root -p"${wizard_mysql_password_root}" -e quit > /dev/null 2>&1; then
+ echo "Incorrect MySQL root password"
+ exit 1
+ fi
+ if ${MYSQL} -u root -p"${wizard_mysql_password_root}" mysql -e "SELECT User FROM user" | grep ^${MYSQL_USER}$ > /dev/null 2>&1; then
+ echo "MySQL user ${MYSQL_USER} already exists"
+ exit 1
+ fi
+ if ${MYSQL} -u root -p"${wizard_mysql_password_root}" -e "SHOW DATABASES" | grep ^${MYSQL_DATABASE}$ > /dev/null 2>&1; then
+ echo "MySQL database ${MYSQL_DATABASE} already exists"
+ exit 1
+ fi
+
+ # Check for valid backup to restore
if [ "${wizard_owncloud_restore}" = "true" ] && [ -n "${wizard_backup_file}" ]; then
if [ ! -f "${wizard_backup_file}" ]; then
echo "The backup file path specified is incorrect or not accessible."
@@ -177,6 +185,13 @@ validate_preinst ()
echo "The backup filename does not start with the expected prefix."
exit 1
fi
+ # Check the minimum required version
+ backup_version=$(echo "$filename" | sed -n "s/${expected_prefix}\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p")
+ min_version="10.15.0"
+ if ! version_greater_equal "$backup_version" "$min_version"; then
+ echo "The backup version is too old. Minimum required version is $min_version."
+ exit 1
+ fi
fi
fi
}
@@ -247,17 +262,17 @@ service_postinst ()
${RM} ${TEMPDIR}
fi
+ # Fix permissions
+ if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then
+ set_owncloud_permissions ${WEB_ROOT}
+ fi
+
if [ "${SYNOPKG_PKG_STATUS}" = "INSTALL" ]; then
# Parse data directory
DATA_DIR="${SHARE_PATH}/data"
# Create data directory
${MKDIR} "${DATA_DIR}"
- # Fix permissions
- if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then
- set_owncloud_permissions ${WEB_ROOT} ${DATA_DIR}
- fi
-
# Check restore action
if [ "${wizard_owncloud_restore}" = "true" ]; then
echo "The backup file is valid, performing restore."
@@ -278,12 +293,15 @@ service_postinst ()
echo "Restoring user data to ${DATA_DIR}"
rsync -aX -I "${TEMPDIR}/data" "${SHARE_PATH}/" 2>&1
+ # Update database password
+ sed -i "s/'dbpassword' => '.*'/'dbpassword' => '${wizard_mysql_password_user}'/" "${WEB_ROOT}/config/config.php"
+
# Place server in maintenance mode
exec_occ maintenance:mode --on
# Restore the Database
- [ -f "${DATA_DIR}/${SYNOPKG_PKGNAME}.db" ] && ${RM} "${DATA_DIR}/${SYNOPKG_PKGNAME}.db"
- exec_sql "${DATA_DIR}/${SYNOPKG_PKGNAME}.db" < "${TEMPDIR}/database/${SYNOPKG_PKGNAME}-dbbackup.bak" 2>&1
+ echo "Restoring database to ${MYSQL_DATABASE}"
+ ${MYSQL} -u root -p"${wizard_mysql_password_root}" ${MYSQL_DATABASE} < ${TEMPDIR}/database/${MYSQL_DATABASE}-dbbackup.sql 2>&1
# Update the systems data-fingerprint after a backup is restored
exec_occ maintenance:data-fingerprint -n
@@ -296,10 +314,10 @@ service_postinst ()
expected_prefix="${SYNOPKG_PKGNAME}_backup_v"
# Extract the version number using awk and cut
file_version=$(echo "$filename" | awk -F "${expected_prefix}" '{print $2}' | cut -d '_' -f 1)
- package_version=$(echo ${SYNOPKG_PKGVER} | cut -d '-' -f 1)
+ package_version=$(echo "${SYNOPKG_PKGVER}" | cut -d '-' -f 1)
+ # Compare the extracted version with package_version using the version_greater_equal function
if [ -n "$file_version" ]; then
- # Compare the extracted version with package_version using awk
- if awk "BEGIN {exit !($file_version < $package_version) }"; then
+ if ! version_greater_equal "$file_version" "$package_version"; then
echo "The archive version ($file_version) is older than the package version ($package_version). Triggering upgrade."
exec_occ upgrade
fi
@@ -320,6 +338,11 @@ service_postinst ()
validate_preuninst ()
{
+ # Check database
+ if [ "${SYNOPKG_PKG_STATUS}" = "UNINSTALL" ] && ! ${MYSQL} -u root -p"${wizard_mysql_password_root}" -e quit > /dev/null 2>&1; then
+ echo "Incorrect MySQL root password"
+ exit 1
+ fi
# Check export directory
if [ "${SYNOPKG_PKG_STATUS}" = "UNINSTALL" ] && [ -n "${wizard_export_path}" ]; then
if [ ! -d "${wizard_export_path}" ]; then
@@ -357,9 +380,9 @@ service_preuninst ()
exec_occ maintenance:mode --on
# Backup the Database
- echo "Copying previous database from ${DATADIR}"
+ echo "Copying previous database from ${MYSQL_DATABASE}"
${MKDIR} "${TEMPDIR}/database"
- exec_sql "${DATADIR}/${SYNOPKG_PKGNAME}.db" .dump > "${TEMPDIR}/database/${SYNOPKG_PKGNAME}-dbbackup.bak" 2>&1
+ ${MYSQLDUMP} -u root -p"${wizard_mysql_password_root}" ${MYSQL_DATABASE} > ${TEMPDIR}/database/${MYSQL_DATABASE}-dbbackup.sql 2>&1
# Backup Directories
echo "Copying previous configuration from ${WEB_ROOT}"
@@ -435,44 +458,6 @@ service_postuninst ()
fi
}
-service_postupgrade()
-{
- # Web interface validation for DSM 6 -- Check PHP template defaults for modification
- if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then
- TEMPDIR="${SYNOPKG_PKGTMP}/web"
- ${MKDIR} ${TEMPDIR}
- WS_CFG_DIR="/usr/syno/etc/packages/WebStation"
- PHP_CFG_FILE="PHPSettings.json"
- PHP_CFG_PATH="${WS_CFG_DIR}/${PHP_CFG_FILE}"
- WS_TMPL_DIR="/var/packages/WebStation/target/misc"
- WS_TMPL_FILE="php74_fpm.mustache"
- WS_TMPL_PATH="${WS_TMPL_DIR}/${WS_TMPL_FILE}"
- TMP_WS_TMPL_PATH="${TEMPDIR}/${WS_TMPL_FILE}"
- RESTART_APACHE="no"
- RSYNC_ARCH_ARGS="--backup --suffix=.bak --remove-source-files"
- # Check for PHP template defaults
- if ! grep -q -E '^user = http$' "${WS_TMPL_PATH}" || ! grep -q -E '^listen\.owner = http$' "${WS_TMPL_PATH}"; then
- echo "Restore default PHP template; remove previous PHP FPM configuration"
- rsync -aX ${WS_TMPL_PATH} ${TEMPDIR}/ 2>&1
- SUBST_TEXT="{{#fpm_settings.user_owncloud}}sc-owncloud{{/fpm_settings.user_owncloud}}{{^fpm_settings.user_owncloud}}http{{/fpm_settings.user_owncloud}}"
- sed -i "s|^user = ${SUBST_TEXT}$|user = http|g; s|^listen.owner = ${SUBST_TEXT}$|listen.owner = http|g" "${TMP_WS_TMPL_PATH}"
- rsync -aX ${RSYNC_ARCH_ARGS} ${TMP_WS_TMPL_PATH} ${WS_TMPL_DIR}/ 2>&1
- RESTART_APACHE="yes"
- fi
- # Restart Apache if configs have changed
- if [ "$RESTART_APACHE" = "yes" ]; then
- if jq -e 'to_entries | map(select((.key | startswith("'"${SC_PKG_PREFIX}"'")) and .key != "'"${SC_PKG_NAME}"'")) | length > 0' "${PHP_CFG_PATH}" >/dev/null; then
- echo " [WARNING] Multiple PHP profiles detected, will require restart of DSM to load new configs"
- else
- echo "Restart Apache to load new configs"
- ${SYNOSVC} --restart pkgctl-Apache2.4
- fi
- fi
- # Clean-up temporary files
- ${RM} ${TEMPDIR}
- fi
-}
-
validate_preupgrade ()
{
# ownCloud upgrades only possible from 8.2.11, 9.0.9, 9.1.X, or 10.X.Y
@@ -492,36 +477,22 @@ validate_preupgrade ()
echo "Please uninstall previous version, no update possible from v${SYNOPKG_OLD_PKGVER}.
Remember to save your ${WEB_ROOT}/data files before uninstalling."
exit 1
fi
+
+ # ownCloud upgrades only possible from mySQL instances
+ DATABASE_TYPE="$(exec_occ config:system:get dbtype)"
+ if [ "$DATABASE_TYPE" != "mysql" ]; then
+ echo "Please migrate your previous database from ${DATABASE_TYPE} to mysql before performing upgrade."
+ exit 1
+ fi
}
service_save ()
{
- # Initialise save state check for migration of PHP FPM configuration on DSM 6
- NORMAL_SAVE="yes"
- if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then
- # Check for modification to PHP template defaults from previous versions
- WS_TMPL_DIR="/var/packages/WebStation/target/misc"
- WS_TMPL_FILE="php74_fpm.mustache"
- WS_TMPL_PATH="${WS_TMPL_DIR}/${WS_TMPL_FILE}"
- # Check for PHP template defaults
- if ! grep -q -E '^user = http$' "${WS_TMPL_PATH}" || ! grep -q -E '^listen\.owner = http$' "${WS_TMPL_PATH}"; then
- NORMAL_SAVE="no"
- fi
- fi
-
# Place server in maintenance mode
- if [ "$NORMAL_SAVE" = "yes" ]; then
- exec_occ maintenance:mode --on
- else
- exec_eff_occ maintenance:mode --on
- fi
+ exec_occ maintenance:mode --on
# Identify data directory for restore
- if [ "$NORMAL_SAVE" = "yes" ]; then
- DATADIR="$(exec_occ config:system:get datadirectory)"
- else
- DATADIR="$(exec_eff_occ config:system:get datadirectory)"
- fi
+ DATADIR="$(exec_occ config:system:get datadirectory)"
# data directory fail-safe
if [ ! -d "$DATADIR" ]; then
echo "Invalid data directory '$DATADIR'. Using the default data directory instead."
@@ -539,25 +510,6 @@ service_save ()
echo "Backup existing distribution to ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}"
${MKDIR} ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}
rsync -aX ${WEB_ROOT}/ ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME} 2>&1
-
- # Backup server database
- [ -d ${SYNOPKG_TEMP_UPGRADE_FOLDER}/db_backup ] && ${RM} ${SYNOPKG_TEMP_UPGRADE_FOLDER}/db_backup
- echo "Backup existing server database to ${SYNOPKG_TEMP_UPGRADE_FOLDER}/db_backup"
- ${MKDIR} ${SYNOPKG_TEMP_UPGRADE_FOLDER}/db_backup
- if [ "$NORMAL_SAVE" = "yes" ]; then
- exec_sql "${DATADIR}/${SYNOPKG_PKGNAME}.db" .dump > "${SYNOPKG_TEMP_UPGRADE_FOLDER}/db_backup/${SYNOPKG_PKGNAME}-dbbackup_$(date +"%Y%m%d").bak" 2>&1
- else
- exec_eff_sql "${DATADIR}/${SYNOPKG_PKGNAME}.db" .dump > "${SYNOPKG_TEMP_UPGRADE_FOLDER}/db_backup/${SYNOPKG_PKGNAME}-dbbackup_$(date +"%Y%m%d").bak" 2>&1
- fi
-
- # Fix file ownership
- if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ] && [ "$NORMAL_SAVE" != "yes" ]; then
- echo "Migrate share permissions to user ${WEB_USER}"
- ${SYNOSHR} --setuser ${SHARE_NAME} RW + ${WEB_USER} >/dev/null 2>&1
- chown -R ${WEB_USER}:${WEB_GROUP} ${SYNOPKG_TEMP_UPGRADE_FOLDER} 2>/dev/null
- chown -R ${WEB_USER}:${WEB_GROUP} ${DATADIR} 2>/dev/null
- ${SYNOSHR} --setuser ${SHARE_NAME} RW - ${EFF_USER} >/dev/null 2>&1
- fi
}
service_restore ()
@@ -635,25 +587,6 @@ service_restore ()
DATADIR="${WEB_ROOT}/data"
fi
- # Archive backup server database
- echo "Archive backup server database to ${DATADIR}"
- if [ -d ${SYNOPKG_TEMP_UPGRADE_FOLDER}/db_backup ]; then
- if [ -d ${DATADIR}/db_backup ]; then
- i=1
- while [ -d "${DATADIR}/db_backup.${i}" ]; do
- i=$((i+1))
- done
- while [ $i -gt 1 ]; do
- j=$((i-1))
- ${MV} "${DATADIR}/db_backup.${j}" "${DATADIR}/db_backup.${i}"
- i=$j
- done
- ${MV} "${DATADIR}/db_backup" "${DATADIR}/db_backup.1"
- fi
- rsync -aX ${SYNOPKG_TEMP_UPGRADE_FOLDER}/db_backup ${DATADIR}/ 2>&1
- fi
-
# Remove upgrade backup files
${RM} ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}
- ${RM} ${SYNOPKG_TEMP_UPGRADE_FOLDER}/db_backup
}
diff --git a/spk/owncloud/src/web/owncloud.json b/spk/owncloud/src/web/owncloud.json
index b67025f8451a..27a3f43ee0d0 100644
--- a/spk/owncloud/src/web/owncloud.json
+++ b/spk/owncloud/src/web/owncloud.json
@@ -16,8 +16,8 @@
"intl",
"ldap",
"openssl",
- "pdo_sqlite",
- "sqlite3",
+ "pdo_mysql",
+ "redis",
"ssh2",
"zip",
"zlib"
@@ -30,10 +30,6 @@
"start_servers": 2
},
"open_basedir": "",
- "php_settings": {
- "error_log": "/var/services/web/owncloud/php_errors.log",
- "max_execution_time": "900"
- },
"profile_desc": "PHP Profile for ownCloud",
"profile_name": "ownCloud Profile"
}
diff --git a/spk/owncloud/src/wizard_templates/install_uifile.sh b/spk/owncloud/src/wizard_templates/install_uifile.sh
index 3c924728a4cb..112aa0e010b5 100644
--- a/spk/owncloud/src/wizard_templates/install_uifile.sh
+++ b/spk/owncloud/src/wizard_templates/install_uifile.sh
@@ -25,6 +25,7 @@ page_append ()
RESTORE_BACKUP_FILE="wizard_owncloud_restore"
BACKUP_FILE_PATH="wizard_backup_file"
RESTORE_ERROR_TEXT="{{{OWNCLOUD_BACKUP_FILE_VALIDATION_ERROR_TEXT}}}"
+SHARE_ERROR_TEXT="{{{OWNCLOUD_DATA_DIRECTORY_VALIDATION_ERROR_TEXT}}}"
checkBackupRestore()
{
@@ -86,6 +87,22 @@ jsFunction=$(/bin/cat<WARNING: Uninstalling the ownCloud package will result in the removal of the ownCloud server, along with all associated user accounts, data, and configurations."
+MYSQL_ROOT_PASSWORD_DESCRIPTION: "Enter your MySQL password"
+MYSQL_ROOT_PASSWORD_LABEL: "Root password"
OWNCLOUD_BACKUP_EXPORT_LOCATION_DESCRIPTION: "Before uninstalling, if you want to keep a backup of your data, please specify the directory where you would like to export to. Ensure that the user 'sc-owncloud' has write permissions to that directory. To skip exporting, leave this field blank."
OWNCLOUD_BACKUP_EXPORT_LOCATION_LABEL: "Export location"
diff --git a/spk/owncloud/src/wizard_templates/uninstall_uifile_fre.yml b/spk/owncloud/src/wizard_templates/uninstall_uifile_fre.yml
index 91bf55d574a6..32cdaad2d4ea 100644
--- a/spk/owncloud/src/wizard_templates/uninstall_uifile_fre.yml
+++ b/spk/owncloud/src/wizard_templates/uninstall_uifile_fre.yml
@@ -2,5 +2,7 @@ OWNCLOUD_PATH_VALIDATION_ERROR_TEXT: "Le chemin doit commencer par /volume?/ ave
OWNCLOUD_BACKUP_SERVER_STEP_TITLE: "Sauvegarder le serveur ownCloud"
OWNCLOUD_BACKUP_SERVER_DESCRIPTION: "AVERTISSEMENT: La désinstallation du package ownCloud entraînera la suppression du serveur ownCloud, ainsi que de tous les comptes d'utilisateurs, données et configurations associés."
+MYSQL_ROOT_PASSWORD_DESCRIPTION: "Entrez votre mot de passe MySQL"
+MYSQL_ROOT_PASSWORD_LABEL: "Mot de passe root"
OWNCLOUD_BACKUP_EXPORT_LOCATION_DESCRIPTION: "Avant la désinstallation, si vous souhaitez conserver une sauvegarde de vos données, veuillez spécifier le répertoire vers lequel vous souhaitez exporter. Assurez-vous que l'utilisateur 'sc-owncloud' dispose des autorisations d'écriture dans ce répertoire. Pour ignorer l'exportation, laissez ce champ vide."
OWNCLOUD_BACKUP_EXPORT_LOCATION_LABEL: "Emplacement d'exportation"
diff --git a/spk/owncloud/src/wizard_templates/upgrade_uifile.sh b/spk/owncloud/src/wizard_templates/upgrade_uifile.sh
index e661036f9bd5..7a63d3d30cb4 100644
--- a/spk/owncloud/src/wizard_templates/upgrade_uifile.sh
+++ b/spk/owncloud/src/wizard_templates/upgrade_uifile.sh
@@ -3,6 +3,13 @@
OC_NEW_VER=$(echo "${SYNOPKG_PKGVER}" | cut -d '-' -f 1)
OC_OLD_VER=$(echo "${SYNOPKG_OLD_PKGVER}" | cut -d '-' -f 1)
+WEB_DIR="/var/services/web_packages"
+# for backwards compatability
+if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -lt 7 ];then
+ WEB_DIR="/var/services/web"
+fi
+WEB_ROOT="${WEB_DIR}/${SYNOPKG_PKGNAME}"
+
quote_json ()
{
sed -e 's|\\|\\\\|g' -e 's|\"|\\\"|g'
@@ -32,6 +39,21 @@ is_upgrade_possible ()
return 1 # Failure or false
}
+is_database_mysql ()
+{
+ config_file="${WEB_ROOT}/config/config.php"
+ if [ -f "$config_file" ] && grep -q "'dbtype' => 'mysql'" "$config_file"; then
+ return 0 # Database type is MySQL
+ else
+ return 1 # Database type is not MySQL
+ fi
+}
+
+getUpgradeLimitations()
+{
+ echo "$TEXT_LIMITATIONS" | quote_json
+}
+
PAGE_NO_UPDATE=$(/bin/cat<
@@ -74,7 +114,18 @@ PAGE_LIMITATIONS=$(/bin/cat< "${SYNOPKG_TEMP_LOGFILE}"
}
diff --git a/spk/owncloud/src/wizard_templates/upgrade_uifile.yml b/spk/owncloud/src/wizard_templates/upgrade_uifile.yml
index 3bd95ce6b513..c9796e445b7a 100644
--- a/spk/owncloud/src/wizard_templates/upgrade_uifile.yml
+++ b/spk/owncloud/src/wizard_templates/upgrade_uifile.yml
@@ -1,6 +1,9 @@
OWNCLOUD_INCOMPATIBLE_UPGRADE_STEP_TITLE: "Incompatible upgrade"
OWNCLOUD_INCOMPATIBLE_UPGRADE_DESCRIPTION: "NOTICE: Version ${OC_OLD_VER} of ownCloud cannot be updated to version ${OC_NEW_VER}. Please uninstall the previous version and remember to save your ${OCROOT}/data
files before doing so."
+OWNCLOUD_MIGRATE_DATABASE_STEP_TITLE: "Migrate database to MySQL"
+OWNCLOUD_MIGRATE_DATABASE_DESCRIPTION: "NOTICE: The upgrade process only supports MySQL databases. Please migrate your current database to MySQL before proceeding with the upgrade, and then try again."
+
OWNCLOUD_UPGRADE_LIMITATIONS_STEP_TITLE: "Upgrade limitations"
OWNCLOUD_UPGRADE_LIMITATIONS_DESCRIPTION: "Please note the following limitations when upgrading the ownCloud package:"
OWNCLOUD_UPGRADE_LIMITATION_1_TEXT: "Cron jobs cannot be managed during the upgrade process. We recommend that you disable them manually before upgrading."
diff --git a/spk/owncloud/src/wizard_templates/upgrade_uifile_fre.yml b/spk/owncloud/src/wizard_templates/upgrade_uifile_fre.yml
index b4d65e233a93..93956a5b99f9 100644
--- a/spk/owncloud/src/wizard_templates/upgrade_uifile_fre.yml
+++ b/spk/owncloud/src/wizard_templates/upgrade_uifile_fre.yml
@@ -1,6 +1,9 @@
OWNCLOUD_INCOMPATIBLE_UPGRADE_STEP_TITLE: "Mise à jour incompatible"
OWNCLOUD_INCOMPATIBLE_UPGRADE_DESCRIPTION: "AVIS: La version ${OC_OLD_VER} de ownCloud ne peut pas être mise à jour vers la version ${OC_NEW_VER}. Veuillez désinstaller la version précédente et n'oubliez pas de sauvegarder vos fichiers ${OCROOT}/data
avant de le faire."
+OWNCLOUD_MIGRATE_DATABASE_STEP_TITLE: "Migrer la base de données vers MySQL"
+OWNCLOUD_MIGRATE_DATABASE_DESCRIPTION: "AVIS: le processus de mise à niveau ne prend en charge que les bases de données MySQL. Veuillez migrer votre base de données actuelle vers MySQL avant de procéder à la mise à niveau, puis réessayez."
+
OWNCLOUD_UPGRADE_LIMITATIONS_STEP_TITLE: "Limitations de la mise à niveau"
OWNCLOUD_UPGRADE_LIMITATIONS_DESCRIPTION: "Veuillez noter les limitations suivantes lors de la mise à jour du package ownCloud:"
OWNCLOUD_UPGRADE_LIMITATION_1_TEXT: "Les tâches cron ne peuvent pas être gérées pendant le processus de mise à niveau. Nous vous recommandons de les désactiver manuellement avant la mise à niveau."