Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
legi
soft
gestex
Commits
26858605
Commit
26858605
authored
Jun 28, 2021
by
Gabriel Moreau
Browse files
Change function to have a minimal one
parent
1f554a1a
Changes
2
Hide whitespace changes
Inline
Side-by-side
admin-upgrade.php
View file @
26858605
...
...
@@ -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'
);
...
...
module/db-functions.php
View file @
26858605
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment