mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-16 11:30:55 +01:00
Fix sul test del database
This commit is contained in:
parent
29957f64f5
commit
ef36f98f8e
@ -32,7 +32,6 @@ if (post('db_host') !== null) {
|
||||
// Test della configurazione
|
||||
if (post('test') !== null) {
|
||||
ob_end_clean();
|
||||
$state = 2;
|
||||
|
||||
if ($dbo->isConnected()) {
|
||||
$requirements = [
|
||||
@ -58,22 +57,34 @@ if (post('db_host') !== null) {
|
||||
) {
|
||||
$pieces = explode(', ', explode(' ON ', str_replace('GRANT ', '', $privileges))[0]);
|
||||
|
||||
// Permessi generici sul database
|
||||
if (in_array('ALL', $pieces) || in_array('ALL PRIVILEGES', $pieces)) {
|
||||
$requirements = [];
|
||||
break;
|
||||
}
|
||||
|
||||
// Permessi specifici sul database
|
||||
foreach ($requirements as $key => $value) {
|
||||
if (!in_array($value, $pieces)) {
|
||||
$state = 1;
|
||||
|
||||
break 2;
|
||||
} else {
|
||||
if (in_array($value, $pieces)) {
|
||||
unset($requirements[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// Permessi insufficienti
|
||||
if (!empty($requirements)) {
|
||||
$state = 1;
|
||||
}
|
||||
|
||||
// Permessi completi
|
||||
else {
|
||||
$state = 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Connessione fallita
|
||||
else {
|
||||
$state = 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user