Commit 26858605 authored by Gabriel Moreau's avatar Gabriel Moreau
Browse files

Change function to have a minimal one

parent 1f554a1a
......@@ -10,7 +10,7 @@ require_once('module/upgrade-functions.php');
auth_or_login('index.php');
level_or_alert(4, 'Mise à jour de l\'application');
if (!$pdo = connect_db())
if (!$pdo = connect_db_minimal())
exit();
en_tete('Mise à jour de la base de donnée des notices');
......
......@@ -12,7 +12,7 @@ define('GESTEX_DB_VERSION', 4);
// connexion au serveur mySQL
function connect_db() {
function connect_db_minimal() {
try{
$pdo = new PDO('mysql:host='.GESTEX_DB_SERVER.'; dbname='.GESTEX_DB_DATABASE, GESTEX_DB_USER, GESTEX_DB_PASSWORD);
}
......@@ -22,18 +22,26 @@ function connect_db() {
return false;
}
try{
$datasheet_version = get_version_by_name($pdo, 'datasheet');
if ($datasheet_version < GESTEX_DB_VERSION) {
error_log('Database version error: update the database schema');
echo "Mettre à jour le schéma de la base de données";
return false
return $pdo;
}
// ---------------------------------------------------------------------
function connect_db() {
if ($pdo = connect_db_minimal()) {
try{
$datasheet_version = get_version_by_name($pdo, 'datasheet');
if ($datasheet_version < GESTEX_DB_VERSION) {
error_log('Database version error: update the database schema');
echo "Mettre à jour le schéma de la base de données";
return false
}
}
catch(PDOException $exception){
error_log('Database version error: '.$exception->getMessage());
echo $exception->getMessage();
return false;
}
}
catch(PDOException $exception){
error_log('Database version error: '.$exception->getMessage());
echo $exception->getMessage();
return false;
}
return $pdo;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment