stats for statoolinfos. wip/publish OK. Fix db check for publish
This commit is contained in:
parent
57b401da70
commit
35794a8ae8
|
@ -18,7 +18,7 @@
|
|||
#**********************************************************************
|
||||
|
||||
import os, sys, shutil, importlib
|
||||
import logs, args, db, html, tyto, domain
|
||||
import logs, args, db, html, tyto, domain, stats
|
||||
|
||||
|
||||
#==============================#
|
||||
|
@ -39,7 +39,8 @@ def manage_publish(target):
|
|||
'navbar' : html.create_navbar,
|
||||
'metas' : html.create_user_metas,
|
||||
'footer' : html.create_user_footer,
|
||||
'template' : create_template
|
||||
'template' : create_template,
|
||||
'stats' : stats.manage_stats
|
||||
}
|
||||
|
||||
do[target]('www')
|
||||
|
@ -63,9 +64,9 @@ def manage_publish(target):
|
|||
if db.hash_wip:
|
||||
# wip and current article have different hash
|
||||
if db.hash_post != db.hash_chk:
|
||||
logs.out("25", db.uri_file, False)
|
||||
logs.out("9", db.uri_file, False)
|
||||
err_pub = True
|
||||
elif db.hash_post != db.hash_wip:
|
||||
elif db.hash_wip != db.hash_chk:
|
||||
logs.out("30", db.uri_file, False)
|
||||
err_pub = True
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ def manage_stats(process):
|
|||
|
||||
do = {
|
||||
'wip' : loop_articles,
|
||||
'www' : loop_articles,
|
||||
'publish' : loop_articles,
|
||||
'show-wip' : count_stats, # NO
|
||||
'show_www' : count_stats, # NO
|
||||
}
|
||||
|
@ -60,7 +60,8 @@ def loop_articles(process):
|
|||
|
||||
# Get databases of wip's articles
|
||||
for post_db in os.listdir(db.articles_db):
|
||||
if post_db.endswith('.conf'):
|
||||
if not post_db.endswith('.conf'): continue
|
||||
|
||||
# Load DB
|
||||
post_db = '%s%s'%(db.articles_db, post_db)
|
||||
exec(open(post_db).read(),globals())
|
||||
|
@ -68,25 +69,24 @@ def loop_articles(process):
|
|||
importlib.reload(db)
|
||||
|
||||
# Check hash status (wip/www)
|
||||
# wip
|
||||
if process == 'wip':
|
||||
if not db.hash_wip: continue
|
||||
if process == 'wip': hash_srv = db.hash_wip
|
||||
elif process == 'www': hash_srv = db.hash_www
|
||||
|
||||
if not hash_srv: continue
|
||||
|
||||
print(':> [%s] | %s'%(db.title, db.post_src))
|
||||
|
||||
# Article has changed and could have different stats
|
||||
if not db.hash_wip == db.hash_chk:
|
||||
if hash_srv != db.hash_chk:
|
||||
logs.out("9", db.post_src, False)
|
||||
continue
|
||||
|
||||
sti_articles += 1
|
||||
count_stats()
|
||||
|
||||
# www
|
||||
elif process == 'www':
|
||||
if not db.hash_www: continue
|
||||
|
||||
create_stats_file(file_uri)
|
||||
# Create file if article
|
||||
if sti_articles > 0: create_stats_file(file_uri)
|
||||
else: logs.out("28", '(%s stats)'%process, True)
|
||||
|
||||
|
||||
#================================#
|
||||
|
|
Loading…
Reference in New Issue