fix a new bug in tmp_dir

pull/493/head
qkqpttgf 2021-12-06 10:39:45 +08:00 committed by GitHub
parent 646c963eba
commit 108b14261c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -616,12 +616,12 @@ function filecache($disktag)
{ {
$dir = sys_get_temp_dir(); $dir = sys_get_temp_dir();
if (!is_writable($dir)) { if (!is_writable($dir)) {
$tmp = $_SERVER['HTTP_HOST'] . '/tmp/'; $tmp = __DIR__ . '/tmp/';
if (file_exists($tmp)) { if (file_exists($tmp)) {
if ( is_writable($tmp) ) $dir = $tmp; if ( is_writable($tmp) ) $dir = $tmp;
} elseif ( mkdir($tmp) ) $dir = $tmp; } elseif ( mkdir($tmp) ) $dir = $tmp;
} }
$tag = __DIR__ . '/OneManager/' . $disktag; $tag = $_SERVER['HTTP_HOST'] . '/OneManager/' . $disktag;
while (strpos($tag, '/')>-1) $tag = str_replace('/', '_', $tag); while (strpos($tag, '/')>-1) $tag = str_replace('/', '_', $tag);
if (strpos($tag, ':')>-1) { if (strpos($tag, ':')>-1) {
$tag = str_replace(':', '_', $tag); $tag = str_replace(':', '_', $tag);