Bug 18674

Summary: Show timezone for Perl and MySQL on the About Koha page
Product: Koha Reporter: David Cook <dcook>
Component: AboutAssignee: Mark Tompsett <mtompset>
Status: CLOSED FIXED QA Contact: Tomás Cohen Arazi <tomascohen>
Severity: enhancement    
Priority: P5 - low CC: jonathan.druart, mtj, mtompset, nick, tomascohen, veron
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18299
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 20123    
Bug Blocks:    
Attachments: Bug 18674: Added timezone information to about page
Bug 18674: Added timezone information to about page
Bug 18674: Follow up on missing TZ SetEnv for plack
Bug 18674: Added timezone information to about page
Bug 18674: Follow up on missing TZ SetEnv for plack
Bug 18674: Style changes to match other entries
Bug 18674: TZ error handling
Bug 18674: (QA follow-up) Add date and time
Bug 18674: (QA follow-up) Add date and time
Bug 18674: (QA follow-up) Add date and time

Description David Cook 2017-05-26 03:56:29 UTC
With the pushing of Bug 18299, we no longer have a quick way of checking the timezone of the Perl and MySQL connection. 

We should add some code to the About Koha page to show this info.
Comment 1 Mark Tompsett 2018-02-26 15:05:17 UTC
Created attachment 72214 [details] [review]
Bug 18674: Added timezone information to about page

Before patch: No timezone section
After patch: timezone section at bottom of
             Server information tab.

Actual is what is being used. Config overrides environment variables.
So if there is confusion why the environment variables aren't working,
it will be visible why.
Comment 2 Mark Tompsett 2018-02-26 15:06:20 UTC
It should be noted that I had to tweak 20123 to get it to a usable state for this, so sign off can't happen immediately.
Comment 3 Mark Tompsett 2018-04-02 19:28:48 UTC
Created attachment 73533 [details] [review]
Bug 18674: Added timezone information to about page

Before patch: No timezone section
After patch: timezone section at bottom of
             Server information tab.

Actual is what is being used. Config overrides environment variables.
So if there is confusion why the environment variables aren't working,
it will be visible why.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 4 Mark Tompsett 2018-04-02 19:28:53 UTC
Created attachment 73534 [details] [review]
Bug 18674: Follow up on missing TZ SetEnv for plack

It should also be noted that
    /etc/apache2/sites-enabled/{configuration file}
should also contain:
    RequestHeader add X-Koha-SetEnv "TZ {timezone}"
Where {timezone} is the desired instance timezone.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 5 Tomás Cohen Arazi 2018-04-05 14:37:50 UTC
Created attachment 73700 [details] [review]
Bug 18674: Added timezone information to about page

Before patch: No timezone section
After patch: timezone section at bottom of
             Server information tab.

Actual is what is being used. Config overrides environment variables.
So if there is confusion why the environment variables aren't working,
it will be visible why.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 6 Tomás Cohen Arazi 2018-04-05 14:38:06 UTC
Created attachment 73701 [details] [review]
Bug 18674: Follow up on missing TZ SetEnv for plack

It should also be noted that
    /etc/apache2/sites-enabled/{configuration file}
should also contain:
    RequestHeader add X-Koha-SetEnv "TZ {timezone}"
Where {timezone} is the desired instance timezone.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 7 Tomás Cohen Arazi 2018-04-05 14:38:12 UTC
Created attachment 73702 [details] [review]
Bug 18674: Style changes to match other entries

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 8 Tomás Cohen Arazi 2018-04-05 19:38:29 UTC
Created attachment 73720 [details] [review]
Bug 18674: TZ error handling

This patch adds C4::Context->timezone bad timezone handling.
The calculated 'effective' timezone is tested with the right tool and a
fallback to 'local' is added. A warning is printed in the logs.

A test for this is added to about.pl too, along with the right warning
messages in case of problems.

Tests are added for both invalid TZ and to make sure the warning is
raised.

To test:
- Apply the patch
- Run:
  $ kshell
 k$ prove t/timezones.t
=> SUCCESS: All tests pass

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 9 Jonathan Druart 2018-04-10 19:16:09 UTC
Use of uninitialized value $config_timezone in string ne at /home/vagrant/kohaclone/about.pl line 71.
Use of uninitialized value $config_timezone in string eq at /home/vagrant/kohaclone/about.pl line 76.
Use of uninitialized value $env_timezone in string ne at /home/vagrant/kohaclone/about.pl line 76.


Also, should not we display the date and time, could be a relevant information (especially when tz=local).
Comment 10 Tomás Cohen Arazi 2018-04-11 18:54:56 UTC Comment hidden (obsolete)
Comment 11 Tomás Cohen Arazi 2018-04-11 19:12:16 UTC Comment hidden (obsolete)
Comment 12 Tomás Cohen Arazi 2018-04-11 19:29:50 UTC
Created attachment 74036 [details] [review]
Bug 18674: (QA follow-up) Add date and time

This patch adds current date and time, formatted as configured.
It makes the timezone name be displayed the system uses it (important
for the 'local' use case).

It removes some warnings too.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 13 Jonathan Druart 2018-04-11 19:37:44 UTC
It would be good to write something about this new entry on the wiki.
Comment 14 Jonathan Druart 2018-04-11 19:54:10 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 15 Nick Clemens 2018-05-14 19:27:09 UTC
Enhancement on feature, not backported for 17.11.x
Comment 16 David Cook 2018-06-18 05:42:24 UTC
It's a shame this isn't backported to at least 17.05, since 17.05 and 17.11 don't have an easy way of verifying TZ settings.
Comment 17 Tomás Cohen Arazi 2018-06-18 10:43:02 UTC
(In reply to David Cook from comment #16)
> It's a shame this isn't backported to at least 17.05, since 17.05 and 17.11
> don't have an easy way of verifying TZ settings.

This one needs some work to be suitable for the old stable releases. You better talk to the release maintainers. If you need it.
Comment 18 David Cook 2018-06-19 00:10:12 UTC
(In reply to Tomás Cohen Arazi from comment #17)
> (In reply to David Cook from comment #16)
> > It's a shame this isn't backported to at least 17.05, since 17.05 and 17.11
> > don't have an easy way of verifying TZ settings.
> 
> This one needs some work to be suitable for the old stable releases. You
> better talk to the release maintainers. If you need it.

In that case, I'd say reverting https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18299 for 17.05 and 17.11 might be a better idea.

I ended up just copying admin/env_tz_test.pl from an older version of Koha and ran that instead for the setup of the timezone and then deleted it again.

I imagine anyone who needs to check for 17.05 and 17.11 would just do the same thing.