|
Lines 63-69
$info{'dbms'} = (
Link Here
|
| 63 |
: "mysql" |
63 |
: "mysql" |
| 64 |
); |
64 |
); |
| 65 |
$info{'hostname'} = C4::Context->config("hostname"); |
65 |
$info{'hostname'} = C4::Context->config("hostname"); |
| 66 |
$info{'webserver'} = C4::Context->config("webserver"); |
|
|
| 67 |
$info{'port'} = C4::Context->config("port"); |
66 |
$info{'port'} = C4::Context->config("port"); |
| 68 |
$info{'user'} = C4::Context->config("user"); |
67 |
$info{'user'} = C4::Context->config("user"); |
| 69 |
$info{'password'} = C4::Context->config("pass"); |
68 |
$info{'password'} = C4::Context->config("pass"); |
|
Lines 146-155
elsif ( $step && $step == 2 ) {
Link Here
|
| 146 |
$template->param( 'checkdatabasecreated' => 1 ); |
145 |
$template->param( 'checkdatabasecreated' => 1 ); |
| 147 |
} |
146 |
} |
| 148 |
|
147 |
|
| 149 |
#Check if user have all necessary grants on this database. |
148 |
# Check if user have all necessary grants on this database. |
| 150 |
my $rq = |
149 |
# CURRENT_USER is ANSI SQL, and doesn't require mysql table |
| 151 |
$dbh->prepare( |
150 |
# privileges, making the % check pointless, since they |
| 152 |
"SHOW GRANTS FOR \'$info{user}\'\@'$info{webserver}'"); |
151 |
# couldn't even check GRANTS if they couldn't connect. |
|
|
152 |
my $rq = $dbh->prepare('SHOW GRANTS FOR CURRENT_USER'); |
| 153 |
$rq->execute; |
153 |
$rq->execute; |
| 154 |
my $grantaccess; |
154 |
my $grantaccess; |
| 155 |
while ( my ($line) = $rq->fetchrow ) { |
155 |
while ( my ($line) = $rq->fetchrow ) { |
|
Lines 169-195
elsif ( $step && $step == 2 ) {
Link Here
|
| 169 |
); |
169 |
); |
| 170 |
} |
170 |
} |
| 171 |
} |
171 |
} |
| 172 |
unless ($grantaccess) { |
|
|
| 173 |
$rq = |
| 174 |
$dbh->prepare("SHOW GRANTS FOR \'$info{user}\'\@'\%'"); |
| 175 |
$rq->execute; |
| 176 |
while ( my ($line) = $rq->fetchrow ) { |
| 177 |
my $dbname = $info{dbname}; |
| 178 |
if ( $line =~ m/$dbname/ || index( $line, '*.*' ) > 0 ) |
| 179 |
{ |
| 180 |
$grantaccess = 1 |
| 181 |
if ( |
| 182 |
index( $line, 'ALL PRIVILEGES' ) > 0 |
| 183 |
|| ( ( index( $line, 'SELECT' ) > 0 ) |
| 184 |
&& ( index( $line, 'INSERT' ) > 0 ) |
| 185 |
&& ( index( $line, 'UPDATE' ) > 0 ) |
| 186 |
&& ( index( $line, 'DELETE' ) > 0 ) |
| 187 |
&& ( index( $line, 'CREATE' ) > 0 ) |
| 188 |
&& ( index( $line, 'DROP' ) > 0 ) ) |
| 189 |
); |
| 190 |
} |
| 191 |
} |
| 192 |
} |
| 193 |
$template->param( "checkgrantaccess" => $grantaccess ); |
172 |
$template->param( "checkgrantaccess" => $grantaccess ); |
| 194 |
} # End mysql connect check... |
173 |
} # End mysql connect check... |
| 195 |
|
174 |
|
| 196 |
- |
|
|