Skip to content

Commit c7bdaaa

Browse files
committed
fix: prevent sql error when updating to admidio 5.0 and no changelog table is present
1 parent 9705655 commit c7bdaaa

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

system/common.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,20 @@
232232

233233
// update session recordset (i.a. refresh timestamp)
234234
$gCurrentSession->setValue('ses_reload', 0);
235-
$gCurrentSession->save();
235+
if ($gCurrentSession->isNewRecord()) {
236+
// check if logging table exists
237+
$sql = 'SELECT * FROM ' . TBL_LOG . ' LIMIT 1';
238+
try {
239+
$gDb->query($sql);
240+
} catch (Throwable $e) {
241+
//temporary disable logging
242+
$gCurrentSession->setLoggingEnabled(false);
243+
$gCurrentSession->save();
244+
$gCurrentSession->setLoggingEnabled(true);
245+
}
246+
} else {
247+
$gCurrentSession->save();
248+
}
236249

237250
// create the necessary objects and parameters
238251

0 commit comments

Comments
 (0)