Database of article check.

This commit is contained in:
Cyrille L 2023-03-17 16:59:31 +01:00
parent b0d409f849
commit a968b13d27
2 changed files with 66 additions and 6 deletions

View File

@ -104,6 +104,58 @@ domain_values = \
'domain_active',
)
# Values in article's database
article_values = \
(
'post_id',
'post_src',
'post_wip',
'post_www',
'direc_src',
'short_src',
'short_srv',
'sub_uri',
'http_wip',
'http_www',
'date_chk',
'hash_chk',
'date_wip',
'hash_wip',
'date_www',
'hash_www',
'title',
'about',
'author',
'tags',
'date',
'snpic',
'uris',
'uniq_anchors',
'uniq_abbrs',
'uniq_links',
'uniq_images',
'uniq_files',
'uniq_raws',
'stat_tags',
'stat_words',
'stat_titles',
'stat_paragraphs',
'stat_anchors',
'stat_strongs',
'stat_bolds',
'stat_emphasis',
'stat_italics',
'stat_dels',
'stat_underlines',
'stat_cites',
'stat_customs',
'stat_icodes',
'stat_bcodes',
'stat_quotes',
'stat_lists'
)
# If error in DB, continue process for these options
domain_pass_args = \
(
@ -158,6 +210,8 @@ else:
logs.out("43", domain_conf, False)
domain_show = True
#==================#
#------------------#
# ARTICLE DATABASE #
@ -179,10 +233,8 @@ if args.target \
# DB
post_db = '%s%s.conf'%(articles_db, uri_id)
if os.path.exists(post_db):
db_exists = True
else:
db_exists = False
if os.path.exists(post_db): db_exists = True
else: db_exists = False
# Article
if os.path.exists(uri_file):
@ -199,12 +251,19 @@ if args.target \
elif os.stat(post_db).st_size < 1000:
db_remove = True
logs.out('23', post_db, False)
else:
exec(open(post_db).read(),globals())
# Check if database conf is valid
for conf in article_values:
try: eval(str(conf))
except: db_remove = True
if db_remove:
os.remove(post_db)
db_exists = False
else:
exec(open(post_db).read(),globals())
logs.out("23", post_db, False)
# Set Statuses for chk, wip, www
if db_exists:

View File

@ -45,6 +45,7 @@ def out(nbr, value, out):
'13' : ':< %sNo file or directory%s here (deleted ?)'%(CR, CS),
'14' : ':< %sMismatch%s program start'%(CR, CS),
'15' : ':< Anchor %snot uniq%s: %s'%(CR, CS, value),
'16' : ':< %sUnused database configuration%s: %s'%(CR, CS, value),
'19' : ':D Article %swip%s on: %s'%(CG, CS, value),
'20' : ':D Article %scheck%s on: %s'%(CG, CS, value),
'21' : ':D Article %sValid%s. Ready to wip'%(CG, CS),