Bug 20525 - Add --timezone switch to koha-create
Summary: Add --timezone switch to koha-create
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Testopia
URL:
Keywords:
Depends on: 20123
Blocks:
  Show dependency treegraph
 
Reported: 2018-04-05 13:53 UTC by Tomás Cohen Arazi
Modified: 2019-10-14 19:57 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 20525: Add --timezone switch to koha-create (5.61 KB, patch)
2018-04-05 14:15 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 20525: Add --timezone switch to koha-create (5.61 KB, patch)
2018-04-24 18:53 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 20525: Add --timezone switch to koha-create (5.73 KB, patch)
2018-04-24 18:57 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 20525: Add --timezone switch to koha-create (5.71 KB, patch)
2018-05-07 16:50 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 20525: Add --timezone switch to koha-create (5.71 KB, patch)
2018-05-07 18:30 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2018-04-05 13:53:17 UTC
Now that Koha can be set a timezone on a per-instance basis (bug 20123), we should provide a way to configure it on instance creation time.

It should default to empty to keep the current behaviour.
Comment 1 Tomás Cohen Arazi 2018-04-05 14:15:07 UTC
Created attachment 73698 [details] [review]
Bug 20525: Add --timezone switch to koha-create

This patch adds a --timezone switch to koha-create so the timezone can
be set on creation time. It defaults to empty (i.e. using the server's
local time).

To test:
- Create an instance:
  $ sudo koha-create --create-db timezone1
=> SUCCESS: /etc/koha/sites/timezone1/koha-conf.xml contains an empty
<timezone> entry.
- Apply this patch
- Run:
  $ perl misc4dev/cp_debian_files.pl
- Create a new instance:
  $ sudo koha-create --create-db timezone2
=> SUCCESS: /etc/koha/sites/timezone2/koha-conf.xml contains an empty
<timezone> entry (i.e. the current behaviour is preserved).
- Create a new instance:
  $ sudo koha-create --create-db --timezone Your/Timezone timezone3
=> SUCCESS: /etc/koha/sites/timezone3/koha-conf.xml contains
    <timezone>Your/Timezone</timezone> (i.e. introduced behaviour works)
- Sign off :-D

