This commit is contained in:
xiaomlove
2022-04-06 21:32:57 +08:00
parent 03009c846e
commit 6ac7194d43
21 changed files with 659 additions and 66 deletions
+12 -5
View File
@@ -35,6 +35,7 @@ use Illuminate\Support\Facades\Redis;
use Illuminate\Support\Facades\Storage;
use JeroenG\Explorer\Domain\Syntax\Matching;
use JeroenG\Explorer\Infrastructure\Scout\ElasticEngine;
use Nexus\Database\NexusDB;
use Rhilip\Bencode\Bencode;
class Test extends Command
@@ -70,11 +71,11 @@ class Test extends Command
*/
public function handle()
{
$searchRep = new SearchRepository();
$r = $searchRep->deleteIndex();
$r = $searchRep->createIndex();
$r = $searchRep->import();
dd($r);
// $searchRep = new SearchRepository();
// $r = $searchRep->deleteIndex();
// $r = $searchRep->createIndex();
// $r = $searchRep->import();
// dd($r);
//
// $arr = [
// 'cat' => 'category',
@@ -129,6 +130,12 @@ class Test extends Command
// dd($today->diffInDays($yesterday));
// $r = get_smile(12);
// dd($r);
// $key = "dddd1";
// $model = \App\Models\TorrentSecret::query()->where('id', 1)->first();
// \Nexus\Database\NexusDB::cache_put($key, $model);
$value = NexusDB::cache_get("tracker_report_authkey_secret:1:10002");
dd($value);
}
+1 -1
View File
@@ -31,7 +31,7 @@ class Locale
/** @var Response $response */
$response = $next($request);
$response->header('Request-Id', nexus()->getRequestId());
$response->header('Request-Id', nexus()->getRequestId())->header('Running-In-Octane', RUNNING_IN_OCTANE ? 1 : 0);
return $response;
}
+8 -8
View File
@@ -167,10 +167,10 @@ class AttendanceRepository extends BaseRepository
while (true) {
$rows = $query->forPage($page, $size)->get();
$log = "sql: " . last_query() . ", count: " . $rows->count();
do_log($log, 'info', app()->runningInConsole());
do_log($log, 'info', isRunningInConsole());
if ($rows->isEmpty()) {
$log = "no more data....";
do_log($log, 'info', app()->runningInConsole());
do_log($log, 'info', isRunningInConsole());
break;
}
foreach ($rows as $row) {
@@ -182,7 +182,7 @@ class AttendanceRepository extends BaseRepository
->delete();
$log = "delete: $deleted by sql: " . last_query();
$deleteCounts += $deleted;
do_log($log, 'info', app()->runningInConsole());
do_log($log, 'info', isRunningInConsole());
} while ($deleted > 0);
}
$page++;
@@ -199,7 +199,7 @@ class AttendanceRepository extends BaseRepository
public function migrateAttendanceLogs($uid = 0): int
{
$cleanUpCounts = $this->cleanup();
do_log("cleanup count: $cleanUpCounts", 'info', app()->runningInConsole());
do_log("cleanup count: $cleanUpCounts", 'info', isRunningInConsole());
$page = 1;
$size = 10000;
@@ -214,7 +214,7 @@ class AttendanceRepository extends BaseRepository
$query->where('uid', $uid);
}
$result = $query->get();
do_log("$logPrefix, " . last_query() . ", count: " . $result->count(), 'info', app()->runningInConsole());
do_log("$logPrefix, " . last_query() . ", count: " . $result->count(), 'info', isRunningInConsole());
if ($result->isEmpty()) {
do_log("$logPrefix, no more data...");
break;
@@ -234,16 +234,16 @@ class AttendanceRepository extends BaseRepository
$page++;
}
if (empty($insert)) {
do_log("no data to insert...", 'info', app()->runningInConsole());
do_log("no data to insert...", 'info', isRunningInConsole());
return 0;
}
$sql = sprintf(
"insert into `%s` (`uid`, `points`, `date`) values %s on duplicate key update `points` = values(`points`)",
"insert into `%s` (`uid`, `points`, `date`) values %s on duplicate key update `uid` = values(`uid`)",
$table, implode(',', $insert)
);
NexusDB::statement($sql);
$insertCount = count($insert);
do_log("[MIGRATE_ATTENDANCE_LOGS] DONE! insert sql: " . $sql, 'info', app()->runningInConsole());
do_log("[MIGRATE_ATTENDANCE_LOGS] DONE! insert sql: " . $sql, 'info', isRunningInConsole());
return $insertCount;
}
+1 -1
View File
@@ -374,7 +374,7 @@ class SearchRepository extends BaseRepository
if (isset($response['errors']) && $response['errors'] == true) {
$msg .= var_export($response, true);
}
do_log($msg, 'info', app()->runningInConsole());
do_log($msg, 'info', isRunningInConsole());
}
private function getTorrentId($id): string
+8 -8
View File
@@ -373,14 +373,13 @@ class TorrentRepository extends BaseRepository
private function getTrackerReportAuthKeySecret($id, $uid, $initializeIfNotExists = false)
{
$secret = NexusDB::remember("tracker_report_authkey_secret:$id:$uid", 3600*24, function () use ($id, $uid) {
return TorrentSecret::query()
->where('uid', $uid)
->whereIn('torrent_id', [0, $id])
->orderBy('torrent_id', 'desc')
->orderBy('id', 'desc')
->first();
});
$secret = TorrentSecret::query()
->where('uid', $uid)
->whereIn('torrent_id', [0, $id])
->orderBy('torrent_id', 'desc')
->orderBy('id', 'desc')
->first();
if ($secret) {
return $secret->secret;
}
@@ -390,6 +389,7 @@ class TorrentRepository extends BaseRepository
'torrent_id' => 0,
'secret' => Str::random(),
];
do_log("[INSERT_TORRENT_SECRET] " . json_encode($insert));
TorrentSecret::query()->insert($insert);
return $insert['secret'];
}
+2 -1
View File
@@ -43,7 +43,8 @@
"masbug/flysystem-google-drive-ext": "^2.0",
"orangehill/iseed": "^3.0",
"phpgangsta/googleauthenticator": "dev-master",
"rhilip/bencode": "^2.0"
"rhilip/bencode": "^2.0",
"spiral/roadrunner": "^2.8"
},
"require-dev": {
"spatie/laravel-ignition": "^1.0",
Generated
+585 -1
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "b02476e07cdf83dfaf5a0006876a4b6d",
"content-hash": "c2165ad329850252029a213cde98e131",
"packages": [
{
"name": "asm89/stack-cors",
@@ -216,6 +216,93 @@
],
"time": "2021-10-28T20:44:15+00:00"
},
{
"name": "composer/semver",
"version": "3.3.1",
"source": {
"type": "git",
"url": "https://github.com/composer/semver.git",
"reference": "5d8e574bb0e69188786b8ef77d43341222a41a71"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/semver/zipball/5d8e574bb0e69188786b8ef77d43341222a41a71",
"reference": "5d8e574bb0e69188786b8ef77d43341222a41a71",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^5.3.2 || ^7.0 || ^8.0"
},
"require-dev": {
"phpstan/phpstan": "^1.4",
"symfony/phpunit-bridge": "^4.2 || ^5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.x-dev"
}
},
"autoload": {
"psr-4": {
"Composer\\Semver\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nils Adermann",
"email": "naderman@naderman.de",
"homepage": "http://www.naderman.de"
},
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
},
{
"name": "Rob Bast",
"email": "rob.bast@gmail.com",
"homepage": "http://robbast.nl"
}
],
"description": "Semver library that offers utilities, version constraint parsing and validation.",
"keywords": [
"semantic",
"semver",
"validation",
"versioning"
],
"support": {
"irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/semver/issues",
"source": "https://github.com/composer/semver/tree/3.3.1"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2022-03-16T11:22:07+00:00"
},
{
"name": "dflydev/dot-access-data",
"version": "v3.0.1",
@@ -5125,6 +5212,329 @@
},
"time": "2022-03-29T11:33:16+00:00"
},
{
"name": "spiral/goridge",
"version": "v3.1.2",
"source": {
"type": "git",
"url": "https://github.com/spiral/goridge-php.git",
"reference": "2c50b649b4296a3733f2ff5de339f41b9db57b04"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spiral/goridge-php/zipball/2c50b649b4296a3733f2ff5de339f41b9db57b04",
"reference": "2c50b649b4296a3733f2ff5de339f41b9db57b04",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"ext-json": "*",
"ext-sockets": "*",
"php": ">=7.4",
"symfony/polyfill-php80": "^1.22"
},
"require-dev": {
"google/protobuf": "^3.17",
"infection/infection": "^0.26.1",
"jetbrains/phpstorm-attributes": "^1.0",
"phpunit/phpunit": "^9.5",
"rybakit/msgpack": "^0.7",
"vimeo/psalm": "^4.18.1"
},
"suggest": {
"ext-msgpack": "MessagePack codec support",
"ext-protobuf": "Protobuf codec support",
"google/protobuf": "(^3.0) Protobuf codec support",
"rybakit/msgpack": "(^0.7) MessagePack codec support"
},
"type": "goridge",
"extra": {
"branch-alias": {
"dev-master": "3.2.x-dev"
}
},
"autoload": {
"psr-4": {
"Spiral\\Goridge\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Anton Titov / Wolfy-J",
"email": "wolfy.jd@gmail.com"
}
],
"description": "High-performance PHP-to-Golang RPC bridge",
"support": {
"issues": "https://github.com/spiral/goridge-php/issues",
"source": "https://github.com/spiral/goridge-php/tree/v3.1.2"
},
"time": "2022-01-13T08:13:33+00:00"
},
{
"name": "spiral/roadrunner",
"version": "v2.8.7",
"source": {
"type": "git",
"url": "https://github.com/roadrunner-server/roadrunner.git",
"reference": "de7b748278b9b626aa1dcf608b916a2b4e342f9b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/roadrunner-server/roadrunner/zipball/de7b748278b9b626aa1dcf608b916a2b4e342f9b",
"reference": "de7b748278b9b626aa1dcf608b916a2b4e342f9b",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"spiral/roadrunner-cli": "^2.0",
"spiral/roadrunner-http": "^2.0",
"spiral/roadrunner-worker": "^2.0"
},
"type": "metapackage",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Anton Titov / Wolfy-J",
"email": "wolfy.jd@gmail.com"
},
{
"name": "RoadRunner Community",
"homepage": "https://github.com/roadrunner-server/roadrunner/graphs/contributors"
}
],
"description": "RoadRunner: High-performance PHP application server, load-balancer and process manager written in Golang",
"support": {
"issues": "https://github.com/roadrunner-server/roadrunner/issues",
"source": "https://github.com/roadrunner-server/roadrunner/tree/v2.8.7"
},
"time": "2022-03-24T15:28:39+00:00"
},
{
"name": "spiral/roadrunner-cli",
"version": "v2.1.0",
"source": {
"type": "git",
"url": "https://github.com/spiral/roadrunner-cli.git",
"reference": "8a42aeed24939c64bccbaa179d473f9c57393dc1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spiral/roadrunner-cli/zipball/8a42aeed24939c64bccbaa179d473f9c57393dc1",
"reference": "8a42aeed24939c64bccbaa179d473f9c57393dc1",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"composer/semver": "^3.2",
"ext-json": "*",
"php": ">=7.4",
"spiral/roadrunner-worker": ">=2.0.2",
"symfony/console": "^4.4|^5.0|^6.0",
"symfony/http-client": "^4.4|^5.0|^6.0",
"symfony/polyfill-php80": "^1.22"
},
"require-dev": {
"jetbrains/phpstorm-attributes": "^1.0",
"symfony/var-dumper": "^4.4|^5.0",
"vimeo/psalm": "^4.4"
},
"bin": [
"bin/rr"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1.x-dev"
}
},
"autoload": {
"psr-4": {
"Spiral\\RoadRunner\\Console\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Anton Titov (wolfy-j)",
"email": "wolfy-j@spiralscout.com"
},
{
"name": "RoadRunner Community",
"homepage": "https://github.com/spiral/roadrunner/graphs/contributors"
}
],
"description": "RoadRunner: Command Line Interface",
"support": {
"issues": "https://github.com/spiral/roadrunner-cli/issues",
"source": "https://github.com/spiral/roadrunner-cli/tree/v2.1.0"
},
"time": "2022-01-20T07:51:22+00:00"
},
{
"name": "spiral/roadrunner-http",
"version": "v2.0.4",
"source": {
"type": "git",
"url": "https://github.com/spiral/roadrunner-http.git",
"reference": "2d76b779fba35036f3e8861dec2dad200a557970"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spiral/roadrunner-http/zipball/2d76b779fba35036f3e8861dec2dad200a557970",
"reference": "2d76b779fba35036f3e8861dec2dad200a557970",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"ext-json": "*",
"php": ">=7.4",
"psr/http-factory": "^1.0.1",
"psr/http-message": "^1.0.1",
"spiral/roadrunner-worker": "^2.0"
},
"require-dev": {
"jetbrains/phpstorm-attributes": "^1.0",
"nyholm/psr7": "^1.3",
"phpstan/phpstan": "~0.12",
"phpunit/phpunit": "~8.0",
"symfony/var-dumper": "^5.1",
"vimeo/psalm": "^4.4"
},
"suggest": {
"spiral/roadrunner-cli": "Provides RoadRunner installation and management CLI tools"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1.x-dev"
}
},
"autoload": {
"psr-4": {
"Spiral\\RoadRunner\\Http\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Anton Titov / Wolfy-J",
"email": "wolfy.jd@gmail.com"
},
{
"name": "RoadRunner Community",
"homepage": "https://github.com/spiral/roadrunner/graphs/contributors"
}
],
"description": "RoadRunner: HTTP and PSR-7 worker",
"support": {
"issues": "https://github.com/spiral/roadrunner-http/issues",
"source": "https://github.com/spiral/roadrunner-http/tree/v2.0.4"
},
"time": "2021-09-29T11:28:39+00:00"
},
{
"name": "spiral/roadrunner-worker",
"version": "v2.1.5",
"source": {
"type": "git",
"url": "https://github.com/spiral/roadrunner-worker.git",
"reference": "2247e374736506f5cf32295e15bee74b8e582031"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spiral/roadrunner-worker/zipball/2247e374736506f5cf32295e15bee74b8e582031",
"reference": "2247e374736506f5cf32295e15bee74b8e582031",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"composer-runtime-api": "^2.0",
"ext-json": "*",
"ext-sockets": "*",
"php": ">=7.4",
"psr/log": "^1.0|^2.0|^3.0",
"spiral/goridge": "^3.0",
"symfony/polyfill-php80": "^1.23"
},
"require-dev": {
"jetbrains/phpstorm-attributes": "^1.0",
"symfony/var-dumper": "^5.1",
"vimeo/psalm": "^4.4"
},
"suggest": {
"spiral/roadrunner-cli": "Provides RoadRunner installation and management CLI tools"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1.x-dev"
}
},
"autoload": {
"psr-4": {
"Spiral\\RoadRunner\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Anton Titov (wolfy-j)",
"email": "wolfy-j@spiralscout.com"
},
{
"name": "RoadRunner Community",
"homepage": "https://github.com/spiral/roadrunner/graphs/contributors"
}
],
"description": "RoadRunner: PHP worker",
"support": {
"issues": "https://github.com/spiral/roadrunner-worker/issues",
"source": "https://github.com/spiral/roadrunner-worker/tree/v2.1.5"
},
"time": "2021-11-30T08:54:52+00:00"
},
{
"name": "symfony/console",
"version": "v6.0.5",
@@ -5688,6 +6098,180 @@
],
"time": "2022-01-26T17:23:29+00:00"
},
{
"name": "symfony/http-client",
"version": "v6.0.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-client.git",
"reference": "a8f87328930932c455cffd048f965d1223d91915"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-client/zipball/a8f87328930932c455cffd048f965d1223d91915",
"reference": "a8f87328930932c455cffd048f965d1223d91915",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=8.0.2",
"psr/log": "^1|^2|^3",
"symfony/http-client-contracts": "^3",
"symfony/service-contracts": "^1.0|^2|^3"
},
"provide": {
"php-http/async-client-implementation": "*",
"php-http/client-implementation": "*",
"psr/http-client-implementation": "1.0",
"symfony/http-client-implementation": "3.0"
},
"require-dev": {
"amphp/amp": "^2.5",
"amphp/http-client": "^4.2.1",
"amphp/http-tunnel": "^1.0",
"amphp/socket": "^1.1",
"guzzlehttp/promises": "^1.4",
"nyholm/psr7": "^1.0",
"php-http/httplug": "^1.0|^2.0",
"psr/http-client": "^1.0",
"symfony/dependency-injection": "^5.4|^6.0",
"symfony/http-kernel": "^5.4|^6.0",
"symfony/process": "^5.4|^6.0",
"symfony/stopwatch": "^5.4|^6.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\HttpClient\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-client/tree/v6.0.5"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-02-27T08:47:28+00:00"
},
{
"name": "symfony/http-client-contracts",
"version": "v3.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-client-contracts.git",
"reference": "f7525778c712be78ad5b6ca31f47fdcfd404c280"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/f7525778c712be78ad5b6ca31f47fdcfd404c280",
"reference": "f7525778c712be78ad5b6ca31f47fdcfd404c280",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=8.0.2"
},
"suggest": {
"symfony/http-client-implementation": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.0-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
"psr-4": {
"Symfony\\Contracts\\HttpClient\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Generic abstractions related to HTTP clients",
"homepage": "https://symfony.com",
"keywords": [
"abstractions",
"contracts",
"decoupling",
"interfaces",
"interoperability",
"standards"
],
"support": {
"source": "https://github.com/symfony/http-client-contracts/tree/v3.0.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-03-13T20:10:05+00:00"
},
{
"name": "symfony/http-foundation",
"version": "v6.0.7",
+1 -1
View File
@@ -123,7 +123,7 @@ return [
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
'prefix' => '',
],
'default' => [
+3 -3
View File
@@ -35,7 +35,7 @@ return [
|
*/
'server' => env('OCTANE_SERVER', 'swoole'),
'server' => env('OCTANE_SERVER', 'roadrunner'),
/*
|--------------------------------------------------------------------------
@@ -74,11 +74,11 @@ return [
],
RequestHandled::class => [
//
],
RequestTerminated::class => [
//
],
TaskReceived::class => [
+7 -4
View File
@@ -9,9 +9,12 @@ defined('VERSION') || define("VERSION","Powered by <a href=\"aboutnexus.php\">".
defined('THISTRACKER') || define("THISTRACKER","General");
defined('ROOT_PATH') || define('ROOT_PATH', dirname(__DIR__) . '/');
if (!defined('RUNNING_IN_OCTANE')) {
if (!empty($_SERVER['PWD']) && str_contains($_SERVER['PWD'], 'vendor/laravel/octane/bin')) {
define('RUNNING_IN_OCTANE', true);
} else {
define('RUNNING_IN_OCTANE', false);
$runningInOctane = false;
foreach (($_SERVER['argv'] ?? []) as $command) {
if (preg_match('/swoole|roadrunner/i', $command)) {
$runningInOctane = true;
break;
}
}
define('RUNNING_IN_OCTANE', $runningInOctane);
}
+9 -8
View File
@@ -181,15 +181,20 @@ function do_log($log, $level = 'info', $echo = false)
if (($fd = fopen($logFile, 'a')) === false) {
$fd = fopen(sys_get_temp_dir() . '/nexus.log', 'a');
}
$uid = 0;
if (IN_NEXUS) {
global $CURUSER;
$user = $CURUSER;
$uid = $user['id'] ?? 0;
$passkey = $user['passkey'] ?? $_REQUEST['passkey'] ?? $_REQUEST['authkey'] ?? '';
} else {
$user = \Illuminate\Support\Facades\Auth::user();
$uid = $user->id ?? 0;
$passkey = $user->passkey ?? request('passkey', request('authkey', ''));
try {
$user = \Illuminate\Support\Facades\Auth::user();
$uid = $user->id ?? 0;
$passkey = $user->passkey ?? request('passkey', request('authkey', ''));
} catch (\Throwable $exception) {
$passkey = "!IN_NEXUS:" . $exception->getMessage();
}
}
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
$content = sprintf(
@@ -225,11 +230,7 @@ function getLogFile()
if (!is_null($logFile)) {
return $logFile;
}
if (IN_NEXUS) {
$config = nexus_config('nexus');
} else {
$config = config('nexus');
}
$config = nexus_config('nexus');
$logFile = sys_get_temp_dir() . '/nexus_' . date('Y-m-d') . '.log';
if (!empty($config['log_file'])) {
$logFile = $config['log_file'];
+2 -2
View File
@@ -316,8 +316,8 @@ $lang_functions = array
'text_tag_hdr' => 'HDR',
'text_required' => '不能为空',
'text_invalid' => '非法',
'text_technical_info' => '技术信息',
'text_technical_info_help_text' => '文件技术信息来自软件 <b><a href="https://mediaarea.net/en/MediaInfo" target=\'_blank\'>MediaInfo</a></b>,用该软件打开文件,点击菜单视图(View)->文件(Text),在框中右键->全选,再右键->复制,粘贴到这里来。',
'text_technical_info' => 'MediaInfo',
'text_technical_info_help_text' => '文件 MediaInfo 来自软件 <b><a href="https://mediaarea.net/en/MediaInfo" target=\'_blank\'>MediaInfo</a></b>,用该软件打开文件,点击菜单视图(View)->文件(Text),在框中右键->全选,再右键->复制,粘贴到这里来。',
'text_management_system' => '管理系统',
'text_seed_points' => '做种积分',
);
+2 -2
View File
@@ -706,8 +706,8 @@ $lang_settings = array
'text_login_secret_lifetime_unit' => '分钟',
'row_login_secret_lifetime' => '登录密钥有效期',
'text_login_secret_lifetime_deadline' => '当前密钥有效期至',
'row_enable_technical_info' => '启用技术信息',
'text_enable_technical_info' => "默认'否'。技术信息来自软件 <b><a href=\"https://mediaarea.net/en/MediaInfo\" target='_blank'>MediaInfo</a></b> Text 视图的结果",
'row_enable_technical_info' => '启用 MediaInfo',
'text_enable_technical_info' => "默认'否'。MediaInfo 来自软件 <b><a href=\"https://mediaarea.net/en/MediaInfo\" target='_blank'>MediaInfo</a></b> Text 视图的结果",
'row_sticky_first_level_background_color' => '一级置顶背景颜色',
'text_sticky_first_level_background_color_note' => '一级置顶背景颜色,不设置则无背景色。',
'row_sticky_second_level_background_color' => '二级置顶背景颜色',
+2 -2
View File
@@ -317,8 +317,8 @@ $lang_functions = array
'text_tag_hdr' => 'HDR',
'text_required' => '不能為空',
'text_invalid' => '非法',
'text_technical_info' => '技術信息',
'text_technical_info_help_text' => '文件技術信息來自軟件 <b><a href="https://mediaarea.net/en/MediaInfo" target=\'_blank\'>MediaInfo</a></b>,用該軟件打開文件,點擊菜單視圖(View)->文件(Text),在框中右鍵->全選,再右鍵->復制,粘貼到這裏來。',
'text_technical_info' => 'MediaInfo',
'text_technical_info_help_text' => '文件 MediaInfo 來自軟件 <b><a href="https://mediaarea.net/en/MediaInfo" target=\'_blank\'>MediaInfo</a></b>,用該軟件打開文件,點擊菜單視圖(View)->文件(Text),在框中右鍵->全選,再右鍵->復制,粘貼到這裏來。',
'text_management_system' => '管理系統',
'text_seed_points' => '做種積分',
);
+2 -2
View File
@@ -705,8 +705,8 @@ $lang_settings = array
'text_login_secret_lifetime_unit' => '分鐘',
'row_login_secret_lifetime' => '登錄密鑰有效期',
'text_login_secret_lifetime_deadline' => '當前密鑰有效期至',
'row_enable_technical_info' => '啟用技術信息',
'text_enable_technical_info' => "默認'否'。技術信息來自軟件 <b><a href=\"https://mediaarea.net/en/MediaInfo\" target='_blank'>MediaInfo</a></b> Text 視圖的結果",
'row_enable_technical_info' => '啟用 MediaInfo',
'text_enable_technical_info' => "默認'否'。MediaInfo 來自軟件 <b><a href=\"https://mediaarea.net/en/MediaInfo\" target='_blank'>MediaInfo</a></b> Text 視圖的結果",
'row_sticky_first_level_background_color' => '一級置頂背景顏色',
'text_sticky_first_level_background_color_note' => '一級置頂背景顏色,不設置則無背景色。',
'row_sticky_second_level_background_color' => '二級置頂背景顏色',
+2 -2
View File
@@ -318,8 +318,8 @@ $lang_functions = array
'text_tag_hdr' => 'HDR',
'text_required' => 'Required',
'text_invalid' => 'Invalid',
'text_technical_info' => 'Technical Info',
'text_technical_info_help_text' => 'Technical Information comes from software <b><a href="https://mediaarea.net/en/MediaInfo" target=\'_blank\'>MediaInfo</a></b>open file, click the view menu > text > right click in the box > select all > copy > past into this box.',
'text_technical_info' => 'MediaInfo',
'text_technical_info_help_text' => 'MediaInfo comes from software <b><a href="https://mediaarea.net/en/MediaInfo" target=\'_blank\'>MediaInfo</a></b>open file, click the view menu > text > right click in the box > select all > copy > past into this box.',
'text_management_system' => 'Management system',
'text_seed_points' => 'Seed points',
);
+2 -2
View File
@@ -705,8 +705,8 @@ $lang_settings = array
'text_login_secret_lifetime_unit' => 'minute',
'row_login_secret_lifetime' => 'Login secret lifetime',
'text_login_secret_lifetime_deadline' => 'Current login secret deadline',
'row_enable_technical_info' => 'Enable Technical Information',
'text_enable_technical_info' => "Default 'No'. Technical Information comes from software <b><a href=\"https://mediaarea.net/en/MediaInfo\" target='_blank'>MediaInfo</a></b> Text view",
'row_enable_technical_info' => 'Enable MediaInfo',
'text_enable_technical_info' => "Default 'No'. MediaInfo comes from software <b><a href=\"https://mediaarea.net/en/MediaInfo\" target='_blank'>MediaInfo</a></b> Text view",
'row_sticky_first_level_background_color' => 'Sticky first level bg color',
'text_sticky_first_level_background_color_note' => 'Sticky first level bg color, it will be none if not set.',
'row_sticky_second_level_background_color' => 'Sticky second level bg color',
+2 -2
View File
@@ -275,11 +275,11 @@ class NexusDB
global $Cache;
$result = $Cache->get_value($key);
if ($result === false) {
do_log("cache miss [$key], get from database.");
$result = $callback();
do_log("cache miss [$key]" );
$Cache->cache_value($key, $result, $ttl);
} else {
do_log("cache hit [$key].");
do_log("cache hit [$key]");
}
return $result;
} else {
+2 -1
View File
@@ -113,8 +113,10 @@ final class Nexus
public static function boot()
{
if (self::$booted) {
// file_put_contents('/tmp/reset.log', "booted\n",FILE_APPEND);
return;
}
// file_put_contents('/tmp/reset.log', "booting\n",FILE_APPEND);
$instance = new self();
$instance->setStartTimestamp();
$instance->setRequestId();
@@ -127,7 +129,6 @@ final class Nexus
public static function flush()
{
self::$booted = false;
}
private function setRequestId()
+3 -4
View File
@@ -44,15 +44,15 @@ if (!empty($_REQUEST['downhash'])) {
$letdown = intval($_GET['letdown'] ?? 0);
if (!$letdown && $CURUSER['showdlnotice'] == 1)
{
header("Location: " . get_protocol_prefix() . "$BASEURL/downloadnotice.php?torrentid=".$id."&type=firsttime");
nexus_redirect(getSchemeAndHttpHost() . "/downloadnotice.php?torrentid=".$id."&type=firsttime");
}
elseif (!$letdown && $CURUSER['showclienterror'] == 'yes')
{
header("Location: " . get_protocol_prefix() . "$BASEURL/downloadnotice.php?torrentid=".$id."&type=client");
nexus_redirect(getSchemeAndHttpHost() . "/downloadnotice.php?torrentid=".$id."&type=client");
}
elseif (!$letdown && $CURUSER['leechwarn'] == 'yes')
{
header("Location: " . get_protocol_prefix() . "$BASEURL/downloadnotice.php?torrentid=".$id."&type=ratio");
nexus_redirect(getSchemeAndHttpHost() . "/downloadnotice.php?torrentid=".$id."&type=ratio");
}
}
//User may choose to download torrent from RSS. So log ip changes when downloading torrents.
@@ -113,7 +113,6 @@ if (strlen($CURUSER['passkey']) != 32) {
$CURUSER['passkey'] = md5($CURUSER['username'].date("Y-m-d H:i:s").$CURUSER['passhash']);
sql_query("UPDATE users SET passkey=".sqlesc($CURUSER['passkey'])." WHERE id=".sqlesc($CURUSER['id']));
}
$trackerReportAuthKey = $torrentRep->getTrackerReportAuthKey($id, $CURUSER['id'], true);
$dict = \Rhilip\Bencode\Bencode::load($fn);
$dict['announce'] = $ssl_torrent . $base_announce_url . "?authkey=$trackerReportAuthKey";
+3 -6
View File
@@ -15,21 +15,18 @@ if ($_SERVER["REQUEST_METHOD"] == "POST")
if ($hidenotice){
sql_query("UPDATE users SET showdlnotice=0 WHERE id=".sqlesc($CURUSER['id']));
}
header("Location: " . get_protocol_prefix() . "$BASEURL/download.php?id=".$torrentid."&letdown=1");
die;
nexus_redirect(getSchemeAndHttpHost(). "/download.php?id=".$torrentid."&letdown=1");
}
elseif ($type == 'client')
{
if ($hidenotice){
sql_query("UPDATE users SET showclienterror='no' WHERE id=".sqlesc($CURUSER['id']));
}
header("Location: " . get_protocol_prefix() . "$BASEURL/download.php?id=".$torrentid."&letdown=1");
die;
nexus_redirect(getSchemeAndHttpHost() . "/download.php?id=".$torrentid."&letdown=1");
}
else
{
header("Location: " . get_protocol_prefix() . "$BASEURL/download.php?id=".$torrentid."&letdown=1");
die;
nexus_redirect(getSchemeAndHttpHost() . "/download.php?id=".$torrentid."&letdown=1");
}
}
else