diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index be898f22c..bf70c253b 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -127,7 +127,21 @@ 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 + 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(';')