summaryrefslogtreecommitdiff
path: root/www-apps/phpBB/files/permissions
diff options
context:
space:
mode:
Diffstat (limited to 'www-apps/phpBB/files/permissions')
-rwxr-xr-xwww-apps/phpBB/files/permissions19
1 files changed, 19 insertions, 0 deletions
diff --git a/www-apps/phpBB/files/permissions b/www-apps/phpBB/files/permissions
new file mode 100755
index 000000000000..b5c21c879eb1
--- /dev/null
+++ b/www-apps/phpBB/files/permissions
@@ -0,0 +1,19 @@
+#!/bin/bash -e
+
+if [[ $1 = install ]]; then
+ # Ensure database credentials are not world-readable.
+ chmod -v o= "${MY_INSTALLDIR}"/config.php
+
+ # These paths need to be writeable by the PHP user.
+ PATHS=( "${MY_INSTALLDIR}"/{cache/,config.php,download/,files/,store/,images/avatars/upload/} )
+
+ # Assume the PHP user is in the config group.
+ GID=${VHOST_CONFIG_GID}
+
+ # If that group is root, assume the web server group instead.
+ [[ ${GID} = 0 || ${GID} = root ]] && GID=${VHOST_SERVER_GID}
+
+ # Make the paths writeable by that group.
+ chgrp -v "${GID}" "${PATHS[@]}"
+ chmod -v g+w "${PATHS[@]}"
+fi