stats: added show-wip/show-www argument to read srv pages statistics
This commit is contained in:
parent
35794a8ae8
commit
532c63dbdd
|
@ -18,7 +18,7 @@
|
|||
#**********************************************************************
|
||||
|
||||
import os, importlib
|
||||
import args, db, logs, domain, tyto, check
|
||||
import args, db, logs, domain, tyto, check, stats
|
||||
|
||||
|
||||
#======================#
|
||||
|
@ -56,22 +56,29 @@ def manage_show(target):
|
|||
}
|
||||
|
||||
elif args.action in actions_wip:
|
||||
do = {
|
||||
"domain" : db.domain_conf,
|
||||
"footer" : db.wip_footer,
|
||||
"metas" : db.wip_metas,
|
||||
"navbar" : db.wip_navbar,
|
||||
"sidebar" : db.wip_sidebar
|
||||
}
|
||||
if target == 'stats':
|
||||
stats.manage_stats('wip')
|
||||
return
|
||||
|
||||
do = {
|
||||
"domain" : db.domain_conf,
|
||||
"footer" : db.wip_footer,
|
||||
"metas" : db.wip_metas,
|
||||
"navbar" : db.wip_navbar,
|
||||
"sidebar" : db.wip_sidebar
|
||||
}
|
||||
|
||||
elif args.action in actions_www:
|
||||
do = {
|
||||
"domain" : db.domain_conf,
|
||||
"footer" : db.www_footer,
|
||||
"metas" : db.www_metas,
|
||||
"navbar" : db.www_navbar,
|
||||
"sidebar" : db.www_sidebar
|
||||
}
|
||||
if target == 'stats':
|
||||
stats.manage_stats('www')
|
||||
return
|
||||
do = {
|
||||
"domain" : db.domain_conf,
|
||||
"footer" : db.www_footer,
|
||||
"metas" : db.www_metas,
|
||||
"navbar" : db.www_navbar,
|
||||
"sidebar" : db.www_sidebar
|
||||
}
|
||||
|
||||
# Target is a post uri
|
||||
#---------------------
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
#**********************************************************************
|
||||
|
||||
import os, importlib
|
||||
import args, logs, db, domain, tyto
|
||||
import args, logs, db, domain, tyto, show
|
||||
|
||||
sti_anchors = sti_abbrs = sti_links = 0
|
||||
sti_images = sti_files = sti_raws = 0
|
||||
sti_tags = sti_words = sti_titles = sti_paragraphs = sti_anclinks = 0
|
||||
sti_strongs = sti_bolds = sti_emphasis = sti_italics = sti_dels = 0
|
||||
sti_underlines = sti_cites = sti_customs = sti_icodes = 0
|
||||
sti_bcodes = sti_quotes = sti_lists = sti_articles = 0
|
||||
sti_bcodes = sti_quotes = sti_lists = 0
|
||||
|
||||
|
||||
#=======================#
|
||||
|
@ -34,20 +34,6 @@ sti_bcodes = sti_quotes = sti_lists = sti_articles = 0
|
|||
def manage_stats(process):
|
||||
domain.domain_needed()
|
||||
|
||||
do = {
|
||||
'wip' : loop_articles,
|
||||
'publish' : loop_articles,
|
||||
'show-wip' : count_stats, # NO
|
||||
'show_www' : count_stats, # NO
|
||||
}
|
||||
|
||||
do[args.action](process)
|
||||
|
||||
|
||||
#==========================#
|
||||
# Check databases' article #
|
||||
#--------------------------#
|
||||
def loop_articles(process):
|
||||
global file_uri, domain_srv
|
||||
global sti_articles
|
||||
|
||||
|
@ -57,6 +43,23 @@ def loop_articles(process):
|
|||
elif process == 'www':
|
||||
file_uri = '%s%s'%(db.srv_www, tyto.stats_f)
|
||||
domain_srv = db.domain_www_url
|
||||
|
||||
do = {
|
||||
'wip' : loop_articles,
|
||||
'publish' : loop_articles,
|
||||
'show-wip' : show_stats,
|
||||
'show-www' : show_stats
|
||||
}
|
||||
|
||||
do[args.action](process)
|
||||
|
||||
|
||||
#==========================#
|
||||
# Check databases' article #
|
||||
#--------------------------#
|
||||
def loop_articles(process):
|
||||
global sti_articles
|
||||
sti_articles = 0
|
||||
|
||||
# Get databases of wip's articles
|
||||
for post_db in os.listdir(db.articles_db):
|
||||
|
@ -72,6 +75,7 @@ def loop_articles(process):
|
|||
if process == 'wip': hash_srv = db.hash_wip
|
||||
elif process == 'www': hash_srv = db.hash_www
|
||||
|
||||
# Now generic for wip/www
|
||||
if not hash_srv: continue
|
||||
|
||||
print(':> [%s] | %s'%(db.title, db.post_src))
|
||||
|
@ -135,6 +139,7 @@ def create_stats_file(file_uri):
|
|||
sti = \
|
||||
'# Statistics file created by %s\n'%tyto.Tyto + \
|
||||
'# Website: %s\n'%domain_srv + \
|
||||
'# File: %s\n'%file_uri + \
|
||||
'# Generated: %s\n'%tyto.nowdate() + \
|
||||
'\n' + \
|
||||
'# Uniq statistics from articles\' headers\n' + \
|
||||
|
@ -167,3 +172,10 @@ def create_stats_file(file_uri):
|
|||
|
||||
tyto.set_file(file_uri, 'New', sti)
|
||||
logs.out("33", file_uri, False)
|
||||
|
||||
|
||||
#======================================#
|
||||
# Show statistics from pages on server #
|
||||
#--------------------------------------#
|
||||
def show_stats(process):
|
||||
show.read_lines(file_uri)
|
||||
|
|
Loading…
Reference in New Issue