Skip to content

Commit

Permalink
config: Add [system] => 'timezone'
Browse files Browse the repository at this point in the history
RSS-Bridge currently statically sets the timezone to UTC which can
result in incorrect timestamps if the server is hosted in another
region.

This commit adds a new configuration parameter to allow admins to
specify their own timezone for their servers. Invalid values will
result in an error message.

Example:

  [system]
  timezone = "UTC"

For compatibility reasons the default value is set to UTC.

This parameter accepts any of the supported timezones listed at
https://www.php.net/manual/en/timezones.php

Closes #956
References #1001
  • Loading branch information
logmanoriginal committed Jun 7, 2019
1 parent e2e0ced commit 946a99d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions config.default.ini.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
; file, it will be replaced on the next update of RSS-Bridge! You can specify
; your own configuration in 'config.ini.php' (copy this file).

[system]

; Defines the timezone used by RSS-Bridge
; Find a list of supported timezones at
; https://www.php.net/manual/en/timezones.php
; timezone = "UTC" (default)
timezone = "UTC"

[cache]

; Defines the cache type used by RSS-Bridge
Expand Down
6 changes: 6 additions & 0 deletions lib/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ public static function loadConfiguration() {
}
}

if(!is_string(self::getConfig('system', 'timezone'))
|| !in_array(self::getConfig('system', 'timezone'), timezone_identifiers_list(DateTimeZone::ALL_WITH_BC)))
die('Parameter [system] => "timezone" is invalid! Please check "config.ini.php"!');

date_default_timezone_set(self::getConfig('system', 'timezone'));

if(!is_string(self::getConfig('proxy', 'url')))
die('Parameter [proxy] => "url" is not a valid string! Please check "config.ini.php"!');

Expand Down

0 comments on commit 946a99d

Please sign in to comment.