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

MON-14425 fix centreon.ini and autoconfigure timezone #11608

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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