Runs update.sh

pull/2549/head
GitHub Workflow 5 months ago
parent 28bb4d1610
commit 725e8f2f11

@ -83,42 +83,19 @@ file_env() {
unset "$fileVar" unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then # Write PHP session config for Redis to /usr/local/etc/php/conf.d/redis-session.ini
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then configure_redis_session() {
a2disconf remoteip echo "=> Configuring PHP session handler..."
fi if [ -z "${REDIS_HOST:-}" ]; then
fi echo "==> Using default PHP session handler"
return 0
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
user="${user#'#'}"
group="${group#'#'}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi fi
if [ -n "${REDIS_HOST+x}" ]; then echo "==> Using Redis as PHP session handler..."
echo "Configuring Redis as session handler"
{ {
file_env REDIS_HOST_PASSWORD file_env REDIS_HOST_PASSWORD
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
# check if redis host is an unix socket path # check if redis host is a unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then if [ -n "${REDIS_HOST_USER+x}" ]; then
@ -145,8 +122,43 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# Wait 10ms before retrying the lock rather than the default 2ms. # Wait 10ms before retrying the lock rather than the default 2ms.
echo "redis.session.lock_wait_time = 10000" echo "redis.session.lock_wait_time = 10000"
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
}
########################################################################
# Main
########################################################################
if expr "$1" : "apache" 1>/dev/null; then
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
a2disconf remoteip
fi
fi
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
user="${user#'#'}"
group="${group#'#'}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi fi
configure_redis_session
# If another process is syncing the html folder, wait for # If another process is syncing the html folder, wait for
# it to be done, then escape initalization. # it to be done, then escape initalization.
( (

@ -83,42 +83,19 @@ file_env() {
unset "$fileVar" unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then # Write PHP session config for Redis to /usr/local/etc/php/conf.d/redis-session.ini
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then configure_redis_session() {
a2disconf remoteip echo "=> Configuring PHP session handler..."
fi if [ -z "${REDIS_HOST:-}" ]; then
fi echo "==> Using default PHP session handler"
return 0
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
user="${user#'#'}"
group="${group#'#'}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi fi
if [ -n "${REDIS_HOST+x}" ]; then echo "==> Using Redis as PHP session handler..."
echo "Configuring Redis as session handler"
{ {
file_env REDIS_HOST_PASSWORD file_env REDIS_HOST_PASSWORD
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
# check if redis host is an unix socket path # check if redis host is a unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then if [ -n "${REDIS_HOST_USER+x}" ]; then
@ -145,8 +122,43 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# Wait 10ms before retrying the lock rather than the default 2ms. # Wait 10ms before retrying the lock rather than the default 2ms.
echo "redis.session.lock_wait_time = 10000" echo "redis.session.lock_wait_time = 10000"
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
}
########################################################################
# Main
########################################################################
if expr "$1" : "apache" 1>/dev/null; then
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
a2disconf remoteip
fi
fi
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
user="${user#'#'}"
group="${group#'#'}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi fi
configure_redis_session
# If another process is syncing the html folder, wait for # If another process is syncing the html folder, wait for
# it to be done, then escape initalization. # it to be done, then escape initalization.
( (

@ -83,42 +83,19 @@ file_env() {
unset "$fileVar" unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then # Write PHP session config for Redis to /usr/local/etc/php/conf.d/redis-session.ini
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then configure_redis_session() {
a2disconf remoteip echo "=> Configuring PHP session handler..."
fi if [ -z "${REDIS_HOST:-}" ]; then
fi echo "==> Using default PHP session handler"
return 0
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
user="${user#'#'}"
group="${group#'#'}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi fi
if [ -n "${REDIS_HOST+x}" ]; then echo "==> Using Redis as PHP session handler..."
echo "Configuring Redis as session handler"
{ {
file_env REDIS_HOST_PASSWORD file_env REDIS_HOST_PASSWORD
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
# check if redis host is an unix socket path # check if redis host is a unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then if [ -n "${REDIS_HOST_USER+x}" ]; then
@ -145,8 +122,43 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# Wait 10ms before retrying the lock rather than the default 2ms. # Wait 10ms before retrying the lock rather than the default 2ms.
echo "redis.session.lock_wait_time = 10000" echo "redis.session.lock_wait_time = 10000"
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
}
########################################################################
# Main
########################################################################
if expr "$1" : "apache" 1>/dev/null; then
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
a2disconf remoteip
fi
fi
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
user="${user#'#'}"
group="${group#'#'}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi fi
configure_redis_session
# If another process is syncing the html folder, wait for # If another process is syncing the html folder, wait for
# it to be done, then escape initalization. # it to be done, then escape initalization.
( (

@ -83,42 +83,19 @@ file_env() {
unset "$fileVar" unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then # Write PHP session config for Redis to /usr/local/etc/php/conf.d/redis-session.ini
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then configure_redis_session() {
a2disconf remoteip echo "=> Configuring PHP session handler..."
fi if [ -z "${REDIS_HOST:-}" ]; then
fi echo "==> Using default PHP session handler"
return 0
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
user="${user#'#'}"
group="${group#'#'}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi fi
if [ -n "${REDIS_HOST+x}" ]; then echo "==> Using Redis as PHP session handler..."
echo "Configuring Redis as session handler"
{ {
file_env REDIS_HOST_PASSWORD file_env REDIS_HOST_PASSWORD
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
# check if redis host is an unix socket path # check if redis host is a unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then if [ -n "${REDIS_HOST_USER+x}" ]; then
@ -145,8 +122,43 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# Wait 10ms before retrying the lock rather than the default 2ms. # Wait 10ms before retrying the lock rather than the default 2ms.
echo "redis.session.lock_wait_time = 10000" echo "redis.session.lock_wait_time = 10000"
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
}
########################################################################
# Main
########################################################################
if expr "$1" : "apache" 1>/dev/null; then
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
a2disconf remoteip
fi
fi
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
user="${user#'#'}"
group="${group#'#'}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi fi
configure_redis_session
# If another process is syncing the html folder, wait for # If another process is syncing the html folder, wait for
# it to be done, then escape initalization. # it to be done, then escape initalization.
( (

@ -83,42 +83,19 @@ file_env() {
unset "$fileVar" unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then # Write PHP session config for Redis to /usr/local/etc/php/conf.d/redis-session.ini
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then configure_redis_session() {
a2disconf remoteip echo "=> Configuring PHP session handler..."
fi if [ -z "${REDIS_HOST:-}" ]; then
fi echo "==> Using default PHP session handler"
return 0
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
user="${user#'#'}"
group="${group#'#'}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi fi
if [ -n "${REDIS_HOST+x}" ]; then echo "==> Using Redis as PHP session handler..."
echo "Configuring Redis as session handler"
{ {
file_env REDIS_HOST_PASSWORD file_env REDIS_HOST_PASSWORD
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
# check if redis host is an unix socket path # check if redis host is a unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then if [ -n "${REDIS_HOST_USER+x}" ]; then
@ -145,8 +122,43 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# Wait 10ms before retrying the lock rather than the default 2ms. # Wait 10ms before retrying the lock rather than the default 2ms.
echo "redis.session.lock_wait_time = 10000" echo "redis.session.lock_wait_time = 10000"
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
}
########################################################################
# Main
########################################################################
if expr "$1" : "apache" 1>/dev/null; then
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
a2disconf remoteip
fi
fi
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
user="${user#'#'}"
group="${group#'#'}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi fi
configure_redis_session
# If another process is syncing the html folder, wait for # If another process is syncing the html folder, wait for
# it to be done, then escape initalization. # it to be done, then escape initalization.
( (

@ -83,42 +83,19 @@ file_env() {
unset "$fileVar" unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then # Write PHP session config for Redis to /usr/local/etc/php/conf.d/redis-session.ini
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then configure_redis_session() {
a2disconf remoteip echo "=> Configuring PHP session handler..."
fi if [ -z "${REDIS_HOST:-}" ]; then
fi echo "==> Using default PHP session handler"
return 0
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
user="${user#'#'}"
group="${group#'#'}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi fi
if [ -n "${REDIS_HOST+x}" ]; then echo "==> Using Redis as PHP session handler..."
echo "Configuring Redis as session handler"
{ {
file_env REDIS_HOST_PASSWORD file_env REDIS_HOST_PASSWORD
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
# check if redis host is an unix socket path # check if redis host is a unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then if [ -n "${REDIS_HOST_USER+x}" ]; then
@ -145,8 +122,43 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# Wait 10ms before retrying the lock rather than the default 2ms. # Wait 10ms before retrying the lock rather than the default 2ms.
echo "redis.session.lock_wait_time = 10000" echo "redis.session.lock_wait_time = 10000"
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
}
########################################################################
# Main
########################################################################
if expr "$1" : "apache" 1>/dev/null; then
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
a2disconf remoteip
fi
fi
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
user="${user#'#'}"
group="${group#'#'}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi fi
configure_redis_session
# If another process is syncing the html folder, wait for # If another process is syncing the html folder, wait for
# it to be done, then escape initalization. # it to be done, then escape initalization.
( (

@ -83,42 +83,19 @@ file_env() {
unset "$fileVar" unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then # Write PHP session config for Redis to /usr/local/etc/php/conf.d/redis-session.ini
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then configure_redis_session() {
a2disconf remoteip echo "=> Configuring PHP session handler..."
fi if [ -z "${REDIS_HOST:-}" ]; then
fi echo "==> Using default PHP session handler"
return 0
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
user="${user#'#'}"
group="${group#'#'}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi fi
if [ -n "${REDIS_HOST+x}" ]; then echo "==> Using Redis as PHP session handler..."
echo "Configuring Redis as session handler"
{ {
file_env REDIS_HOST_PASSWORD file_env REDIS_HOST_PASSWORD
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
# check if redis host is an unix socket path # check if redis host is a unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then if [ -n "${REDIS_HOST_USER+x}" ]; then
@ -145,8 +122,43 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# Wait 10ms before retrying the lock rather than the default 2ms. # Wait 10ms before retrying the lock rather than the default 2ms.
echo "redis.session.lock_wait_time = 10000" echo "redis.session.lock_wait_time = 10000"
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
}
########################################################################
# Main
########################################################################
if expr "$1" : "apache" 1>/dev/null; then
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
a2disconf remoteip
fi
fi
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
user="${user#'#'}"
group="${group#'#'}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi fi
configure_redis_session
# If another process is syncing the html folder, wait for # If another process is syncing the html folder, wait for
# it to be done, then escape initalization. # it to be done, then escape initalization.
( (

@ -83,42 +83,19 @@ file_env() {
unset "$fileVar" unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then # Write PHP session config for Redis to /usr/local/etc/php/conf.d/redis-session.ini
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then configure_redis_session() {
a2disconf remoteip echo "=> Configuring PHP session handler..."
fi if [ -z "${REDIS_HOST:-}" ]; then
fi echo "==> Using default PHP session handler"
return 0
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
user="${user#'#'}"
group="${group#'#'}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi fi
if [ -n "${REDIS_HOST+x}" ]; then echo "==> Using Redis as PHP session handler..."
echo "Configuring Redis as session handler"
{ {
file_env REDIS_HOST_PASSWORD file_env REDIS_HOST_PASSWORD
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
# check if redis host is an unix socket path # check if redis host is a unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then if [ -n "${REDIS_HOST_USER+x}" ]; then
@ -145,8 +122,43 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# Wait 10ms before retrying the lock rather than the default 2ms. # Wait 10ms before retrying the lock rather than the default 2ms.
echo "redis.session.lock_wait_time = 10000" echo "redis.session.lock_wait_time = 10000"
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
}
########################################################################
# Main
########################################################################
if expr "$1" : "apache" 1>/dev/null; then
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
a2disconf remoteip
fi
fi
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
user="${user#'#'}"
group="${group#'#'}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi fi
configure_redis_session
# If another process is syncing the html folder, wait for # If another process is syncing the html folder, wait for
# it to be done, then escape initalization. # it to be done, then escape initalization.
( (

@ -83,42 +83,19 @@ file_env() {
unset "$fileVar" unset "$fileVar"
} }
if expr "$1" : "apache" 1>/dev/null; then # Write PHP session config for Redis to /usr/local/etc/php/conf.d/redis-session.ini
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then configure_redis_session() {
a2disconf remoteip echo "=> Configuring PHP session handler..."
fi if [ -z "${REDIS_HOST:-}" ]; then
fi echo "==> Using default PHP session handler"
return 0
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
user="${user#'#'}"
group="${group#'#'}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi fi
if [ -n "${REDIS_HOST+x}" ]; then echo "==> Using Redis as PHP session handler..."
echo "Configuring Redis as session handler"
{ {
file_env REDIS_HOST_PASSWORD file_env REDIS_HOST_PASSWORD
echo 'session.save_handler = redis' echo 'session.save_handler = redis'
# check if redis host is an unix socket path # check if redis host is a unix socket path
if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then if [ "$(echo "$REDIS_HOST" | cut -c1-1)" = "/" ]; then
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
if [ -n "${REDIS_HOST_USER+x}" ]; then if [ -n "${REDIS_HOST_USER+x}" ]; then
@ -145,8 +122,43 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# Wait 10ms before retrying the lock rather than the default 2ms. # Wait 10ms before retrying the lock rather than the default 2ms.
echo "redis.session.lock_wait_time = 10000" echo "redis.session.lock_wait_time = 10000"
} > /usr/local/etc/php/conf.d/redis-session.ini } > /usr/local/etc/php/conf.d/redis-session.ini
}
########################################################################
# Main
########################################################################
if expr "$1" : "apache" 1>/dev/null; then
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
a2disconf remoteip
fi
fi
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UPDATE:-0}" -eq 1 ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
user="${user#'#'}"
group="${group#'#'}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi fi
configure_redis_session
# If another process is syncing the html folder, wait for # If another process is syncing the html folder, wait for
# it to be done, then escape initalization. # it to be done, then escape initalization.
( (

Loading…
Cancel
Save