Browse Source

Maintenance: explicitly expect zammad user and exit if not found

As the restoration script expects specific users and all package installation and source code documentation is talking about "zammad" as a user, we expect this user to be present.

If needed users that want to use different user names may have to adjust the scripts. This still should cover over 90% of Zammad installations.

This is a preparation commit for Issue #3139.
MrGeneration 4 years ago
parent
commit
b1e75841f4
1 changed files with 8 additions and 0 deletions
  1. 8 0
      contrib/backup/functions

+ 8 - 0
contrib/backup/functions

@@ -159,6 +159,14 @@ function restore_zammad () {
   fi
   fi
 
 
   if [ "${DB_ADAPTER}" == "postgresql" ]; then
   if [ "${DB_ADAPTER}" == "postgresql" ]; then
+    echo "# Checking requirements"
+
+    if ! id "zammad" &> /dev/null; then
+      echo "# ERROR: User 'zammad' is not present, but should be by default! #"
+      echo "# Restoration was NOT successfull, exitting ..."
+      exit 1
+    fi
+    
     echo "# ... Dropping current database ${DB_NAME}"
     echo "# ... Dropping current database ${DB_NAME}"
 
 
     # This step is only needed for some pgsql dumps, as they don't provide a drop table statement which will cause
     # This step is only needed for some pgsql dumps, as they don't provide a drop table statement which will cause