Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
MON-14425 fix centreon.ini and autoconfigure timezone (#11608)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgcosta authored Sep 6, 2022
1 parent 10a5d6b commit e31d6a9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions ci/debian/centreon-web.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,17 @@ if [ -n "$2" ]; then
su - www-data -s /bin/bash -c "/usr/share/centreon/bin/console cache:clear --no-warmup"
fi

# Try auto configure timezone for php
timezone=$(/usr/bin/php -r '
$timezoneName = timezone_name_from_abbr(trim(shell_exec("date \"+%Z\"")));
if (preg_match("/Time zone: (\S+)/", shell_exec("timedatectl"), $matches)) {
$timezoneName = $matches[1];
}
if (date_default_timezone_set($timezoneName) === false) {
$timezoneName = "UTC";
}
echo $timezoneName;
' 2>/dev/null)
sed -i "s#^date.timezone = .*#date.timezone = ${timezone}#" /etc/php/8.0/mods-available/centreon.ini

exit 0
6 changes: 5 additions & 1 deletion ci/debian/extra/centreon-web/centreon.ini
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
date.timezone = UTC
max_execution_time = 300
session.use_strict_mode = 1
session.gc_maxlifetime = 7200
expose_php = Off
date.timezone = UTC

0 comments on commit e31d6a9

Please sign in to comment.