Bug 20525

Summary: Add --timezone switch to koha-create
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: Command-line UtilitiesAssignee: Tomás Cohen Arazi <tomascohen>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: jonathan.druart, kyle, martin.renvoize, mtompset, robin
Version: master   
Hardware: All   
OS: All   
Whiteboard:
Change sponsored?: --- Patch complexity: Small patch
Bot Control: --- When did the bot last check this:
Who signed the patch off: Text to go in the release notes:
Bug Depends on: 20123    
Bug Blocks:    
Attachments: Bug 20525: Add --timezone switch to koha-create
Bug 20525: Add --timezone switch to koha-create
Bug 20525: Add --timezone switch to koha-create
Bug 20525: Add --timezone switch to koha-create
Bug 20525: Add --timezone switch to koha-create

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 M. 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 M. 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 M. 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 M. Tompsett 2018-05-07 16:47:50 UTC
Bug 18342 broke it... rebasing without the use-memcached.
Comment 9 M. 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.