Skip to content

Commit

Permalink
fix cleanup do not run under secret login
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomlove committed Apr 10, 2022
1 parent b7c1102 commit 8216cb3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
7 changes: 1 addition & 6 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,10 @@ protected function prepareJsonResponse($request, Throwable $e)
{
$data = $request->all();
$httpStatusCode = $this->getHttpStatusCode($e);
if ($httpStatusCode == 200) {
$msg = $e->getMessage() ?: get_class($e);
} else {
$msg = 'Server Error';
}
$msg = $e->getMessage();
$trace = $e->getTraceAsString();
if (config('app.debug')) {
$data['trace'] = $e->getTraceAsString();
$data['trace'] = $trace;
}
return new JsonResponse(
fail($msg, $data),
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/PollController.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function latest()
->selectRaw("selection, count(*) as count")->groupBy("selection")
->get()->pluck('count', 'selection')->toArray();
foreach ($answerStats as $index => &$value) {
$value = number_format(($value / $poll->answers_count) * 100, 2) . '%';
$value = number_format(($value / $poll->answers_count) * 100, 1) . '%';
}
$resource = new PollResource($poll);
} else {
Expand Down
4 changes: 4 additions & 0 deletions config/logging.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
'tap' => [\App\Logging\NexusFormatter::class],
'path' => env('LOG_FILE', '/tmp/nexus.log'),
'level' => env('LOG_LEVEL', 'debug'),
'ignore_exceptions' => false,
],

'daily' => [
Expand All @@ -54,6 +55,7 @@
'level' => env('LOG_LEVEL', 'debug'),
'tap' => [\App\Logging\NexusFormatter::class],
'days' => 14,
'ignore_exceptions' => false,
],

'slack' => [
Expand All @@ -79,6 +81,8 @@
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'ignore_exceptions' => false,
'tap' => [\App\Logging\NexusFormatter::class],
'with' => [
'stream' => 'php://stderr',
],
Expand Down
2 changes: 1 addition & 1 deletion include/constants.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.0');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-04-09');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-04-10');
defined('IN_TRACKER') || define('IN_TRACKER', true);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
Expand Down
2 changes: 1 addition & 1 deletion include/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
$Cache = new class_cache_redis(); //Load the caching class
$Cache->setLanguageFolderArray(get_langfolder_list());
require $rootpath . 'include/config.php';
if (!in_array(nexus()->getScript(), ['announce', 'scrape', 'torrentrss', 'download'])) {
if (!isRunningInConsole() && !in_array(nexus()->getScript(), ['announce', 'scrape', 'torrentrss', 'download'])) {
require $rootpath . get_langfile_path("functions.php");
checkGuestVisit();
}
Expand Down

0 comments on commit 8216cb3

Please sign in to comment.