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()
|
||||
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 \
|
||||
and args.action in args.pass_db \
|
||||
and not args.target in args.pass_targets:
|
||||
|
@ -38,7 +39,7 @@ if args.target \
|
|||
uri_file = '%s/%s'%(in_dir, args.target)
|
||||
uri_id = tyto.get_filesum(uri_file, False)
|
||||
|
||||
# DB
|
||||
# Set DB file
|
||||
config = '%s%s.config'%(dom.articles_db_d, uri_id)
|
||||
if tyto.exists(config):
|
||||
exists = True
|
||||
|
@ -46,7 +47,7 @@ if args.target \
|
|||
else:
|
||||
exists = False
|
||||
|
||||
# Article
|
||||
# Article file exists
|
||||
if tyto.exists(uri_file):
|
||||
post = True
|
||||
hash_post = tyto.get_filesum(uri_file, True)
|
||||
|
@ -55,9 +56,8 @@ if args.target \
|
|||
remove = True
|
||||
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:
|
||||
# Check if database config is valid (contains values)
|
||||
values = \
|
||||
(
|
||||
'post_id',
|
||||
|
@ -107,6 +107,7 @@ if args.target \
|
|||
'stat_quotes',
|
||||
'stat_lists'
|
||||
)
|
||||
|
||||
for value in values:
|
||||
try:
|
||||
eval(str(value))
|
||||
|
@ -115,6 +116,7 @@ if args.target \
|
|||
corrupt = True
|
||||
break
|
||||
|
||||
# Remove DB if unused source article or corrupted DB
|
||||
if remove and exists:
|
||||
os.remove(config)
|
||||
exists = False
|
||||
|
@ -145,4 +147,5 @@ if args.target \
|
|||
if not hash_wip: no_wip = True
|
||||
if not hash_www: no_www = True
|
||||
|
||||
# Article is updated on both servers
|
||||
if hash_chk == hash_wip == hash_www: sync_srvs = True
|
||||
|
|
Loading…
Reference in New Issue