From 81121c84a7afc5efbe2f3d5a617f1fb3d7f7efc6 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 23 Jun 2025 15:01:27 +0800 Subject: [PATCH 1/2] * [perf story #75382] init session file. --- framework/base/router.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/framework/base/router.class.php b/framework/base/router.class.php index e4cb9f62a7..2322e50702 100644 --- a/framework/base/router.class.php +++ b/framework/base/router.class.php @@ -3892,6 +3892,9 @@ class ztSessionHandler implements SessionHandlerInterface { $sessFile = $this->getSessionFile($id); if(!$sessFile) return true; + + if(!file_exists($sessFile)) touch($sessFile); + if(!file_exists($sessFile) || !is_writable($sessFile)) return true; if(md5_file($sessFile) == md5($sessData)) return true; if(file_put_contents($sessFile, $sessData, LOCK_EX)) return true; From 7daa0bad40469006660f6880d3b6fa6f2bb58f42 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 23 Jun 2025 15:17:29 +0800 Subject: [PATCH 2/2] * [perf story #75382] init session file. --- framework/base/router.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/framework/base/router.class.php b/framework/base/router.class.php index 2322e50702..3b0c43af6e 100644 --- a/framework/base/router.class.php +++ b/framework/base/router.class.php @@ -3893,9 +3893,8 @@ class ztSessionHandler implements SessionHandlerInterface $sessFile = $this->getSessionFile($id); if(!$sessFile) return true; - if(!file_exists($sessFile)) touch($sessFile); - - if(!file_exists($sessFile) || !is_writable($sessFile)) return true; + if(!is_file($sessFile) && !touch($sessFile)) return true; + if(!is_writable($sessFile)) return true; if(md5_file($sessFile) == md5($sessData)) return true; if(file_put_contents($sessFile, $sessData, LOCK_EX)) return true; return true;