Update www status in DB when sync
This commit is contained in:
parent
2c43e68445
commit
0b5d8f0dec
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
}
|
Loading…
Reference in New Issue