db. Updated code
This commit is contained in:
parent
2d13d4ea8a
commit
9404393975
|
@ -26,8 +26,9 @@ remove = exists = post = corrupt = False
|
||||||
try: in_dir = os.getcwd()
|
try: in_dir = os.getcwd()
|
||||||
except: logs.out("13", '', True)
|
except: logs.out("13", '', True)
|
||||||
|
|
||||||
in_dir = os.getcwd()
|
# target needs db (file).
|
||||||
|
# action like show, wip, edit-db
|
||||||
|
# not domain, all, again...
|
||||||
if args.target \
|
if args.target \
|
||||||
and args.action in args.pass_db \
|
and args.action in args.pass_db \
|
||||||
and not args.target in args.pass_targets:
|
and not args.target in args.pass_targets:
|
||||||
|
@ -38,7 +39,7 @@ if args.target \
|
||||||
uri_file = '%s/%s'%(in_dir, args.target)
|
uri_file = '%s/%s'%(in_dir, args.target)
|
||||||
uri_id = tyto.get_filesum(uri_file, False)
|
uri_id = tyto.get_filesum(uri_file, False)
|
||||||
|
|
||||||
# DB
|
# Set DB file
|
||||||
config = '%s%s.config'%(dom.articles_db_d, uri_id)
|
config = '%s%s.config'%(dom.articles_db_d, uri_id)
|
||||||
if tyto.exists(config):
|
if tyto.exists(config):
|
||||||
exists = True
|
exists = True
|
||||||
|
@ -46,7 +47,7 @@ if args.target \
|
||||||
else:
|
else:
|
||||||
exists = False
|
exists = False
|
||||||
|
|
||||||
# Article
|
# Article file exists
|
||||||
if tyto.exists(uri_file):
|
if tyto.exists(uri_file):
|
||||||
post = True
|
post = True
|
||||||
hash_post = tyto.get_filesum(uri_file, True)
|
hash_post = tyto.get_filesum(uri_file, True)
|
||||||
|
@ -55,9 +56,8 @@ if args.target \
|
||||||
remove = True
|
remove = True
|
||||||
logs.out("1", uri_file, False)
|
logs.out("1", uri_file, False)
|
||||||
|
|
||||||
# Remove DB if unused source article or corrupted DB
|
# Check if database config is valid (contains values)
|
||||||
if exists:
|
if exists:
|
||||||
# Check if database config is valid (contains values)
|
|
||||||
values = \
|
values = \
|
||||||
(
|
(
|
||||||
'post_id',
|
'post_id',
|
||||||
|
@ -107,6 +107,7 @@ if args.target \
|
||||||
'stat_quotes',
|
'stat_quotes',
|
||||||
'stat_lists'
|
'stat_lists'
|
||||||
)
|
)
|
||||||
|
|
||||||
for value in values:
|
for value in values:
|
||||||
try:
|
try:
|
||||||
eval(str(value))
|
eval(str(value))
|
||||||
|
@ -115,6 +116,7 @@ if args.target \
|
||||||
corrupt = True
|
corrupt = True
|
||||||
break
|
break
|
||||||
|
|
||||||
|
# Remove DB if unused source article or corrupted DB
|
||||||
if remove and exists:
|
if remove and exists:
|
||||||
os.remove(config)
|
os.remove(config)
|
||||||
exists = False
|
exists = False
|
||||||
|
@ -145,4 +147,5 @@ if args.target \
|
||||||
if not hash_wip: no_wip = True
|
if not hash_wip: no_wip = True
|
||||||
if not hash_www: no_www = True
|
if not hash_www: no_www = True
|
||||||
|
|
||||||
|
# Article is updated on both servers
|
||||||
if hash_chk == hash_wip == hash_www: sync_srvs = True
|
if hash_chk == hash_wip == hash_www: sync_srvs = True
|
||||||
|
|
Loading…
Reference in New Issue