Skip to content

Commit

Permalink
Add fix for the configuration.php owner and permissions after auto de…
Browse files Browse the repository at this point in the history
…ploy if the ownership missmatch.
  • Loading branch information
Llewellynvdm committed Jan 20, 2024
1 parent 6407e1b commit a416792
Show file tree
Hide file tree
Showing 19 changed files with 342 additions and 152 deletions.
26 changes: 18 additions & 8 deletions 4.3/php8.1/apache/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
--db-encryption=0
)

php installation/joomla.php install "${installJoomlaArgs[@]}"

# Check the exit status of the PHP command
if [ $? -eq 0 ]; then
# Set configuration to correct owner
chown "$user:$group" configuration.php
# Set configuration to correct permissions
chmod 444 configuration.php
# Run the auto deploy (install)
if php installation/joomla.php install "${installJoomlaArgs[@]}"; then

# The PHP command succeeded (so we remove the installation folder)
rm -rf installation

echo >&2 "========================================================================"
echo >&2
echo >&2 "This server is now configured to run Joomla!"

# fix the configuration.php ownership
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then
# Set configuration to correct owner
if ! chown "$user:$group" configuration.php; then
echo >&2
echo >&2 "Error: Ownership of configuration.php failed to be corrected."
fi
# Set configuration to correct permissions
if ! chmod 444 configuration.php; then
echo >&2
echo >&2 "Error: Permissions of configuration.php failed to be corrected."
fi
fi

echo >&2
echo >&2 "========================================================================"
else
Expand Down
26 changes: 18 additions & 8 deletions 4.3/php8.1/fpm-alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
--db-encryption=0
)

php installation/joomla.php install "${installJoomlaArgs[@]}"

# Check the exit status of the PHP command
if [ $? -eq 0 ]; then
# Set configuration to correct owner
chown "$user:$group" configuration.php
# Set configuration to correct permissions
chmod 444 configuration.php
# Run the auto deploy (install)
if php installation/joomla.php install "${installJoomlaArgs[@]}"; then

# The PHP command succeeded (so we remove the installation folder)
rm -rf installation

echo >&2 "========================================================================"
echo >&2
echo >&2 "This server is now configured to run Joomla!"

# fix the configuration.php ownership
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then
# Set configuration to correct owner
if ! chown "$user:$group" configuration.php; then
echo >&2
echo >&2 "Error: Ownership of configuration.php failed to be corrected."
fi
# Set configuration to correct permissions
if ! chmod 444 configuration.php; then
echo >&2
echo >&2 "Error: Permissions of configuration.php failed to be corrected."
fi
fi

echo >&2
echo >&2 "========================================================================"
else
Expand Down
26 changes: 18 additions & 8 deletions 4.3/php8.1/fpm/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
--db-encryption=0
)

php installation/joomla.php install "${installJoomlaArgs[@]}"

# Check the exit status of the PHP command
if [ $? -eq 0 ]; then
# Set configuration to correct owner
chown "$user:$group" configuration.php
# Set configuration to correct permissions
chmod 444 configuration.php
# Run the auto deploy (install)
if php installation/joomla.php install "${installJoomlaArgs[@]}"; then

# The PHP command succeeded (so we remove the installation folder)
rm -rf installation

echo >&2 "========================================================================"
echo >&2
echo >&2 "This server is now configured to run Joomla!"

# fix the configuration.php ownership
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then
# Set configuration to correct owner
if ! chown "$user:$group" configuration.php; then
echo >&2
echo >&2 "Error: Ownership of configuration.php failed to be corrected."
fi
# Set configuration to correct permissions
if ! chmod 444 configuration.php; then
echo >&2
echo >&2 "Error: Permissions of configuration.php failed to be corrected."
fi
fi

echo >&2
echo >&2 "========================================================================"
else
Expand Down
26 changes: 18 additions & 8 deletions 4.3/php8.2/apache/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
--db-encryption=0
)

php installation/joomla.php install "${installJoomlaArgs[@]}"

# Check the exit status of the PHP command
if [ $? -eq 0 ]; then
# Set configuration to correct owner
chown "$user:$group" configuration.php
# Set configuration to correct permissions
chmod 444 configuration.php
# Run the auto deploy (install)
if php installation/joomla.php install "${installJoomlaArgs[@]}"; then

# The PHP command succeeded (so we remove the installation folder)
rm -rf installation

echo >&2 "========================================================================"
echo >&2
echo >&2 "This server is now configured to run Joomla!"

# fix the configuration.php ownership
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then
# Set configuration to correct owner
if ! chown "$user:$group" configuration.php; then
echo >&2
echo >&2 "Error: Ownership of configuration.php failed to be corrected."
fi
# Set configuration to correct permissions
if ! chmod 444 configuration.php; then
echo >&2
echo >&2 "Error: Permissions of configuration.php failed to be corrected."
fi
fi

echo >&2
echo >&2 "========================================================================"
else
Expand Down
26 changes: 18 additions & 8 deletions 4.3/php8.2/fpm-alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
--db-encryption=0
)

php installation/joomla.php install "${installJoomlaArgs[@]}"

# Check the exit status of the PHP command
if [ $? -eq 0 ]; then
# Set configuration to correct owner
chown "$user:$group" configuration.php
# Set configuration to correct permissions
chmod 444 configuration.php
# Run the auto deploy (install)
if php installation/joomla.php install "${installJoomlaArgs[@]}"; then

