changeset 965:b6d1384e1b2c draft

s4-newworld fixed so that account sychronization done at the time
author HIROSE Yuuji <yuuji@gentei.org>
date Sun, 20 Feb 2022 15:37:50 +0900
parents 759070ee3d20
children 679f621de4b5
files s4-funcs.sh s4-newworld.sh s4-world.sh
diffstat 3 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/s4-funcs.sh	Sun Feb 20 08:47:31 2022 +0900
+++ b/s4-funcs.sh	Sun Feb 20 15:37:50 2022 +0900
@@ -33,7 +33,7 @@
 querylog=${QUERYLOG:-$logdir/query.log}
 searchlog=${SEARCHLOG:-$logdir/search.log}
 defaultdb=$dbdir/cgi.sq3
-db=${DB:-$defaultdb}
+db=${S4INITDB:-${DB:-$defaultdb}}
 sessdb=${SESSDB:-$dbdir/sess.sq3}
 userupdateflag=$dbdir/userupdate
 sesstb=tmp.sess
--- a/s4-newworld.sh	Sun Feb 20 08:47:31 2022 +0900
+++ b/s4-newworld.sh	Sun Feb 20 15:37:50 2022 +0900
@@ -34,7 +34,7 @@
 echo "wl=$S4WORLDLIST"
 echo "$dispname:$shortname:$desc"
 # Create config
-DB=db/$shortname.sq3; export DB
+S4INITDB=db/$shortname.sq3; export S4INITDB
 `dirname $0`/s4-init.sh
 . `dirname $0`/s4-config.sh
 if ! type htmlescape >/dev/null 2>&1; then
@@ -54,6 +54,7 @@
 
 masterdb=`(unset DB; . ./s4-config.sh; echo $DB)`
 S4MASTERDB=${masterdb:-db/cgi.sq3}
+DB=$newdb; export DB
 echo Synching account: db=$db URL=$URL isCGI=$isCGI mas=$S4MASTERDB
 . ./s4-world.sh && syncaccount 'force'
 echo Synching done
@@ -67,9 +68,8 @@
 	S4MASTERURL=\$URL
 	URL=`dirname ${URL}.`/s4-world-$shortname$cgiext
 	S4COLOR="$bgcolor"			# Change this!
+	S4MASTERDB=\$DB				# \$DB always points to master
 	DB=$dbdir/$shortname.sq3
-	SESSDB=$dbdir/sess.sq3
-	S4MASTERDB=$S4MASTERDB
 	S4CSS=$shortname.css
 	TMPDIR=$tmpdir/$shortname
 EOF
--- a/s4-world.sh	Sun Feb 20 08:47:31 2022 +0900
+++ b/s4-world.sh	Sun Feb 20 15:37:50 2022 +0900
@@ -80,7 +80,11 @@
   err "`gdate +%S.%3N` Starting account synchronization"
   SYNC_M=1
 
-  prevsync=`tail -1 $syncflag|colrm 20`	# 2020-06-21 12:30:00 = 19cols
+  if [ -s "$syncflag" ]; then
+    prevsync=`tail -1 $syncflag|colrm 20`	# 2020-06-21 12:30:00 = 19cols
+  else
+    prevsync="2000-01-01 00:00:00"
+  fi
   syncall=${db%.*}.syncall
   err syncallfile=$syncall
   if [ -e $syncall ]; then
@@ -173,7 +177,8 @@
   runflag=${db%.*}.run
   userupdateflag=`dirname $S4MASTERDB`/`basename $userupdateflag`
   test ! -e "$userupdateflag"			&& return
-  [ -z "$forceusersync" -a "$syncflag" -nt "$userupdateflag" ] && return
+  [ -z "$forceusersync" -a -f "$syncflag" -a \
+       "$syncflag" -nt "$userupdateflag" ] && return
   if [ -s "$runflag" ]; then
     limit=`cat $runflag|tr -c -d 0-9`
     err syncaccount: limit=$limit

yatex.org