developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.
#600 closed enhancement (fixed)
Timezone in jelix config file
Reported by: | doubleface | Owned by: | doubleface |
---|---|---|---|
Priority: | low | Milestone: | Jelix 1.1 beta 1 |
Component: | jelix:core | Version: | trunk |
Severity: | minor | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Documentation needed: | no | |
Hosting Provider: | Php version: |
Description
Would it be possible to let PHP "guess" the timezone if no timezone is specified in jelix config file? I actually need it for my project and for the moment, I have to patch Jelix for every update(I know exactly on which machine and which os the application will be deployed). I don't think it would be a problem since the timezone is defined in defaultconfig.ini.php.
See the small patch, which was made on the "dev" version (no access to the svn repository from work).
Attachments (3)
Change History (12)
Changed 13 years ago by doubleface
Changed 13 years ago by doubleface
comment:1 Changed 13 years ago by laurentj
- review changed from review? to review-
The patch should be made on jConfigCompiler instead, so date_default_timezone_get() will be called only one time.
comment:2 Changed 13 years ago by doubleface
- review changed from review- to review?
- Status changed from new to assigned
That is a good idea.
Here is the patch, but made from the repository this time (retrieved the file from trac).
I tested it only without the jelix extension.
comment:3 Changed 13 years ago by doubleface
I forgot to add that, this time, the date_default_timezone_get is made if the timeZone key exists in config file, but is empty. This is more flexible. With the previous patch, you couldn't erase a key if it was valued in defaultconfig.ini and the you had to modify it, too.
I think, this timeZone should be empty in defaultconfig.ini instead of Europe/Paris? (to be more international ;-) ).
comment:4 Changed 13 years ago by laurentj
- review changed from review? to review+
The patch is ok
this timeZone should be empty in defaultconfig.ini instead of Europe/Paris? (to be more international
ok I agree, so erase the value of timeZone in lib/jelix/core/defaultconfig.ini.php and in lib/jelix-scripts/templates/var/config/defaultconfig.ini.php.tpl
comment:5 Changed 13 years ago by bballizlife
So here we can commit the patch, just adding to it the fact of emptying the timeZone values in lib/jelix/core/defaultconfig.ini.php and in lib/jelix-scripts/templates/var/config/defaultconfig.ini.php.tpl ?
comment:6 Changed 13 years ago by doubleface
Yes, I forgot to qdd it in the patch. Can someone commit the patch for me? I still don't have internet at home and no possiblity to commit from work (proxy à la con).
Replying to bballizlife:
So here we can commit the patch, just adding to it the fact of emptying the timeZone values in lib/jelix/core/defaultconfig.ini.php and in lib/jelix-scripts/templates/var/config/defaultconfig.ini.php.tpl ?
comment:7 Changed 12 years ago by laurentj
- Resolution set to fixed
- Status changed from assigned to closed
Commited in the trunk.
comment:8 Changed 12 years ago by laurentj
- Milestone changed from jelix 1.1 to Jelix 1.1 beta 1
comment:9 Changed 12 years ago by laurentj
- review review+ deleted
In fact, there is a problem. On my machine, date_default_timezone_get() generate a warning :
<b>Strict Standards</b>: date_default_timezone_get() : It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in <b>jelix/tests/trunk/lib/jelix/core/jConfigCompiler.class.php</b> on line <b>90</b><br />
so I replace the call date_default_timezone_get() by :
if (trim($config->timeZone) === '') { #if PHP50 $config->timeZone = "Europe/Paris"; #else $tz = ini_get('date.timezone'); if ($tz != '') $config->timeZone = $tz; else $config->timeZone = "Europe/Paris"; #endif }
patch on jCoordinator