mantisbt/mantisbt — pull request #387 by grangeway (2014-10-17 23:20:31+00:00)
Title: Simplify timezone configuration within Mantis

This is hopefully a simpler fix for Vboctor's #380

The current timezone initialisation logic in mantis is fairly complex as it deals with historical situations. For example - handling of php 5.1 on redhat disabling functionality of PHP.

Following https://github.com/mantisbt/mantisbt/commit/8213d69110140b3fc2c18ed423fa410bacfdb52a, for a new installation we always set the value of default_timezone, therefore we can simplify the logic and avoid trying to do complicated checks as we expect default_timezone to always be set.

Equally, we can use the value of the MANTIS_MAINTANENCE mode constant to skip the timezone initialisation.

/admin/check has then been adjusted to check that the default_timezone has been set in config_inc.php and is valid. This is now the expected case as new installations MUST set a timezone during installation, and allows the simplification of the existing code.

Existing Mantis users who have never set a timezone will pick up the requirement to set a timezone (that was added by 8213d69110140b3fc2c18ed423fa410bacfdb52a when doing an upgrade and running the admin checks.

This fixes the phpunit tests when a timezone is not set in php.ini, and maintains consistent behaviour both before and after the php5.4 change to timezone handling.

--------------------------------------------------------------

PHP Unit Test results:

PHPUnit 3.7.28 by Sebastian Bergmann.

..................................SS........................... 63 / 139 ( 45%)
.......S.........S.SS.................S......SSSS.............. 126 / 139 ( 90%)
.............

Time: 49.4 seconds, Memory: 26.00Mb

OK, but incomplete or skipped tests!
Tests: 139, Assertions: 511, Skipped: 11.