From 9fe57dd2491093bc432e8baf221fa1792ed5ffa6 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Wed, 5 Apr 2023 10:54:56 +0200 Subject: [PATCH] argument check newer added to check all .tyto not yet checked in all domain --- src/var/lib/tyto/program/args.py | 4 ++-- src/var/lib/tyto/program/check.py | 23 ++++++++++++++++++++++- src/var/lib/tyto/program/db.py | 8 ++++++-- src/var/lib/tyto/program/stats.py | 2 +- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/var/lib/tyto/program/args.py b/src/var/lib/tyto/program/args.py index 86bba91..7914fa7 100644 --- a/src/var/lib/tyto/program/args.py +++ b/src/var/lib/tyto/program/args.py @@ -124,8 +124,8 @@ except: target = '' # Some conditions exiting -if action == "check" and target == "newer": - logs.out("11", '"%s" with "%s"'%(target, action), True) +#if action == "check" and target == "newer": +# logs.out("11", '"%s" with "%s"'%(target, action), True) # Set action and target for binary diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index 3931a5f..3c689d7 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -40,7 +40,7 @@ from datetime import datetime from time import gmtime, strftime import args, dom, logs, status, db, form, tyto, langs -post_err = False +domain_dir = post_err = False #=========================# @@ -82,8 +82,29 @@ def manage(target): # but check only if article source has changed # #----------------------------------------------# def check_all(option): + global domain_dir found = False + if option == "newer": + os.chdir(dom.articles_d) + domain_dir = True + + for root, dirs, files in os.walk(dom.articles_d[:-1]): + for file in files: + if (file.endswith('.tyto')): + uri_file = "%s/%s"%(root, file) + uri_id = tyto.get_filesum(uri_file, False) + args.target = uri_file.rsplit(dom.articles_d)[1] + db_config = "%s%s.config"%(dom.articles_db_d, uri_id) + if os.path.exists(db_config): + continue + + importlib.reload(db) + check_process(args.target) + print() + return + + for post_db in os.listdir(dom.articles_db_d): if post_db.endswith('.config'): # Load DB diff --git a/src/var/lib/tyto/program/db.py b/src/var/lib/tyto/program/db.py index 5e23f63..4aa9fda 100644 --- a/src/var/lib/tyto/program/db.py +++ b/src/var/lib/tyto/program/db.py @@ -34,11 +34,15 @@ #********************************************************************** import os -import args, logs, dom, form, tyto +import args, logs, dom, form, tyto, check remove = exists = post = corrupt = False -try: in_dir = os.getcwd() +try: + # with check newer, use domain root directory + if check.domain_dir: + os.chdir(dom.articles_d) + in_dir = os.getcwd() except: logs.out("13", '', True) diff --git a/src/var/lib/tyto/program/stats.py b/src/var/lib/tyto/program/stats.py index a3197f5..811484b 100644 --- a/src/var/lib/tyto/program/stats.py +++ b/src/var/lib/tyto/program/stats.py @@ -205,7 +205,7 @@ def create_stats_file(file_uri): 'quotes = %d\n'%stats["sti_quotes"] + \ 'lists = %d\n'%stats["sti_lists"] + \ '\n' + \ - '# Included files in article\'s contents\n' + \ + '# Included files in articles\' contents\n' + \ 'files = %d\n'%stats["sti_files"] + \ 'codes = %d\n'%stats["sti_codes"] + \ 'raws = %d\n'%stats["sti_raws"]