diff --git a/usr/local/bin/stl b/usr/local/bin/stl index 9837478..17dcbe7 100755 --- a/usr/local/bin/stl +++ b/usr/local/bin/stl @@ -78,6 +78,7 @@ if__file "$stl_dir_scripts/manage__logs" source if__file "$stl_dir_scripts/manage__db" source if__file "$stl_dir_scripts/manage__HTML" source if__file "$stl_dir_scripts/manage__sidebar" source +if__file "$stl_dir_scripts/manage__stats" source if__file "$stl_dir_scripts/check__article" source if__file "$stl_dir_scripts/wip__article" source diff --git a/var/lib/stl/scripts/manage__HTML b/var/lib/stl/scripts/manage__HTML index 48ac938..d0c3c2e 100644 --- a/var/lib/stl/scripts/manage__HTML +++ b/var/lib/stl/scripts/manage__HTML @@ -258,6 +258,9 @@ domain__get create__RSS_feed rsync -a --exclude ".*" "$domain_dir_wip/" "$domain_dir_www/" +# Create www hash status in DB +db__get_wip_articles "set_www_hash" # manage__db + # Log this_article="$domain_dir_www" log__add -i -M WWW "Synced WIP server to WWW server" diff --git a/var/lib/stl/scripts/manage__db b/var/lib/stl/scripts/manage__db index 9aef301..d11e08f 100644 --- a/var/lib/stl/scripts/manage__db +++ b/var/lib/stl/scripts/manage__db @@ -188,3 +188,35 @@ rm -f "$db_rmp_list" exit } + +#====================================================================== +# Get articles from database, with wip status +# Generic function to : +# - "set www_hash" for stl sync +# - get stats +# $1: set_www_hash +#====================================================================== +db__get_wip_articles() { +while IFS=: read -r 'file' 'article_wip' +do + echo "> $article_wip" + [[ `awk -F= '{print $2}' <<<"$article_wip"` -gt 0 ]] \ + || continue + + source "$file" + + # From sync_wip_to_www() ; manage__HTML + case "$1" in + set_www_hash) + if ! [[ $article_www_hash == $article_wip_hash ]];then + sed -i "s^article_www_hash=.*^article_www_hash=$article_wip_hash^" "$file" + + # Log + this_article="$domain_dir_www$article_uri_srv" + log__add -i -W -A "Added online: $article_title" + fi + ;; + esac + +done < <(grep -H "article_wip_hash" "$domain_db_articles/"*.db) +} diff --git a/var/lib/stl/scripts/manage__logs b/var/lib/stl/scripts/manage__logs index 8629b5f..9fc5334 100644 --- a/var/lib/stl/scripts/manage__logs +++ b/var/lib/stl/scripts/manage__logs @@ -66,6 +66,7 @@ esac case "$2" in -C) log_f2="Check" ;; -M) log_f2="WIP" ;; + -W) log_f2="WWW" ;; -S) log_f2="Sidebar" ;; -db) log_f2="Database" ;; *) log_f2="$2" diff --git a/var/lib/stl/scripts/manage__stats b/var/lib/stl/scripts/manage__stats new file mode 100644 index 0000000..adae360 --- /dev/null +++ b/var/lib/stl/scripts/manage__stats @@ -0,0 +1,15 @@ +#!/bin/bash +# Name: Statique Littérateur +# Type: Manage Statistics (statoolinfos, and more) +# file: manage__stats +# Folder: /var/lib/stl/scripts/ +# By echolib (XMPP: im@echolib.re) +# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 + + +#====================================================================== +# Argument: stats +#====================================================================== +stats__OPTIONS() { +echo "! Working in progress" +}