Bugzilla – Attachment 7747 Details for
Bug 6008
Installation might fail it user web doesn't have in its path the database command path
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6008 - Locating mysql/psql commands on Installer.pm
Bug-6008---Locating-mysqlpsql-commands-on-Installe.patch (text/plain), 2.35 KB, created by
Chris Cormack
on 2012-02-18 07:27:47 UTC
(
hide
)
Description:
Bug 6008 - Locating mysql/psql commands on Installer.pm
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2012-02-18 07:27:47 UTC
Size:
2.35 KB
patch
obsolete
>From 8e2672cd7d611d9d36e53eef4a7ae00f117bec2c Mon Sep 17 00:00:00 2001 >From: Salvador Zaragoza Rubio <salvazm@masmedios.com> >Date: Wed, 30 Mar 2011 17:40:43 +0200 >Subject: [PATCH] Bug 6008 - Locating mysql/psql commands on Installer.pm > >In Installer.pm when is looking for the system command to dump a file into the database >it might fail if the web user doesn't have it in its path. So we add before a search with >"which" and "whereis" commands, if they fail the command is itself without path. > >E.g.: with OpenBSD 4.8 the web user "www" doesn't have the path to the installed mysql bin: >/usr/local/bin/mysql and fails in the web installer. > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> > >Seems to work fine, has a good default for if it fails to find that >path >--- > C4/Installer.pm | 13 +++++++++++-- > 1 files changed, 11 insertions(+), 2 deletions(-) > mode change 100644 => 100755 C4/Installer.pm > >diff --git a/C4/Installer.pm b/C4/Installer.pm >old mode 100644 >new mode 100755 >index a7eb1f6..43fd724 >--- a/C4/Installer.pm >+++ b/C4/Installer.pm >@@ -508,8 +508,13 @@ sub load_sql { > my $datadir = C4::Context->config('intranetdir') . "/installer/data/$self->{dbms}"; > my $error; > my $strcmd; >+ my $cmd; > if ( $self->{dbms} eq 'mysql' ) { >- $strcmd = "mysql " >+ $cmd = qx(which mysql 2>/dev/null || whereis mysql 2>/dev/null); >+ chomp $cmd; >+ $cmd = $1 if ($cmd && $cmd =~ /^(.+?)[\r\n]+$/); >+ $cmd = 'mysql' if (!$cmd || !-x $cmd); >+ $strcmd = "$cmd " > . ( $self->{hostname} ? " -h $self->{hostname} " : "" ) > . ( $self->{port} ? " -P $self->{port} " : "" ) > . ( $self->{user} ? " -u $self->{user} " : "" ) >@@ -517,7 +522,11 @@ sub load_sql { > . " $self->{dbname} "; > $error = qx($strcmd --default-character-set=utf8 <$filename 2>&1 1>/dev/null); > } elsif ( $self->{dbms} eq 'Pg' ) { >- $strcmd = "psql " >+ $cmd = qx(which psql 2>/dev/null || whereis psql 2>/dev/null); >+ chomp $cmd; >+ $cmd = $1 if ($cmd && $cmd =~ /^(.+?)[\r\n]+$/); >+ $cmd = 'psql' if (!$cmd || !-x $cmd); >+ $strcmd = "$cmd " > . ( $self->{hostname} ? " -h $self->{hostname} " : "" ) > . ( $self->{port} ? " -p $self->{port} " : "" ) > . ( $self->{user} ? " -U $self->{user} " : "" ) >-- >1.7.5.4
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 6008
:
3532
| 7747