diff options
| author | 2015-09-04 03:44:40 +0000 | |
|---|---|---|
| committer | 2015-09-04 03:44:40 +0000 | |
| commit | acdcedfa7099659be22df3dd57ec4926809dc1a6 (patch) | |
| tree | 0c1c03c2e0a6c98ef9f7a8f934f2d56a86b1f46e /config-default | |
| parent | 266be47956ae2ad397c52f26d00b88b5dc713da6 (diff) | |
Allow running without a database
This is mostly a workaround for the DB being a bit of a PITA to set up,
but not all we do requires a DB so we might as well offer to run without
one.
Diffstat (limited to 'config-default')
| -rw-r--r-- | config-default/commands.xml | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/config-default/commands.xml b/config-default/commands.xml index 5674fac..6e12076 100644 --- a/config-default/commands.xml +++ b/config-default/commands.xml @@ -123,6 +123,11 @@ </command> <command cmd="^;sql (main|log) (.*)" flag="d"> <![CDATA[ + if (!defined $::db) { + $conn->privmsg($event->replyto, "I am set to run without a database, fool."); + return; + } + my $dbh = $::db->{DBH}; if ($1 eq 'log') { $dbh = $::db->{DBH_LOG}; @@ -175,6 +180,7 @@ </command> <command cmd="^;query (\S+) ?(\S+)?$"> <![CDATA[ + return unless defined $::db; my $channel = defined($2) ? $1 : '%'; my @nuh = split(/(\!|\@)/, defined($2) ? $2 : $1); my $result = $::db->query($channel, $nuh[0], $nuh[2], $nuh[4]); @@ -183,6 +189,7 @@ </command> <command cmd="^;investigate (\S+) *$"> <