Bugzilla – Attachment 133000 Details for
Bug 30468
koha-mysql does not honor Koha's timezone setting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30468: koha-mysql does not honor Koha's timezone setting
Bug-30468-koha-mysql-does-not-honor-Kohas-timezone.patch (text/plain), 2.71 KB, created by
Kyle M Hall (khall)
on 2022-04-06 13:08:09 UTC
(
hide
)
Description:
Bug 30468: koha-mysql does not honor Koha's timezone setting
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2022-04-06 13:08:09 UTC
Size:
2.71 KB
patch
obsolete
>From abda8f67017d979177eca86f1d9d41e2f062afa2 Mon Sep 17 00:00:00 2001 >From: Kyle Hall <kyle@bywatersolutions.com> >Date: Wed, 6 Apr 2022 08:38:00 -0400 >Subject: [PATCH] Bug 30468: koha-mysql does not honor Koha's timezone setting > >If I run a query like "SELECT NOW()" from a koha report, I will get a different answer than if I had run it from koha-mysql. >In Koha, we set the timezone for each database connection. >However, koha-mysql does not do this, so instead we are left using the default timezone of the database. > >Test Plan: >1) Set your time zone to something other than the database time zone >2) run "SELECT NOW()" using debian/scripts/koha-mysql > *not* /usr/sbin/koha-mysql >3) Note you get the database timezone's current time >4) Apply this patch >5) Repeat step 2 >6) Now you get the correct time! >--- > debian/scripts/koha-mysql | 21 ++++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) > >diff --git a/debian/scripts/koha-mysql b/debian/scripts/koha-mysql >index 4a09e51c77..959812d1b0 100755 >--- a/debian/scripts/koha-mysql >+++ b/debian/scripts/koha-mysql >@@ -17,8 +17,6 @@ > # You should have received a copy of the GNU General Public License > # along with this program. If not, see <http://www.gnu.org/licenses/>. > >-set -e >- > umask 0077 > > # include helper functions >@@ -50,11 +48,20 @@ is_instance "$name" || ( usage; die "Unknown instance '$name'" ) > shift # remove instance name from argument list. > kohaconfig="/etc/koha/sites/$name/koha-conf.xml" > >-mysqlhost="$( xmlstarlet sel -t -v 'yazgfs/config/hostname' $kohaconfig )" >-mysqldb="$( xmlstarlet sel -t -v 'yazgfs/config/database' $kohaconfig )" >-mysqluser="$( xmlstarlet sel -t -v 'yazgfs/config/user' $kohaconfig )" >-mysqlpass="$( xmlstarlet sel -t -v 'yazgfs/config/pass' $kohaconfig )" >+mysqlhost="$( xmlstarlet sel -t -v 'yazgfs/config/hostname' $kohaconfig )" || die "hostname missing from $kohaconfig" >+mysqldb="$( xmlstarlet sel -t -v 'yazgfs/config/database' $kohaconfig )" || die "database missing from $kohaconfig" >+mysqluser="$( xmlstarlet sel -t -v 'yazgfs/config/user' $kohaconfig )" || die "user missing from $kohaconfig" >+mysqlpass="$( xmlstarlet sel -t -v 'yazgfs/config/pass' $kohaconfig )" || die "pass missing from $kohaconfig" > >-mysql --host="$mysqlhost" --user="$mysqluser" --password="$mysqlpass" \ >+mysqltz="$( xmlstarlet sel -t -v 'yazgfs/config/timezone' $kohaconfig )" >+if [ $? -eq 0 ] >+then >+ echo "Using time zone $mysqltz" >+ mysql --host="$mysqlhost" --user="$mysqluser" --password="$mysqlpass" --init-command="SET time_zone = '$mysqltz'" \ >+ "$mysqldb" "${@}" >+else >+ echo "No time zone set for Koha, using database time zone." >+ mysql --host="$mysqlhost" --user="$mysqluser" --password="$mysqlpass" \ > "$mysqldb" "${@}" >+fi > >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30468
:
132996
|
132998
|
132999
|
133000
|
136746
|
138457
|
138458