From 2af632ef078e83568c7d9f5ab08b00d9ef2e406d Mon Sep 17 00:00:00 2001 From: midoks Date: Sat, 25 Jun 2022 22:42:06 +0800 Subject: [PATCH] Update index.py --- plugins/gogs/index.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/plugins/gogs/index.py b/plugins/gogs/index.py index ef1a786a1..c1d255575 100755 --- a/plugins/gogs/index.py +++ b/plugins/gogs/index.py @@ -260,13 +260,25 @@ def pSqliteDb(conf): return psDb +def getGogsDbType(conf): + + if 'DB_TYPE' in conf: + return conf['DB_TYPE'] + + if 'TYPE' in conf: + return conf['TYPE'] + + return 'NONE' + + def pQuery(sql): conf = getDbConfValue() - if conf['DB_TYPE'] == 'sqlite3': + gtype = getGogsDbType(conf) + if gtype == 'sqlite3': db = pSqliteDb(conf) data = db.query(sql, []).fetchall() return data - elif conf['DB_TYPE'] == 'mysql': + elif gtype == 'mysql': db = pMysqlDb(conf) return db.query(sql)