mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
up
This commit is contained in:
+2
-2
@@ -23,11 +23,11 @@ class ORM:
|
||||
try:
|
||||
try:
|
||||
self.__DB_CONN = connector.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
|
||||
port=self.__DB_PORT, charset="utf8", connect_timeout=1, unix_socket=socket)
|
||||
port=self.__DB_PORT, charset="utf8", connect_timeout=1, unix_socket=self.__DB_SOCKET)
|
||||
except Exception as e:
|
||||
self.__DB_HOST = '127.0.0.1'
|
||||
self.__DB_CONN = connector.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
|
||||
port=self.__DB_PORT, charset="utf8", connect_timeout=1, unix_socket=socket)
|
||||
port=self.__DB_PORT, charset="utf8", connect_timeout=1, unix_socket=self.__DB_SOCKET)
|
||||
|
||||
self.__DB_CUR = self.__DB_CONN.cursor()
|
||||
return True
|
||||
|
||||
@@ -18,8 +18,7 @@ root_dir = os.path.dirname(os.path.dirname(plugin_dir))
|
||||
sys.path.append(root_dir + "/class/core")
|
||||
import mw
|
||||
|
||||
sys.path.append(plugin_dir + "/class")
|
||||
import orm
|
||||
os.chdir(root_dir)
|
||||
|
||||
|
||||
def getPluginName():
|
||||
@@ -54,8 +53,11 @@ def getConf():
|
||||
|
||||
|
||||
def pMysqlDb():
|
||||
db = orm.ORM()
|
||||
db = mw.getMyORM()
|
||||
db.setDbConf(getConf())
|
||||
db.__DB_SOCKET = mw.getServerDir() + '/mysql/mysql.socket'
|
||||
|
||||
print(mw.getServerDir() + '/mysql/mysql.socket')
|
||||
db.setPwd(pSqliteDb('config').where('id=?', (1,)).getField('mysql_root'))
|
||||
return db
|
||||
|
||||
|
||||
Reference in New Issue
Block a user