From 70d2a6511ff2a7c76efc7ceb357c7dfb6f1a3a71 Mon Sep 17 00:00:00 2001 From: Mike Hibler Date: Wed, 7 Jan 2015 17:02:32 -0700 Subject: [PATCH] Mike's attempt to fix FS export problem. --- www/tbauth.php3 | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/www/tbauth.php3 b/www/tbauth.php3 index a6b40edc6..9739d1e50 100644 --- a/www/tbauth.php3 +++ b/www/tbauth.php3 @@ -1115,17 +1115,33 @@ function DOLOGIN_MAGIC($uid, $uid_idx, $email = null, # if ($WITHZFS && $ZFS_NOEXPORT) { $query_result = - DBQueryFatal("select UNIX_TIMESTAMP(weblogin_last) ". + DBQueryFatal("select UNIX_TIMESTAMP(weblogin_last),weblogin_last ". " from users as u ". "left join user_stats as s on s.uid_idx=u.uid_idx ". "where u.uid_idx='$uid_idx'"); if (mysql_num_rows($query_result)) { $lastrow = mysql_fetch_row($query_result); $lastlogin = $lastrow[0]; + $lastloginstr = $lastrow[1]; if (time() - $lastlogin > (24 * 3600)) { - SUEXEC("nobody", "nobody", "webexports_setup", - SUEXEC_ACTION_DIE); + # Update weblogin_last first so exports_setup + # will do something. + DBQueryFatal("update user_stats set ". + " weblogin_last=now() ". + "where uid_idx='$uid_idx'"); + + $rv = SUEXEC("nobody", "nobody", "webexports_setup", + SUEXEC_ACTION_IGNORE); + + # failed, reset the timestamp + if ($rv) { + DBQueryFatal("update user_stats set ". + " weblogin_last='$lastloginstr' ". + "where uid_idx='$uid_idx'"); + SUEXECERROR(SUEXEC_ACTION_DIE); + return; + } } } } -- GitLab