pull/26/head
Aidaho12 2018-07-26 10:14:09 +06:00
parent 05fe5a64d5
commit cc139aa36c
3 changed files with 8 additions and 6 deletions

View File

@ -64,7 +64,7 @@ def get_cur():
else: else:
return con, cur return con, cur
def create_table(): def create_table(**kwargs):
con, cur = get_cur() con, cur = get_cur()
if mysql_enable == '0': if mysql_enable == '0':
sql = """ sql = """
@ -137,7 +137,11 @@ def create_table():
try: try:
cur.executescript(sql) cur.executescript(sql)
except sqltool.Error as e: except sqltool.Error as e:
print("An error occurred:", e) if kwargs.get('silent') != 1:
if e.args[0] == 'column email is not unique' or e == "1060 (42S21): column email is not unique' ":
print('Updating... go to version 2.0.1<br />')
else:
print("An error occurred:", e)
return False return False
else: else:
return True return True
@ -261,7 +265,7 @@ def update_db_v_2_5_3(**kwargs):
if kwargs.get('silent') != 1: if kwargs.get('silent') != 1:
print("DB was update to 2.5.3<br />") print("DB was update to 2.5.3<br />")
sql2 = """ sql2 = """
insert into `cred` (`enable`,`username`,`password`) values ('1', 'root','password'); insert or ignore into `cred` (id, `enable`,`username`,`password`) values ('1', '1', 'root','password');
""" """
cur.execute(sql2) cur.execute(sql2)
con.commit() con.commit()
@ -335,7 +339,7 @@ def update_db_v_2_6(**kwargs):
`username` VARCHAR ( 64 ) NOT NULL, `username` VARCHAR ( 64 ) NOT NULL,
`password` VARCHAR ( 64 ) NOT NULL `password` VARCHAR ( 64 ) NOT NULL
); );
INSERT INTO cred_id (enable, username, password) select enable, username, password from cred; INSERT INTO cred_id (id, enable, username, password) select id, enable, username, password from cred;
drop table cred; drop table cred;
ALTER TABLE cred_id RENAME to cred; ALTER TABLE cred_id RENAME to cred;
""" """

View File

@ -185,7 +185,6 @@ cat << EOF > /etc/logrotate.d/checker
missingok missingok
notifempty notifempty
sharedscripts sharedscripts
endscript
} }
EOF EOF

View File

@ -46,7 +46,6 @@ $(pwd)/log/checker-error.log {
missingok missingok
notifempty notifempty
sharedscripts sharedscripts
endscript
} }
EOF EOF