changeset 625:74c0c2ed8ff5

New variable WHATSNEWDAYS limits the number of days of new article.
author HIROSE Yuuji <yuuji@gentei.org>
date Wed, 22 Apr 2020 07:09:19 +0900
parents 64c84bc00700
children 99863f97dee6
files s4-funcs.sh
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/s4-funcs.sh	Tue Apr 21 12:27:02 2020 +0900
+++ b/s4-funcs.sh	Wed Apr 22 07:09:19 2020 +0900
@@ -48,6 +48,7 @@
 [編集]リンクから修正してください。"
 blogreadflagrowid=0
 blogcutoffflagrowid=-1
+whatsnewdays=${WHATS_NEW_DAYS:-14}
 querylog=$tmpdir/query.log
 searchlog=$tmpdir/search.log
 
@@ -1772,12 +1773,17 @@
 EOF
 }
 listnewblogsql() { # $1=user
+  newdays=${WHATS_NEW_DAYS##*[!0-9]}	# Shave non-digits
+  newdays=${newdays%%[!0-9]*}
+  newdays=${newdays:-14}
+  basetime="datetime('now', 'localtime', '-${newdays} days')"
   deftime=`query "SELECT coalesce((SELECT max(time) FROM acclog
 		  	 	   WHERE user='$user'
 				    AND tblrowid IN
 				      ($blogreadflagrowid,
 				       $blogcutoffflagrowid)),
-				  "0");"`
+				  $basetime		-- "0"
+				  );"`
   cat<<EOF
 `sql4interestblogs`
 WITH article_ctime as (

yatex.org