summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2015-07-30 11:34:24 -0400
committerjim-p <jimp@pfsense.org>2015-07-30 11:34:42 -0400
commit6b8ad2daafc2e60de6e27400173251657c3ef4af (patch)
treea8bbfbedbf70a35e87b8091ca1b7bb2a72d46d8e
parentff5464544d8be3d662fd3e42a0b51708e78d67b6 (diff)
downloadpfsense-6b8ad2daafc2e60de6e27400173251657c3ef4af.zip
pfsense-6b8ad2daafc2e60de6e27400173251657c3ef4af.tar.gz
More safety belts on CP DB open
-rw-r--r--etc/inc/captiveportal.inc13
1 files changed, 13 insertions, 0 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc
index 460263d..baf8bee 100644
--- a/etc/inc/captiveportal.inc
+++ b/etc/inc/captiveportal.inc
@@ -1414,6 +1414,19 @@ function captiveportal_opendb() {
"CREATE INDEX IF NOT EXISTS ip ON captiveportal (ip); " .
"CREATE INDEX IF NOT EXISTS starttime ON captiveportal (allow_time)";
+ try {
+ $DB = new SQLite3($db_path);
+ } catch (Exception $e) {
+ captiveportal_syslog("Could not open {$db_path} as an sqlite database for {$cpzone}. Error message: " . $e->getMessage() . " -- Trying again.");
+ unlink_if_exists($db_path);
+ try {
+ $DB = new SQLite3($db_path);
+ } catch (Exception $e) {
+ captiveportal_syslog("Still could not open {$db_path} as an sqlite database for {$cpzone}. Error message: " . $e->getMessage() . " -- Remove the database file manually and ensure there is enough free space.");
+ return;
+ }
+ }
+
$DB = new SQLite3($db_path);
if (!$DB) {
captiveportal_syslog("Could not open {$db_path} as an sqlite database for {$cpzone}. Error message: {$DB->lastErrorMsg()}. Trying again.");
OpenPOWER on IntegriCloud