Sponsored-by: ByWater Solutions
Comment 2 Mark Tompsett 2018-04-05 18:42:56 UTC
It should be noted somewhere to remember to run:
$ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
Comment 3 Tomás Cohen Arazi 2018-04-05 18:44:46 UTC
(In reply to M. Tompsett from comment #2)
> It should be noted somewhere to remember to run:
> $ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

Mark, I'm working on a followup for about.pl to warn about invalid tz (and have C4::Context gently fallback and warn on bad timezones).
Comment 4 Mark Tompsett 2018-04-06 01:59:37 UTC
I noticed a change in debian/templates/koha-conf-site.xml.in but not in etc/koha-conf.xml as well. Is one built from the other? Is there a reason to only fix the .in version?
Comment 5 Tomás Cohen Arazi 2018-04-06 13:36:06 UTC
(In reply to M. Tompsett from comment #4)
> I noticed a change in debian/templates/koha-conf-site.xml.in but not in
> etc/koha-conf.xml as well. Is one built from the other? Is there a reason to
> only fix the .in version?

This bug is about koha-create setting a config entry introduced by a separate bug. If you want to have Makefile.PL ask for timezone and fill it, file a new bug report :-D
Comment 6 Tomás Cohen Arazi 2018-04-24 18:53:33 UTC
Created attachment 74823 [details] [review]
Bug 20525: Add --timezone switch to koha-create

This patch adds a --timezone switch to koha-create so the timezone can
be set on creation time. It defaults to empty (i.e. using the server's
local time).

To test:
- Create an instance:
  $ sudo koha-create --create-db timezone1
=> SUCCESS: /etc/koha/sites/timezone1/koha-conf.xml contains an empty
<timezone> entry.
- Apply this patch
- Run:
  $ perl misc4dev/cp_debian_files.pl
- Create a new instance:
  $ sudo koha-create --create-db timezone2
=> SUCCESS: /etc/koha/sites/timezone2/koha-conf.xml contains an empty
<timezone> entry (i.e. the current behaviour is preserved).
- Create a new instance:
  $ sudo koha-create --create-db --timezone Your/Timezone timezone3
=> SUCCESS: /etc/koha/sites/timezone3/koha-conf.xml contains
    <timezone>Your/Timezone</timezone> (i.e. introduced behaviour works)
- Sign off :-D

Sponsored-by: ByWater Solutions
Comment 7 Mark Tompsett 2018-04-24 18:57:49 UTC
Created attachment 74827 [details] [review]
Bug 20525: Add --timezone switch to koha-create

This patch adds a --timezone switch to koha-create so the timezone can
be set on creation time. It defaults to empty (i.e. using the server's
local time).

To test:
- Create an instance:
  $ sudo koha-create --create-db timezone1
=> SUCCESS: /etc/koha/sites/timezone1/koha-conf.xml contains an empty
<timezone> entry.
- Apply this patch
- Run:
  $ perl misc4dev/cp_debian_files.pl
- Create a new instance:
  $ sudo koha-create --create-db timezone2
=> SUCCESS: /etc/koha/sites/timezone2/koha-conf.xml contains an empty
<timezone> entry (i.e. the current behaviour is preserved).
- Create a new instance:
  $ sudo koha-create --create-db --timezone Your/Timezone timezone3
=> SUCCESS: /etc/koha/sites/timezone3/koha-conf.xml contains
    <timezone>Your/Timezone</timezone> (i.e. introduced behaviour works)
- Sign off :-D

Sponsored-by: ByWater Solutions

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 8 Mark Tompsett 2018-05-07 16:47:50 UTC
Bug 18342 broke it... rebasing without the use-memcached.
Comment 9 Mark Tompsett 2018-05-07 16:50:42 UTC
Created attachment 75138 [details] [review]
Bug 20525: Add --timezone switch to koha-create

This patch adds a --timezone switch to koha-create so the timezone can
be set on creation time. It defaults to empty (i.e. using the server's
local time).

To test:
- Create an instance:
  $ sudo koha-create --create-db timezone1
=> SUCCESS: /etc/koha/sites/timezone1/koha-conf.xml contains an empty
<timezone> entry.
- Apply this patch
- Run:
  $ perl misc4dev/cp_debian_files.pl
- Create a new instance:
  $ sudo koha-create --create-db timezone2
=> SUCCESS: /etc/koha/sites/timezone2/koha-conf.xml contains an empty
<timezone> entry (i.e. the current behaviour is preserved).
- Create a new instance:
  $ sudo koha-create --create-db --timezone Your/Timezone timezone3
=> SUCCESS: /etc/koha/sites/timezone3/koha-conf.xml contains
    <timezone>Your/Timezone</timezone> (i.e. introduced behaviour works)
- Sign off :-D

Sponsored-by: ByWater Solutions

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 10 Kyle M Hall 2018-05-07 18:30:04 UTC
Created attachment 75141 [details] [review]
Bug 20525: Add --timezone switch to koha-create

This patch adds a --timezone switch to koha-create so the timezone can
be set on creation time. It defaults to empty (i.e. using the server's
local time).

To test:
- Create an instance:
  $ sudo koha-create --create-db timezone1
=> SUCCESS: /etc/koha/sites/timezone1/koha-conf.xml contains an empty
<timezone> entry.
- Apply this patch
- Run:
  $ perl misc4dev/cp_debian_files.pl
- Create a new instance:
  $ sudo koha-create --create-db timezone2
=> SUCCESS: /etc/koha/sites/timezone2/koha-conf.xml contains an empty
<timezone> entry (i.e. the current behaviour is preserved).
- Create a new instance:
  $ sudo koha-create --create-db --timezone Your/Timezone timezone3
=> SUCCESS: /etc/koha/sites/timezone3/koha-conf.xml contains
    <timezone>Your/Timezone</timezone> (i.e. introduced behaviour works)
- Sign off :-D

Sponsored-by: ByWater Solutions

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 11 Jonathan Druart 2018-05-08 20:09:16 UTC
Can we have a note on the wiki page about this flag?
Comment 12 Jonathan Druart 2018-05-09 15:57:28 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 13 Tomás Cohen Arazi 2018-05-09 19:11:36 UTC
(In reply to Jonathan Druart from comment #11)
> Can we have a note on the wiki page about this flag?

Done.
Comment 14 Tomás Cohen Arazi 2018-10-31 20:04:59 UTC
(In reply to M. Tompsett from comment #2)
> It should be noted somewhere to remember to run:
> $ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

I overlooked this. This is really important to be highlighted, because timezones would be valid but Koha would fail to connect, on invalid TZ.