From 3b8c0d82ad39a46dba7a8a8d30ed24a11147d3d1 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 14 May 2020 18:05:43 +0800 Subject: [PATCH] add runtime mem in foot string --- common.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/common.php b/common.php index e29c121..60f61bd 100644 --- a/common.php +++ b/common.php @@ -153,6 +153,7 @@ function main($path) global $exts; global $constStr; + $_SERVER['php_starttime'] = microtime(true); $path = path_format($path); if (in_array($_SERVER['firstacceptlanguage'], array_keys($constStr['languages']))) { $constStr['language'] = $_SERVER['firstacceptlanguage']; @@ -1737,7 +1738,7 @@ function render_list($path = '', $files = '') date_default_timezone_set(get_timezone($_SERVER['timezone'])); $authinfo = ''; $theme = getConfig('theme'); @@ -2005,8 +2006,10 @@ function render_list($path = '', $files = '') if ($ext==$key1) { $FolderListStr = str_replace('', $value1, $FolderListStr); } + //error_log('file:'.$file['name'].':'.$key1); + if (!strpos($FolderListStr, '')) break; } - $FolderListStr = str_replace('', $IconValues['default'], $FolderListStr); + if (strpos($FolderListStr, '')) $FolderListStr = str_replace('', $IconValues['default'], $FolderListStr); while (strpos($FolderListStr, '')) $FolderListStr = str_replace('', $filenum, $FolderListStr); $html .= $FolderListStr; } @@ -2196,9 +2199,6 @@ function render_list($path = '', $files = '') while (strpos($html, '')) $html = str_replace('', getconstStr('UploadFile'), $html); while (strpos($html, '')) $html = str_replace('', getconstStr('UploadFolder'), $html); while (strpos($html, '')) $html = str_replace('', (isset($_GET['preview'])?'?preview&':'?'), $html); - - - $html = str_replace('', date("Y-m-d H:i:s")." ".getconstStr('Week')[date("w")]." ".$_SERVER['REMOTE_ADDR'], $html); $tmp = splitfirst($html, ''); $html = $tmp[0]; @@ -2415,9 +2415,11 @@ function render_list($path = '', $files = '') // 最后清除换行 while (strpos($html, "\r\n\r\n")) $html = str_replace("\r\n\r\n", "\r\n", $html); //while (strpos($html, PHP_EOL.PHP_EOL)) $html = str_replace(PHP_EOL.PHP_EOL, PHP_EOL, $html); - + + $exetime = round(microtime(true)-$_SERVER['php_starttime'],3); + $html = str_replace('', date("Y-m-d H:i:s")." ".getconstStr('Week')[date("w")]." ".$_SERVER['REMOTE_ADDR'].' Runtime:'.$exetime.'s Mem:'.size_format(memory_get_usage()), $html); } - + $html = $authinfo . $html; if (isset($_SERVER['Set-Cookie'])) return output($html, $statusCode, [ 'Set-Cookie' => $_SERVER['Set-Cookie'], 'Content-Type' => 'text/html' ]); return output($html,$statusCode);