public static function get_lwlogline($day = false) { if (!$day) { $timestamp = time(); $ymd = date('Ymd', $timestamp); $logfile = BASE_PATH . "./api/data/log/lwlog{$ymd}.php"; } else { $logfile = BASE_PATH . "./api/data/log/lwlog{$day}.php"; } $line = countfileline($logfile); return $line; }
function includesqlfile() { $sqlfile = PATH_CONFIG . '/cfg_dbfile.php'; $filestatus = file_exists($sqlfile) && ($fileline = countfileline($sqlfile)); $fileline = $fileline ? $fileline - 1 : 0; $dirs = scandir(PATH_DB); $newline = count($dirs); $filestr = ''; if ($filestatus || $newline > $fileline) { $filestr .= '<?php' . "\n"; foreach ($dirs as $v) { if ($v !== '.' && $v !== '..') { $newdir = "PATH_DB . " . "'/{$v}'"; $filestr .= "\trequire_once({$newdir});\n"; } } $fp = @fopen($sqlfile, 'wb'); fwrite($fp, $filestr); fclose($fp); } return $sqlfile; }