mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-20 08:25:50 +08:00
up
This commit is contained in:
+18
-11
@@ -129,20 +129,27 @@ def contentReplace(content):
|
||||
def pSqliteDb(dbname='databases'):
|
||||
file = getServerDir() + '/mysql.db'
|
||||
name = 'mysql'
|
||||
if not os.path.exists(file):
|
||||
|
||||
import_sql = mw.readFile(getPluginDir() + '/conf/mysql.sql')
|
||||
md5_sql = mw.md5(import_sql)
|
||||
|
||||
import_sign = False
|
||||
save_md5_file = getServerDir() + '/import_sql.md5'
|
||||
if os.path.exists(save_md5_file):
|
||||
save_md5_sql = mw.readFile(save_md5_file)
|
||||
if save_md5_sql != md5_sql:
|
||||
import_sign = True
|
||||
mw.writeFile(save_md5_file, md5_sql)
|
||||
else:
|
||||
mw.writeFile(save_md5_file, md5_sql)
|
||||
|
||||
if not os.path.exists(file) or import_sql:
|
||||
conn = mw.M(dbname).dbPos(getServerDir(), name)
|
||||
csql = mw.readFile(getPluginDir() + '/conf/mysql.sql')
|
||||
csql_list = csql.split(';')
|
||||
csql_list = import_sql.split(';')
|
||||
for index in range(len(csql_list)):
|
||||
conn.execute(csql_list[index], ())
|
||||
else:
|
||||
# 现有run
|
||||
# conn = mw.M(dbname).dbPos(getServerDir(), name)
|
||||
# csql = mw.readFile(getPluginDir() + '/conf/mysql.sql')
|
||||
# csql_list = csql.split(';')
|
||||
# for index in range(len(csql_list)):
|
||||
# conn.execute(csql_list[index], ())
|
||||
conn = mw.M(dbname).dbPos(getServerDir(), name)
|
||||
|
||||
conn = mw.M(dbname).dbPos(getServerDir(), name)
|
||||
return conn
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user