* adjust for tid.

This commit is contained in:
wangyidong
2022-05-24 16:57:56 +08:00
parent 1926f2ee8d
commit 2bbae04ded
+18 -4
View File
@@ -3171,9 +3171,7 @@ class ztSessionHandler
($this->tagID and file_exists($this->rawFile)) ? copy($this->rawFile, $sessFile) : touch($sessFile);
}
$sessContent = (string) file_get_contents($sessFile);
if(!file_exists($this->rawFile) and strpos($sessContent, 'user|') !== false) copy($sessFile, $this->rawFile);
return $sessContent;
return (string) file_get_contents($sessFile);
}
/**
@@ -3187,7 +3185,23 @@ class ztSessionHandler
public function write($id, $sessData)
{
$sessFile = $this->getSessionFile($id);
if(file_put_contents($sessFile, $sessData)) return true;
if(file_put_contents($sessFile, $sessData))
{
if(strpos($sessData, 'user|') !== false)
{
if(file_exists($this->rawFile))
{
$rawSessContent = (string) file_get_contents($this->rawFile);
if(strpos($rawSessContent, 'user|') === false) copy($sessFile, $this->rawFile);
}
else
{
copy($sessFile, $this->rawFile);
}
}
return true;
}
return false;
}