Bugzilla – Attachment 16596 Details for
Bug 7167
updatedatabase improvements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 7167 follow-up: allow Makefile.PL to work
PASSED-QA-Bug-7167-follow-up-allow-MakefilePL-to-w.patch (text/plain), 3.56 KB, created by
Paul Poulain
on 2013-03-21 10:41:13 UTC
(
hide
)
Description:
[PASSED QA] Bug 7167 follow-up: allow Makefile.PL to work
Filename:
MIME Type:
Creator:
Paul Poulain
Created:
2013-03-21 10:41:13 UTC
Size:
3.56 KB
patch
obsolete
>From 209243318d8f1c4d0540fb9963f0be956cc00297 Mon Sep 17 00:00:00 2001 >From: Galen Charlton <gmc@esilibrary.com> >Date: Fri, 28 Dec 2012 09:55:13 +0100 >Subject: [PATCH] [PASSED QA] Bug 7167 follow-up: allow Makefile.PL to work > >$dbh should not be declared at the package level unless > >one is *sure* that there will be a valid context. >TODO: fix the following noise when running perl Makefile.PL: >unable to locate Koha configuration file koha-conf.xml at /home/esi/koha/C4/Context.pm line 372. > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> > >Signed-off-by: Paul Poulain <paul.poulain@biblibre.com> >--- > C4/Update/Database.pm | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > >diff --git a/C4/Update/Database.pm b/C4/Update/Database.pm >index 5bbc950..eaeb288 100644 >--- a/C4/Update/Database.pm >+++ b/C4/Update/Database.pm >@@ -41,8 +41,6 @@ C4::Update::Database.pm > > =cut > >-our $dbh = C4::Context->dbh; >- > =head2 get_versions_path > > return the path to the version files >@@ -194,6 +192,7 @@ sub list_versions_available { > > sub list_versions_already_applied { > # 1st check if tables exist, otherwise create them >+ my $dbh = C4::Context->dbh; > $dbh->do(qq{ > CREATE TABLE IF NOT EXISTS `updatedb_error` ( `version` varchar(32) DEFAULT NULL, `error` text ) ENGINE=InnoDB CHARSET=utf8; > }); >@@ -240,6 +239,7 @@ sub list_versions_already_applied { > sub execute { > my ( $queries ) = @_; > my @errors; >+ my $dbh = C4::Context->dbh; > for my $query ( @{$queries->{queries}} ) { > eval { > $dbh->do( $query ); >@@ -257,6 +257,7 @@ sub execute { > =cut > > sub get_tables_name { >+ my $dbh = C4::Context->dbh; > my $sth = $dbh->prepare("SHOW TABLES"); > $sth->execute(); > my @tables; >@@ -344,6 +345,7 @@ my $tables; > =cut > > sub get_error { >+ my $dbh = C4::Context->dbh; > my @errors = $dbh->selectrow_array(qq{SHOW ERRORS}); # Get errors > my @warnings = $dbh->selectrow_array(qq{SHOW WARNINGS}); # Get warnings > if ( @errors ) { # Catch specifics errors >@@ -429,6 +431,7 @@ sub get_queries { > sub md5_already_exists { > my ( $md5 ) = @_; > my $query = qq/SELECT version, md5 FROM updatedb_report WHERE md5 = ?/; >+ my $dbh = C4::Context->dbh; > my $sth = $dbh->prepare( $query ); > $sth->execute( $md5 ); > my @r; >@@ -449,6 +452,7 @@ sub md5_already_exists { > sub set_infos { > my ( $version, $queries, $errors, $md5 ) = @_; > SetVersion($version) if not -s $errors; >+ my $dbh = C4::Context->dbh; > for my $query ( @{ $queries->{queries} } ) { > my $sth = $dbh->prepare("INSERT INTO updatedb_query(version, query) VALUES (?, ?)"); > $sth->execute( $version, $query ); >@@ -477,6 +481,7 @@ sub set_infos { > > sub mark_as_ok { > my ( $version ) = @_; >+ my $dbh = C4::Context->dbh; > my $sth = $dbh->prepare( "UPDATE updatedb_report SET status = 2 WHERE version=?" ); > my $affected = $sth->execute( $version ); > if ( $affected < 1 ) { >@@ -528,6 +533,7 @@ sub SetVersion { > my $new_version = TransformToNum(shift); > return unless $new_version =~ /\d\.\d+/; > my $current_version = TransformToNum( C4::Context->preference('Version') ); >+ my $dbh = C4::Context->dbh; > unless ( C4::Context->preference('Version') ) { > my $finish = $dbh->prepare(qq{ > INSERT IGNORE INTO systempreferences (variable,value,explanation) >@@ -548,6 +554,7 @@ sub SetVersion { > > sub TableExists { > my $table = shift; >+ my $dbh = C4::Context->dbh; > eval { > local $dbh->{PrintError} = 0; > local $dbh->{RaiseError} = 0; >-- >1.7.9.5
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 7167
:
6377
|
6378
|
6379
|
6381
|
6414
|
6415
|
6416
|
6476
|
6477
|
6478
|
6479
|
6722
|
6832
|
7903
|
8178
|
9859
|
9860
|
9861
|
9862
|
10033
|
10034
|
10549
|
10666
|
10667
|
10668
|
10825
|
11129
|
11222
|
11223
|
11224
|
11225
|
11226
|
11227
|
11228
|
11229
|
11230
|
11231
|
11232
|
11235
|
11236
|
11237
|
11238
|
11239
|
11240
|
11241
|
11242
|
11243
|
11244
|
11245
|
11246
|
11571
|
13423
|
13424
|
13425
|
13426
|
13427
|
13428
|
13429
|
13430
|
13431
|
13432
|
13433
|
13434
|
13435
|
13436
|
13437
|
13456
|
13457
|
13509
|
13516
|
13517
|
13518
|
13519
|
13520
|
13521
|
13522
|
13523
|
13524
|
13525
|
13526
|
13527
|
13528
|
13529
|
13733
|
13734
|
13842
|
13845
|
13848
|
13851
|
13852
|
13853
|
13854
|
14310
|
16113
|
16114
|
16115
|
16116
|
16117
| 16596