mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 03:17:23 +08:00
prepare for v1.6.0-beta
This commit is contained in:
@@ -4,6 +4,7 @@ if(!defined('IN_TRACKER'))
|
||||
die('Hacking attempt!');
|
||||
|
||||
function printProgress($msg) {
|
||||
do_log($msg);
|
||||
echo $msg.'...done<br />';
|
||||
ob_flush();
|
||||
flush();
|
||||
|
||||
+1
-1
@@ -401,7 +401,7 @@ $SUBSPATH = "subs";
|
||||
//Make sure you have wget installed on your OS
|
||||
//replace "http://www.nexusphp.com/" with your own site address
|
||||
|
||||
$useCronTriggerCleanUp = config('use_cron_trigger_clean_up', false);
|
||||
$useCronTriggerCleanUp = config('nexus.use_cron_trigger_cleanup', false);
|
||||
//some promotion rules
|
||||
//$promotionrules_torrent = array(0 => array("mediumid" => array(1), "promotion" => 5), 1 => array("mediumid" => array(3), "promotion" => 5), 2 => array("catid" => array(402), "standardid" => array(3), "promotion" => 4), 3 => array("catid" => array(403), "standardid" => array(3), "promotion" => 4));
|
||||
$promotionrules_torrent = array();
|
||||
|
||||
+14
-11
@@ -2,6 +2,18 @@
|
||||
if(!defined('IN_TRACKER')) {
|
||||
die('Hacking attempt!');
|
||||
}
|
||||
define('ROOT_PATH', $rootpath);
|
||||
define('VERSION_NUMBER', '1.6.0');
|
||||
define('IS_ANNOUNCE', (basename($_SERVER['SCRIPT_FILENAME']) == 'announce.php'));
|
||||
if (!empty($_SERVER['HTTP_X_REQUEST_ID'])) {
|
||||
define('REQUEST_ID', $_SERVER['HTTP_X_REQUEST_ID']);
|
||||
} else {
|
||||
define('REQUEST_ID', intval(NEXUS_START * 10000));
|
||||
}
|
||||
ini_set('date.timezone', config('nexus.timezone'));
|
||||
ini_set('error_reporting', E_ALL);
|
||||
ini_set('display_errors', 0);
|
||||
|
||||
if (!file_exists($rootpath . '.env')) {
|
||||
$installScriptRelativePath = 'install/install.php';
|
||||
$installScriptFile = $rootpath . "public/$installScriptRelativePath";
|
||||
@@ -10,16 +22,8 @@ if (!file_exists($rootpath . '.env')) {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 0);
|
||||
if (!empty($_SERVER['HTTP_X_REQUEST_ID'])) {
|
||||
define('REQUEST_ID', $_SERVER['HTTP_X_REQUEST_ID']);
|
||||
} else {
|
||||
define('REQUEST_ID', intval(NEXUS_START * 10000));
|
||||
}
|
||||
define('ROOT_PATH', $rootpath);
|
||||
define('VERSION_NUMBER', '1.6.0');
|
||||
define('IS_ANNOUNCE', (basename($_SERVER['SCRIPT_FILENAME']) == 'announce.php'));
|
||||
|
||||
|
||||
require $rootpath . 'vendor/autoload.php';
|
||||
require $rootpath . 'nexus/Database/helpers.php';
|
||||
require $rootpath . 'classes/class_advertisement.php';
|
||||
@@ -31,7 +35,6 @@ if (!IS_ANNOUNCE) {
|
||||
$Cache = new class_cache_redis(); //Load the caching class
|
||||
$Cache->setLanguageFolderArray(get_langfolder_list());
|
||||
define('TIMENOW', time());
|
||||
define('TIMENOW_STRING', date('Y-m-d H:i:s'));
|
||||
$USERUPDATESET = array();
|
||||
$query_name=array();
|
||||
|
||||
|
||||
@@ -1870,19 +1870,21 @@ function userlogin() {
|
||||
function autoclean() {
|
||||
global $autoclean_interval_one, $rootpath;
|
||||
$now = TIMENOW;
|
||||
|
||||
$res = sql_query("SELECT value_u FROM avps WHERE arg = 'lastcleantime'");
|
||||
$row = mysql_fetch_array($res);
|
||||
if (!$row) {
|
||||
do_log("SELECT value_u FROM avps WHERE arg = 'lastcleantime', empty");
|
||||
sql_query("INSERT INTO avps (arg, value_u) VALUES ('lastcleantime',$now)") or sqlerr(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
$ts = $row[0];
|
||||
if ($ts + $autoclean_interval_one > $now) {
|
||||
do_log("ts: {$ts} + autoclean_interval_one: $autoclean_interval_one > now: $now");
|
||||
return false;
|
||||
}
|
||||
sql_query("UPDATE avps SET value_u=$now WHERE arg='lastcleantime' AND value_u = $ts") or sqlerr(__FILE__, __LINE__);
|
||||
if (!mysql_affected_rows()) {
|
||||
do_log("UPDATE avps SET value_u=$now WHERE arg='lastcleantime' AND value_u = $ts, affectedRows = 0");
|
||||
return false;
|
||||
}
|
||||
require_once($rootpath . 'include/cleanup.php');
|
||||
|
||||
@@ -5,15 +5,7 @@ if(!defined('IN_TRACKER'))
|
||||
|
||||
function dbconn_announce() {
|
||||
|
||||
$config = config('database.mysql');
|
||||
|
||||
if (!@mysql_connect($config['host'], $config['username'], $config['password'], $config['database'], $config['port']))
|
||||
{
|
||||
die('dbconn: mysql_connect: ' . mysql_error());
|
||||
}
|
||||
mysql_query("SET NAMES UTF8");
|
||||
mysql_query("SET collation_connection = 'utf8_general_ci'");
|
||||
mysql_query("SET sql_mode=''");
|
||||
\Nexus\Database\DB::getInstance()->autoConnect();
|
||||
}
|
||||
|
||||
function hash_where_arr($name, $hash_arr) {
|
||||
|
||||
@@ -147,18 +147,14 @@ function dd($vars)
|
||||
|
||||
function do_log($log, $level = 'info')
|
||||
{
|
||||
global $TWEAK;
|
||||
$logging = sys_get_temp_dir() . '/nexus_' . date('Y-m-d') . '.log';
|
||||
if (!empty($TWEAK['logging'])) {
|
||||
$logging = $TWEAK['logging'];
|
||||
}
|
||||
if (($fd = fopen($logging, 'a')) !== false) {
|
||||
$logFile = getLogFile();
|
||||
if (($fd = fopen($logFile, 'a')) !== false) {
|
||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
|
||||
$content = sprintf(
|
||||
"[%s] [%s] [%s] %s:%s %s%s%s %s%s",
|
||||
date('Y-m-d H:i:s'),
|
||||
$level,
|
||||
REQUEST_ID,
|
||||
defined('REQUEST_ID') ? REQUEST_ID : '',
|
||||
$backtrace[0]['file'] ?? '',
|
||||
$backtrace[0]['line'] ?? '',
|
||||
$backtrace[1]['class'] ?? '',
|
||||
@@ -172,6 +168,43 @@ function do_log($log, $level = 'info')
|
||||
}
|
||||
}
|
||||
|
||||
function getLogFile()
|
||||
{
|
||||
static $logFile;
|
||||
if (!is_null($logFile)) {
|
||||
return $logFile;
|
||||
}
|
||||
$config = config('nexus');
|
||||
$logFile = sys_get_temp_dir() . '/nexus_' . date('Y-m-d') . '.log';
|
||||
if (!empty($config['log_file'])) {
|
||||
$logFile = $config['log_file'];
|
||||
}
|
||||
$validSplit = ['daily', 'monthly'];
|
||||
if (empty($config['log_split']) || !in_array($config['log_split'], $validSplit)) {
|
||||
return $logFile;
|
||||
}
|
||||
$lastDotPos = strrpos($logFile, '.');
|
||||
if ($lastDotPos !== false) {
|
||||
$prefix = substr($logFile, 0, $lastDotPos);
|
||||
$suffix = substr($logFile, $lastDotPos);
|
||||
} else {
|
||||
$prefix = $logFile;
|
||||
$suffix = '';
|
||||
}
|
||||
switch ($config['log_split']) {
|
||||
case 'daily':
|
||||
$logFile = sprintf('%s-%s%s', $prefix, date('Y-m-d'), $suffix);
|
||||
break;
|
||||
case 'monthly':
|
||||
$logFile = sprintf('%s-%s%s', $prefix, date('Ym'), $suffix);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return $logFile;
|
||||
|
||||
}
|
||||
|
||||
function config($key, $default = null)
|
||||
{
|
||||
static $configs;
|
||||
|
||||
Reference in New Issue
Block a user