mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 08:09:41 +00:00
Services: Captive Portal - minor improvments, make sure to initialize database if cp_clients table doesn't exist
This commit is contained in:
parent
58387deddb
commit
8fbf2dd7f9
@ -55,7 +55,7 @@ class SessionController extends ApiControllerBase
|
||||
"captiveportal list_clients",
|
||||
array($cpZone->zoneid, 'json')
|
||||
);
|
||||
$allClients = json_decode($allClientsRaw, true);
|
||||
$allClients = json_decode($allClientsRaw ?? '', true);
|
||||
|
||||
return $allClients;
|
||||
} else {
|
||||
|
||||
@ -70,7 +70,7 @@ class DB(object):
|
||||
self._connection = sqlite3.connect(self.database_filename)
|
||||
|
||||
cur = self._connection.cursor()
|
||||
cur.execute('SELECT count(*) FROM sqlite_master')
|
||||
cur.execute("SELECT count(*) FROM sqlite_master where tbl_name = 'cp_clients'")
|
||||
if cur.fetchall()[0][0] == 0:
|
||||
# empty database, initialize database
|
||||
init_script_filename = '%s/../sql/init.sql' % os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user