Skip to content

Commit

Permalink
Update moodle tool so not to fail when database not present
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentdavid committed Jan 29, 2025
1 parent d17e41f commit 25011f0
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions action_plugins/moodletool.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
$returnvalue = [
'failed' => true,
'msg' => 'Config file not found',
'moodle_is_installed' => false,
];
echo json_encode($returnvalue);
exit(0);
Expand All @@ -41,11 +40,20 @@

echo json_encode($returnvalue);
} catch (Exception $e) {
$returnvalue = [
'failed' => true,
'msg' => $e->getMessage(),
'moodle_is_installed' => false,
];
if (in_array(get_class($e), ['dml_connection_exception', 'dml_read_exception'])) {
$returnvalue = [
'failed' => false,
'moodle_is_installed' => false,
'moodle_needs_upgrading' => false,
'current_version' => 'Unknown',
'current_release' => 'Unknown',
];
} else {
$returnvalue = [
'failed' => true,
'msg' => $e->getMessage(),
];
}
echo json_encode($returnvalue);
}
exit(0);

0 comments on commit 25011f0

Please sign in to comment.