s4

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 diff
     1.1 --- a/s4-funcs.sh	Tue Apr 21 12:27:02 2020 +0900
     1.2 +++ b/s4-funcs.sh	Wed Apr 22 07:09:19 2020 +0900
     1.3 @@ -48,6 +48,7 @@
     1.4  [編集]リンクから修正してください。"
     1.5  blogreadflagrowid=0
     1.6  blogcutoffflagrowid=-1
     1.7 +whatsnewdays=${WHATS_NEW_DAYS:-14}
     1.8  querylog=$tmpdir/query.log
     1.9  searchlog=$tmpdir/search.log
    1.10  
    1.11 @@ -1772,12 +1773,17 @@
    1.12  EOF
    1.13  }
    1.14  listnewblogsql() { # $1=user
    1.15 +  newdays=${WHATS_NEW_DAYS##*[!0-9]}	# Shave non-digits
    1.16 +  newdays=${newdays%%[!0-9]*}
    1.17 +  newdays=${newdays:-14}
    1.18 +  basetime="datetime('now', 'localtime', '-${newdays} days')"
    1.19    deftime=`query "SELECT coalesce((SELECT max(time) FROM acclog
    1.20  		  	 	   WHERE user='$user'
    1.21  				    AND tblrowid IN
    1.22  				      ($blogreadflagrowid,
    1.23  				       $blogcutoffflagrowid)),
    1.24 -				  "0");"`
    1.25 +				  $basetime		-- "0"
    1.26 +				  );"`
    1.27    cat<<EOF
    1.28  `sql4interestblogs`
    1.29  WITH article_ctime as (