# The PHP command succeeded (so we remove the installation folder)
rm -rf installation

echo >&2 "========================================================================"
echo >&2
echo >&2 "This server is now configured to run Joomla!"

# fix the configuration.php ownership
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then
# Set configuration to correct owner
if ! chown "$user:$group" configuration.php; then
echo >&2
echo >&2 "Error: Ownership of configuration.php failed to be corrected."
fi
# Set configuration to correct permissions
if ! chmod 444 configuration.php; then
echo >&2
echo >&2 "Error: Permissions of configuration.php failed to be corrected."
fi
fi

echo >&2
echo >&2 "========================================================================"
else
Expand Down
26 changes: 18 additions & 8 deletions 4.3/php8.2/fpm/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
--db-encryption=0
)

php installation/joomla.php install "${installJoomlaArgs[@]}"

# Check the exit status of the PHP command
if [ $? -eq 0 ]; then
# Set configuration to correct owner
chown "$user:$group" configuration.php
# Set configuration to correct permissions
chmod 444 configuration.php
# Run the auto deploy (install)
if php installation/joomla.php install "${installJoomlaArgs[@]}"; then

# The PHP command succeeded (so we remove the installation folder)
rm -rf installation

echo >&2 "========================================================================"
echo >&2
echo >&2 "This server is now configured to run Joomla!"

# fix the configuration.php ownership
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then
# Set configuration to correct owner
if ! chown "$user:$group" configuration.php; then
echo >&2
echo >&2 "Error: Ownership of configuration.php failed to be corrected."
fi
# Set configuration to correct permissions
if ! chmod 444 configuration.php; then
echo >&2
echo >&2 "Error: Permissions of configuration.php failed to be corrected."
fi
fi

echo >&2
echo >&2 "========================================================================"
else
Expand Down
26 changes: 18 additions & 8 deletions 4.4/php8.1/apache/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
--db-encryption=0
)

php installation/joomla.php install "${installJoomlaArgs[@]}"

# Check the exit status of the PHP command
if [ $? -eq 0 ]; then
# Set configuration to correct owner
chown "$user:$group" configuration.php
# Set configuration to correct permissions
chmod 444 configuration.php
# Run the auto deploy (install)
if php installation/joomla.php install "${installJoomlaArgs[@]}"; then

# The PHP command succeeded (so we remove the installation folder)
rm -rf installation

echo >&2 "========================================================================"
echo >&2
echo >&2 "This server is now configured to run Joomla!"

# fix the configuration.php ownership
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then
# Set configuration to correct owner
if ! chown "$user:$group" configuration.php; then
echo >&2
echo >&2 "Error: Ownership of configuration.php failed to be corrected."
fi
# Set configuration to correct permissions
if ! chmod 444 configuration.php; then
echo >&2
echo >&2 "Error: Permissions of configuration.php failed to be corrected."
fi
fi

echo >&2
echo >&2 "========================================================================"
else
Expand Down
26 changes: 18 additions & 8 deletions 4.4/php8.1/fpm-alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
--db-encryption=0
)

php installation/joomla.php install "${installJoomlaArgs[@]}"

# Check the exit status of the PHP command
if [ $? -eq 0 ]; then
# Set configuration to correct owner
chown "$user:$group" configuration.php
# Set configuration to correct permissions
chmod 444 configuration.php
# Run the auto deploy (install)
if php installation/joomla.php install "${installJoomlaArgs[@]}"; then

# The PHP command succeeded (so we remove the installation folder)
rm -rf installation

echo >&2 "========================================================================"
echo >&2
echo >&2 "This server is now configured to run Joomla!"

# fix the configuration.php ownership
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then
# Set configuration to correct owner
if ! chown "$user:$group" configuration.php; then
echo >&2
echo >&2 "Error: Ownership of configuration.php failed to be corrected."
fi
# Set configuration to correct permissions
if ! chmod 444 configuration.php; then
echo >&2
echo >&2 "Error: Permissions of configuration.php failed to be corrected."
fi
fi

echo >&2
echo >&2 "========================================================================"
else
Expand Down
26 changes: 18 additions & 8 deletions 4.4/php8.1/fpm/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,20 +198,30 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
--db-encryption=0
)

php installation/joomla.php install "${installJoomlaArgs[@]}"

# Check the exit status of the PHP command
if [ $? -eq 0 ]; then
# Set configuration to correct owner
chown "$user:$group" configuration.php
# Set configuration to correct permissions
chmod 444 configuration.php
# Run the auto deploy (install)
if php installation/joomla.php install "${installJoomlaArgs[@]}"; then

# The PHP command succeeded (so we remove the installation folder)
rm -rf installation

echo >&2 "========================================================================"
echo >&2
echo >&2 "This server is now configured to run Joomla!"

# fix the configuration.php ownership
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' configuration.php)" != "$user:$group" ]; then
# Set configuration to correct owner
if ! chown "$user:$group" configuration.php; then
echo >&2
echo >&2 "Error: Ownership of configuration.php failed to be corrected."
fi
# Set configuration to correct permissions
if ! chmod 444 configuration.php; then
echo >&2
echo >&2 "Error: Permissions of configuration.php failed to be corrected."
fi
fi

echo >&2
echo >&2 "========================================================================"
else
Expand Down
Loading

0 comments on commit a416792

Please sign in to comment.