remove composer autoload files

This commit is contained in:
xiaomlove
2022-03-18 19:59:27 +08:00
parent ab1ed60f44
commit 8c32b45e64
12 changed files with 82 additions and 25 deletions
+2
View File
@@ -3,6 +3,8 @@ define('NEXUS_START', microtime(true));
define('IN_NEXUS', true);
$rootpath = dirname(__DIR__) . '/';
set_include_path(get_include_path() . PATH_SEPARATOR . $rootpath);
require $rootpath . 'include/globalfunctions.php';
require $rootpath . 'include/functions.php';
require $rootpath . 'include/core.php';
require $rootpath . 'classes/class_advertisement.php';
require $rootpath . 'classes/class_attendance.php';
+5 -3
View File
@@ -1,7 +1,9 @@
<?php
define('NEXUS_START', microtime(true));
define('IN_NEXUS', true);
defined('NEXUS_START') || define('NEXUS_START', microtime(true));
defined('IN_NEXUS') || define('IN_NEXUS', true);
defined('IN_TRACKER') || define('IN_TRACKER', true);
$rootpath= dirname(__DIR__) . '/';
require_once $rootpath . 'include/globalfunctions.php';
require_once $rootpath . 'include/functions_announce.php';
require $rootpath . 'include/core.php';
require $rootpath . 'include/functions_announce.php';
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
require __DIR__ . '/constants.php';
require_once __DIR__ . '/constants.php';
require $rootpath . 'vendor/autoload.php';
if (!file_exists($rootpath . '.env')) {
$installScriptRelativePath = 'install/install.php';
+1
View File
@@ -336,4 +336,5 @@ function check_client($peer_id, $agent, &$agent_familyid)
return "Banned Client, Please goto $BASEURL/faq.php#id29 for a list of acceptable clients";
}
}
?>
+24 -12
View File
@@ -159,20 +159,11 @@ function do_log($log, $level = 'info')
if (is_null($setLogLevel)) {
$setLogLevel = nexus_env('LOG_LEVEL', 'debug');
}
$logLevels = [
\Psr\Log\LogLevel::DEBUG,
\Psr\Log\LogLevel::INFO,
\Psr\Log\LogLevel::NOTICE,
\Psr\Log\LogLevel::WARNING,
\Psr\Log\LogLevel::ERROR,
\Psr\Log\LogLevel::CRITICAL,
\Psr\Log\LogLevel::ALERT,
\Psr\Log\LogLevel::EMERGENCY,
];
$logLevels = ['debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert', 'emergency'];
$setLogLevelKey = array_search($setLogLevel, $logLevels);
$currentLogLevelKey = array_search($level, $logLevels);
if ($currentLogLevelKey === false) {
$level = \Psr\log\LogLevel::ERROR;
$level = 'error';
$log = "[ERROR_LOG_LEVEL] $log";
$currentLogLevelKey = array_search($level, $logLevels);
}
@@ -310,7 +301,7 @@ function nexus_env($key = null, $default = null)
{
static $env;
if (is_null($env)) {
$envFile = defined('ROOT_PATH') ? ROOT_PATH . '.env' : base_path('.env');
$envFile = dirname(__DIR__) . '/.env';
$env = readEnvFile($envFile);
}
if (is_null($key)) {
@@ -678,3 +669,24 @@ function get_hr_ratio($uped, $downed)
return $ratio;
}
function request_local_announce_api($announceApiLocalHost)
{
$start = microtime(true);
$ch = curl_init();
$options = [
CURLOPT_URL => sprintf('%s/api/announce?%s', trim($announceApiLocalHost, '/'), $_SERVER['QUERY_STRING']),
CURLOPT_USERAGENT => $_SERVER["HTTP_USER_AGENT"],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_TIMEOUT => 60,
];
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
$log = sprintf(
"[LOCAL_ANNOUNCE_API] [%s] options: %s, response(%s): %s",
number_format(microtime(true) - $start, 3), json_encode($options), gettype($response), $response
);
do_log($log);
return $response;
}