add runtime mem in foot string

pull/62/head
qkqpttgf 2020-05-14 18:05:43 +08:00 committed by GitHub
parent 938d7cfda1
commit 3b8c0d82ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 7 deletions

View File

@ -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 = '<!--
OneManager: An index & manager of Onedrive auth by ysun.
Github https://github.com/qkqpttgf/OneManager-php
Github: https://github.com/qkqpttgf/OneManager-php
-->';
$theme = getConfig('theme');
@ -2005,8 +2006,10 @@ function render_list($path = '', $files = '')
if ($ext==$key1) {
$FolderListStr = str_replace('<!--IconValue-->', $value1, $FolderListStr);
}
//error_log('file:'.$file['name'].':'.$key1);
if (!strpos($FolderListStr, '<!--IconValue-->')) break;
}
$FolderListStr = str_replace('<!--IconValue-->', $IconValues['default'], $FolderListStr);
if (strpos($FolderListStr, '<!--IconValue-->')) $FolderListStr = str_replace('<!--IconValue-->', $IconValues['default'], $FolderListStr);
while (strpos($FolderListStr, '<!--filenum-->')) $FolderListStr = str_replace('<!--filenum-->', $filenum, $FolderListStr);
$html .= $FolderListStr;
}
@ -2197,9 +2200,6 @@ function render_list($path = '', $files = '')
while (strpos($html, '<!--constStr@UploadFolder-->')) $html = str_replace('<!--constStr@UploadFolder-->', getconstStr('UploadFolder'), $html);
while (strpos($html, '<!--IsPreview?-->')) $html = str_replace('<!--IsPreview?-->', (isset($_GET['preview'])?'?preview&':'?'), $html);
$html = str_replace('<!--FootStr-->', date("Y-m-d H:i:s")." ".getconstStr('Week')[date("w")]." ".$_SERVER['REMOTE_ADDR'], $html);
$tmp = splitfirst($html, '<!--BackgroundStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--BackgroundEnd-->');
@ -2416,6 +2416,8 @@ 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('<!--FootStr-->', 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;