mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 17:01:16 +00:00
Update code for php 8.5 compatibility
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Console\Commands;
|
||||
|
||||
use App\Services\MovieService;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class FetchMovieByImdb extends Command
|
||||
{
|
||||
@@ -39,10 +40,10 @@ class FetchMovieByImdb extends Command
|
||||
$this->info('Force fetching movie data for IMDb id: tt'.$imdbId.' ...');
|
||||
|
||||
// Clear all caches for this movie to force fresh data retrieval
|
||||
\Cache::forget('tmdb_movie_'.md5('tt'.$imdbId));
|
||||
\Cache::forget('trakt_movie_'.md5($imdbId));
|
||||
\Cache::forget('imdb_movie_'.md5($imdbId));
|
||||
\Cache::forget('omdb_movie_'.md5($imdbId));
|
||||
Cache::forget('tmdb_movie_'.md5('tt'.$imdbId));
|
||||
Cache::forget('trakt_movie_'.md5($imdbId));
|
||||
Cache::forget('imdb_movie_'.md5($imdbId));
|
||||
Cache::forget('omdb_movie_'.md5($imdbId));
|
||||
|
||||
$ok = $movie->updateMovieInfo($imdbId);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Facades\Elasticsearch;
|
||||
use Exception;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
@@ -63,7 +64,7 @@ class NntmuxCheckIndex extends Command
|
||||
{
|
||||
try {
|
||||
// Check if index exists
|
||||
$exists = \Elasticsearch::indices()->exists(['index' => $index]);
|
||||
$exists = Elasticsearch::indices()->exists(['index' => $index]);
|
||||
|
||||
if (! $exists) {
|
||||
$this->error("ElasticSearch index '{$index}' does not exist.");
|
||||
@@ -74,7 +75,7 @@ class NntmuxCheckIndex extends Command
|
||||
$this->info("ElasticSearch index '{$index}' exists.");
|
||||
|
||||
// Get index stats
|
||||
$stats = \Elasticsearch::indices()->stats(['index' => $index]);
|
||||
$stats = Elasticsearch::indices()->stats(['index' => $index]);
|
||||
$docCount = $stats['indices'][$index]['total']['docs']['count'] ?? 0;
|
||||
$storeSize = $stats['indices'][$index]['total']['store']['size_in_bytes'] ?? 0;
|
||||
|
||||
@@ -83,7 +84,7 @@ class NntmuxCheckIndex extends Command
|
||||
|
||||
// Get a sample document
|
||||
if ($docCount > 0) {
|
||||
$sample = \Elasticsearch::search([
|
||||
$sample = Elasticsearch::search([
|
||||
'index' => $index,
|
||||
'size' => 1,
|
||||
'body' => [
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Elasticsearch;
|
||||
use App\Facades\Elasticsearch;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class NntmuxCreateESIndexes extends Command
|
||||
|
||||
@@ -32,13 +32,13 @@ class NntmuxESReindex extends Command
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): int
|
||||
{
|
||||
passthru('php '.app()->/* @scrutinizer ignore-call */ path().'/../misc/elasticsearch/create_es_indexes.php');
|
||||
passthru('php '.app()->/* @scrutinizer ignore-call */ path().'/../misc/elasticsearch/populate_es_indexes.php releases');
|
||||
passthru('php '.app()->/* @scrutinizer ignore-call */ path().'/../misc/elasticsearch/populate_es_indexes.php predb');
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ class NntmuxOffsetPopulate extends Command
|
||||
// Wait a moment for ElasticSearch to refresh
|
||||
sleep(2);
|
||||
|
||||
$stats = \Elasticsearch::indices()->stats(['index' => $index]);
|
||||
$stats = Elasticsearch::indices()->stats(['index' => $index]);
|
||||
$actualCount = $stats['indices'][$index]['total']['docs']['count'] ?? 0;
|
||||
|
||||
$this->info('Expected: '.number_format($expectedTotal).' records');
|
||||
@@ -281,18 +281,18 @@ class NntmuxOffsetPopulate extends Command
|
||||
} else {
|
||||
// For ElasticSearch, just clear the data instead of recreating the index
|
||||
try {
|
||||
$exists = \Elasticsearch::indices()->exists(['index' => $index]);
|
||||
$exists = Elasticsearch::indices()->exists(['index' => $index]);
|
||||
|
||||
if ($exists) {
|
||||
// Get current document count
|
||||
$stats = \Elasticsearch::indices()->stats(['index' => $index]);
|
||||
$stats = Elasticsearch::indices()->stats(['index' => $index]);
|
||||
$currentCount = $stats['indices'][$index]['total']['docs']['count'] ?? 0;
|
||||
|
||||
if ($currentCount > 0) {
|
||||
$this->info("ElasticSearch index '{$index}' exists with {$currentCount} documents. Clearing data...");
|
||||
|
||||
// Delete all documents but keep the index structure
|
||||
\Elasticsearch::deleteByQuery([
|
||||
Elasticsearch::deleteByQuery([
|
||||
'index' => $index,
|
||||
'body' => [
|
||||
'query' => ['match_all' => (object) []],
|
||||
@@ -300,7 +300,7 @@ class NntmuxOffsetPopulate extends Command
|
||||
]);
|
||||
|
||||
// Force refresh to ensure deletions are visible
|
||||
\Elasticsearch::indices()->refresh(['index' => $index]);
|
||||
Elasticsearch::indices()->refresh(['index' => $index]);
|
||||
$this->info("Cleared all documents from ElasticSearch index: {$index}");
|
||||
} else {
|
||||
$this->info("ElasticSearch index '{$index}' exists but is already empty");
|
||||
@@ -315,7 +315,7 @@ class NntmuxOffsetPopulate extends Command
|
||||
|
||||
// Fallback: delete and recreate
|
||||
try {
|
||||
\Elasticsearch::indices()->delete(['index' => $index]);
|
||||
Elasticsearch::indices()->delete(['index' => $index]);
|
||||
} catch (Exception $e) {
|
||||
// Index might not exist, that's okay
|
||||
}
|
||||
@@ -346,7 +346,7 @@ class NntmuxOffsetPopulate extends Command
|
||||
],
|
||||
];
|
||||
|
||||
\Elasticsearch::indices()->create($settings);
|
||||
Elasticsearch::indices()->create($settings);
|
||||
$this->info("Created optimized ElasticSearch index: {$indexName}");
|
||||
}
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@ class NntmuxOffsetWorker extends Command
|
||||
|
||||
while ($attempt < $retries) {
|
||||
try {
|
||||
$response = \Elasticsearch::bulk($data);
|
||||
$response = Elasticsearch::bulk($data);
|
||||
|
||||
if (isset($response['errors']) && $response['errors']) {
|
||||
$errorCount = 0;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class NntmuxOptimizeTables extends Command
|
||||
{
|
||||
@@ -40,7 +41,7 @@ class NntmuxOptimizeTables extends Command
|
||||
*/
|
||||
private function optimizeAllTables(): void
|
||||
{
|
||||
$tables = \DB::select('SHOW TABLES');
|
||||
$tables = DB::select('SHOW TABLES');
|
||||
foreach ($tables as $table) {
|
||||
$this->optimizeTable($table->Tables_in_nntmux);
|
||||
}
|
||||
@@ -63,11 +64,11 @@ class NntmuxOptimizeTables extends Command
|
||||
private function tableCheck($table): void
|
||||
{
|
||||
$this->info('Checking table: '.$table);
|
||||
$tableCheck = \DB::select('CHECK TABLE '.$table);
|
||||
$tableCheck = DB::select('CHECK TABLE '.$table);
|
||||
if ($tableCheck[0]->Msg_text !== 'OK') {
|
||||
$this->error('Table '.$table.' is corrupted. Please repair it.');
|
||||
$this->info('Optimizing table: '.$table);
|
||||
\DB::select('OPTIMIZE TABLE '.$table);
|
||||
DB::select('OPTIMIZE TABLE '.$table);
|
||||
} else {
|
||||
$this->info('Table '.$table.' is ok. Optimization is not needed.');
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Facades\Elasticsearch;
|
||||
use App\Facades\Search;
|
||||
use App\Models\MovieInfo;
|
||||
use App\Models\Predb;
|
||||
@@ -827,7 +828,7 @@ class NntmuxPopulateSearchIndexes extends Command
|
||||
|
||||
while ($attempt < $retries) {
|
||||
try {
|
||||
$response = \Elasticsearch::bulk($data);
|
||||
$response = Elasticsearch::bulk($data);
|
||||
|
||||
// Check for errors in bulk response
|
||||
if (isset($response['errors']) && $response['errors']) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Facades\Elasticsearch;
|
||||
use App\Facades\Search;
|
||||
use App\Models\UsenetGroup;
|
||||
use Illuminate\Console\Command;
|
||||
@@ -91,8 +92,8 @@ class NntmuxResetDb extends Command
|
||||
unset($value);
|
||||
|
||||
if (config('search.default') === 'elasticsearch') {
|
||||
if (\Elasticsearch::indices()->exists(['index' => 'releases'])) {
|
||||
\Elasticsearch::indices()->delete(['index' => 'releases']);
|
||||
if (Elasticsearch::indices()->exists(['index' => 'releases'])) {
|
||||
Elasticsearch::indices()->delete(['index' => 'releases']);
|
||||
}
|
||||
$releases_index = [
|
||||
'index' => 'releases',
|
||||
@@ -133,10 +134,10 @@ class NntmuxResetDb extends Command
|
||||
],
|
||||
];
|
||||
|
||||
\Elasticsearch::indices()->create($releases_index);
|
||||
Elasticsearch::indices()->create($releases_index);
|
||||
|
||||
if (\Elasticsearch::indices()->exists(['index' => 'predb'])) {
|
||||
\Elasticsearch::indices()->delete(['index' => 'predb']);
|
||||
if (Elasticsearch::indices()->exists(['index' => 'predb'])) {
|
||||
Elasticsearch::indices()->delete(['index' => 'predb']);
|
||||
}
|
||||
$predb_index = [
|
||||
'index' => 'predb',
|
||||
@@ -167,11 +168,11 @@ class NntmuxResetDb extends Command
|
||||
|
||||
];
|
||||
|
||||
\Elasticsearch::indices()->create($predb_index);
|
||||
Elasticsearch::indices()->create($predb_index);
|
||||
|
||||
// Delete and recreate movies index
|
||||
if (\Elasticsearch::indices()->exists(['index' => 'movies'])) {
|
||||
\Elasticsearch::indices()->delete(['index' => 'movies']);
|
||||
if (Elasticsearch::indices()->exists(['index' => 'movies'])) {
|
||||
Elasticsearch::indices()->delete(['index' => 'movies']);
|
||||
}
|
||||
$movies_index = [
|
||||
'index' => 'movies',
|
||||
@@ -208,11 +209,11 @@ class NntmuxResetDb extends Command
|
||||
],
|
||||
];
|
||||
|
||||
\Elasticsearch::indices()->create($movies_index);
|
||||
Elasticsearch::indices()->create($movies_index);
|
||||
|
||||
// Delete and recreate tvshows index
|
||||
if (\Elasticsearch::indices()->exists(['index' => 'tvshows'])) {
|
||||
\Elasticsearch::indices()->delete(['index' => 'tvshows']);
|
||||
if (Elasticsearch::indices()->exists(['index' => 'tvshows'])) {
|
||||
Elasticsearch::indices()->delete(['index' => 'tvshows']);
|
||||
}
|
||||
$tvshows_index = [
|
||||
'index' => 'tvshows',
|
||||
@@ -248,7 +249,7 @@ class NntmuxResetDb extends Command
|
||||
],
|
||||
];
|
||||
|
||||
\Elasticsearch::indices()->create($tvshows_index);
|
||||
Elasticsearch::indices()->create($tvshows_index);
|
||||
|
||||
$this->info('All done! ElasticSearch indexes are deleted and recreated.');
|
||||
} else {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Facades\Elasticsearch;
|
||||
use App\Models\Release;
|
||||
use Elasticsearch;
|
||||
use Elasticsearch\Common\Exceptions\Missing404Exception;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
use App\Services\AdultProcessing\AgeVerificationManager;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
if (! function_exists('getRawHtmlWithAgeVerification')) {
|
||||
/**
|
||||
@@ -82,13 +83,13 @@ if (! function_exists('getRawHtmlWithAgeVerification')) {
|
||||
|
||||
} catch (RequestException $e) {
|
||||
if (config('app.debug') === true) {
|
||||
\Log::error('getRawHtmlWithAgeVerification: '.$e->getMessage());
|
||||
Log::error('getRawHtmlWithAgeVerification: '.$e->getMessage());
|
||||
}
|
||||
|
||||
return false;
|
||||
} catch (\Exception $e) {
|
||||
if (config('app.debug') === true) {
|
||||
\Log::error('getRawHtmlWithAgeVerification: '.$e->getMessage());
|
||||
Log::error('getRawHtmlWithAgeVerification: '.$e->getMessage());
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -12,8 +12,8 @@ use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
use sspat\ESQuerySanitizer\Sanitizer;
|
||||
use STS\ZipStream\Facades\Zip as ZipStream;
|
||||
use Symfony\Component\Process\Process;
|
||||
use Zip as ZipStream;
|
||||
|
||||
if (! function_exists('getRawHtml')) {
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Admin;
|
||||
use App\Http\Controllers\BasePageController;
|
||||
use App\Services\SystemMetricsService;
|
||||
use App\Services\UserStatsService;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class AdminPageController extends BasePageController
|
||||
{
|
||||
@@ -254,7 +255,7 @@ class AdminPageController extends BasePageController
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
\Log::warning('Could not get CPU usage: '.$e->getMessage());
|
||||
Log::warning('Could not get CPU usage: '.$e->getMessage());
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -349,7 +350,7 @@ class AdminPageController extends BasePageController
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
\Log::warning('Could not get CPU info: '.$e->getMessage());
|
||||
Log::warning('Could not get CPU info: '.$e->getMessage());
|
||||
}
|
||||
|
||||
return $info;
|
||||
@@ -388,7 +389,7 @@ class AdminPageController extends BasePageController
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
\Log::warning('Could not get load average: '.$e->getMessage());
|
||||
Log::warning('Could not get load average: '.$e->getMessage());
|
||||
}
|
||||
|
||||
return $loadAvg;
|
||||
@@ -438,7 +439,7 @@ class AdminPageController extends BasePageController
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
\Log::warning('Could not get RAM usage: '.$e->getMessage());
|
||||
Log::warning('Could not get RAM usage: '.$e->getMessage());
|
||||
}
|
||||
|
||||
return [
|
||||
|
||||
@@ -9,6 +9,7 @@ use App\Models\UserDownload;
|
||||
use App\Models\UserRequest;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Jrean\UserVerification\Facades\UserVerification;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
@@ -162,7 +163,7 @@ class AdminUserController extends BasePageController
|
||||
? $editedUser->rolechangedate->toDateTimeString()
|
||||
: null;
|
||||
|
||||
\Log::info('AdminUserController - Before updates', [
|
||||
Log::info('AdminUserController - Before updates', [
|
||||
'user_id' => $editedUser->id,
|
||||
'originalRoleChangeDate' => $originalRoleChangeDate,
|
||||
'current_roles_id' => $editedUser->roles_id,
|
||||
@@ -191,7 +192,7 @@ class AdminUserController extends BasePageController
|
||||
}
|
||||
$editedUser->refresh();
|
||||
|
||||
\Log::info('AdminUserController - After expiry update', [
|
||||
Log::info('AdminUserController - After expiry update', [
|
||||
'user_id' => $editedUser->id,
|
||||
'new_rolechangedate' => $editedUser->rolechangedate,
|
||||
'adminManuallySetExpiry' => $adminManuallySetExpiry,
|
||||
@@ -201,7 +202,7 @@ class AdminUserController extends BasePageController
|
||||
// If role is changing, handle it with stacking logic
|
||||
// Pass the original expiry so history records the correct old_expiry_date
|
||||
if ($roleChanged && $request->input('role') !== null) {
|
||||
\Log::info('AdminUserController - About to call updateUserRole', [
|
||||
Log::info('AdminUserController - About to call updateUserRole', [
|
||||
'user_id' => $editedUser->id,
|
||||
'new_role' => (int) $request->input('role'),
|
||||
'originalRoleChangeDate_passed' => $originalRoleChangeDate,
|
||||
|
||||
@@ -134,7 +134,7 @@ class LoginController extends Controller
|
||||
return $this->checkPasswordBreachAndRedirect($request->input('password'), $redirect);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
\Log::error('Login - Error processing trusted device cookie', [
|
||||
Log::error('Login - Error processing trusted device cookie', [
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
@@ -213,7 +213,7 @@ class LoginController extends Controller
|
||||
$remainingSeconds = max(0, $cookieData['expires_at'] - time());
|
||||
$remainingMinutes = (int) ceil($remainingSeconds / 60);
|
||||
|
||||
\Log::info('Logout - Cookie Expiration', [
|
||||
Log::info('Logout - Cookie Expiration', [
|
||||
'expires_at' => $cookieData['expires_at'],
|
||||
'current_time' => time(),
|
||||
'remaining_seconds' => $remainingSeconds,
|
||||
@@ -238,13 +238,13 @@ class LoginController extends Controller
|
||||
// Queue the cookie to be sent with the response
|
||||
cookie()->queue($cookie);
|
||||
} else {
|
||||
\Log::warning('Logout - Cookie Already Expired');
|
||||
Log::warning('Logout - Cookie Already Expired');
|
||||
}
|
||||
} else {
|
||||
\Log::warning('Logout - Cookie Missing Expiration Data');
|
||||
Log::warning('Logout - Cookie Missing Expiration Data');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
\Log::error('Logout - Error Processing Cookie', [
|
||||
Log::error('Logout - Error Processing Cookie', [
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use PragmaRX\Google2FALaravel\Facade as Google2FA;
|
||||
|
||||
class PasswordSecurityController extends Controller
|
||||
{
|
||||
@@ -28,7 +29,7 @@ class PasswordSecurityController extends Controller
|
||||
|
||||
$google2fa_url = '';
|
||||
if ($user->passwordSecurity()->exists()) {
|
||||
$google2fa_url = \Google2FA::getQRCodeInline(
|
||||
$google2fa_url = Google2FA::getQRCodeInline(
|
||||
config('app.name'),
|
||||
$user->email,
|
||||
$user->passwordSecurity->google2fa_secret
|
||||
@@ -62,7 +63,7 @@ class PasswordSecurityController extends Controller
|
||||
[
|
||||
'user_id' => $user->id,
|
||||
'google2fa_enable' => 0,
|
||||
'google2fa_secret' => \Google2FA::generateSecretKey(),
|
||||
'google2fa_secret' => Google2FA::generateSecretKey(),
|
||||
]
|
||||
);
|
||||
|
||||
@@ -90,7 +91,7 @@ class PasswordSecurityController extends Controller
|
||||
}
|
||||
|
||||
$secret = $request->input('verify-code');
|
||||
$valid = \Google2FA::verifyKey($user->passwordSecurity->google2fa_secret, $secret);
|
||||
$valid = Google2FA::verifyKey($user->passwordSecurity->google2fa_secret, $secret);
|
||||
if ($valid) {
|
||||
$user->passwordSecurity->google2fa_enable = 1;
|
||||
$user->passwordSecurity->save();
|
||||
@@ -178,7 +179,7 @@ class PasswordSecurityController extends Controller
|
||||
}
|
||||
|
||||
// Verify the OTP code
|
||||
$valid = \Google2FA::verifyKey(
|
||||
$valid = Google2FA::verifyKey(
|
||||
$user->passwordSecurity->google2fa_secret,
|
||||
$request->input('one_time_password')
|
||||
);
|
||||
@@ -340,7 +341,7 @@ class PasswordSecurityController extends Controller
|
||||
|
||||
$google2fa_url = '';
|
||||
if ($user->passwordSecurity()->exists()) {
|
||||
$google2fa_url = \Google2FA::getQRCodeInline(
|
||||
$google2fa_url = Google2FA::getQRCodeInline(
|
||||
config('app.name'),
|
||||
$user->email,
|
||||
$user->passwordSecurity->google2fa_secret
|
||||
@@ -370,7 +371,7 @@ class PasswordSecurityController extends Controller
|
||||
|
||||
$google2fa_url = '';
|
||||
if ($user->passwordSecurity()->exists()) {
|
||||
$google2fa_url = \Google2FA::getQRCodeInline(
|
||||
$google2fa_url = Google2FA::getQRCodeInline(
|
||||
config('app.name'),
|
||||
$user->email,
|
||||
$user->passwordSecurity->google2fa_secret
|
||||
|
||||
@@ -17,6 +17,7 @@ use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Jrean\UserVerification\Facades\UserVerification;
|
||||
use PragmaRX\Google2FALaravel\Facade as Google2FA;
|
||||
|
||||
class ProfileController extends BasePageController
|
||||
{
|
||||
@@ -116,7 +117,7 @@ class ProfileController extends BasePageController
|
||||
// Generate 2FA QR code URL if 2FA is set up but not enabled
|
||||
$google2fa_url = '';
|
||||
if ($this->userdata->passwordSecurity()->exists() && ! $this->userdata->passwordSecurity->google2fa_enable) {
|
||||
$google2fa_url = \Google2FA::getQRCodeInline(
|
||||
$google2fa_url = Google2FA::getQRCodeInline(
|
||||
config('app.name'),
|
||||
$this->userdata->email,
|
||||
$this->userdata->passwordSecurity->google2fa_secret
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Listeners;
|
||||
|
||||
use App\Events\UserLoggedIn;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UpdateUserLoggedIn
|
||||
{
|
||||
@@ -30,7 +31,7 @@ class UpdateUserLoggedIn
|
||||
);
|
||||
|
||||
// Log the user login event
|
||||
\Log::channel('user_login')->info('User logged in', [
|
||||
Log::channel('user_login')->info('User logged in', [
|
||||
'user_id' => $event->user->id,
|
||||
'username' => $event->user->username,
|
||||
'ip' => $event->ip,
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Models;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class UserActivityStat extends Model
|
||||
{
|
||||
@@ -153,13 +154,13 @@ class UserActivityStat extends Model
|
||||
->count();
|
||||
|
||||
// Store in hourly stats table
|
||||
\DB::table('user_activity_stats_hourly')->updateOrInsert(
|
||||
DB::table('user_activity_stats_hourly')->updateOrInsert(
|
||||
['stat_hour' => $statHour],
|
||||
[
|
||||
'downloads_count' => $downloadsCount,
|
||||
'api_hits_count' => $apiHitsCount,
|
||||
'updated_at' => now(),
|
||||
'created_at' => \DB::raw('COALESCE(created_at, NOW())'),
|
||||
'created_at' => DB::raw('COALESCE(created_at, NOW())'),
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -171,7 +172,7 @@ class UserActivityStat extends Model
|
||||
{
|
||||
$startHour = Carbon::now()->subHours($hours - 1)->startOfHour()->format('Y-m-d H:00:00');
|
||||
|
||||
$stats = \DB::table('user_activity_stats_hourly')
|
||||
$stats = DB::table('user_activity_stats_hourly')
|
||||
->select('stat_hour', 'downloads_count')
|
||||
->where('stat_hour', '>=', $startHour)
|
||||
->orderBy('stat_hour', 'asc')
|
||||
@@ -213,7 +214,7 @@ class UserActivityStat extends Model
|
||||
{
|
||||
$startHour = Carbon::now()->subHours($hours - 1)->startOfHour()->format('Y-m-d H:00:00');
|
||||
|
||||
$stats = \DB::table('user_activity_stats_hourly')
|
||||
$stats = DB::table('user_activity_stats_hourly')
|
||||
->select('stat_hour', 'api_hits_count')
|
||||
->where('stat_hour', '>=', $startHour)
|
||||
->orderBy('stat_hour', 'asc')
|
||||
@@ -255,7 +256,7 @@ class UserActivityStat extends Model
|
||||
{
|
||||
$cutoffHour = Carbon::now()->subDays($keepDays)->startOfHour()->format('Y-m-d H:00:00');
|
||||
|
||||
return \DB::table('user_activity_stats_hourly')
|
||||
return DB::table('user_activity_stats_hourly')
|
||||
->where('stat_hour', '<', $cutoffHour)
|
||||
->delete();
|
||||
}
|
||||
|
||||
@@ -1363,7 +1363,7 @@ class NameFixingService
|
||||
$counted++;
|
||||
}
|
||||
if ($show === false) {
|
||||
cli()->info('Renamed Releases: ['.number_format($counted).'] '.(new ColorCLI)->percentString(++$counter, $total));
|
||||
cli()->info('Renamed Releases: ['.number_format($counted).'] '.cli()->percentString(++$counter, $total));
|
||||
}
|
||||
}
|
||||
cli()->info(PHP_EOL.'Renamed '.number_format($counted).' releases in '.now()->diffInSeconds($timeStart, true).' seconds.');
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Services\Runners;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
abstract class BaseRunner
|
||||
@@ -110,7 +111,7 @@ abstract class BaseRunner
|
||||
default:
|
||||
// Log unrecognized command and return empty string
|
||||
if (config('app.debug')) {
|
||||
\Log::warning('Unrecognized multiprocessing command: '.$args);
|
||||
Log::warning('Unrecognized multiprocessing command: '.$args);
|
||||
}
|
||||
|
||||
return '';
|
||||
@@ -196,7 +197,7 @@ abstract class BaseRunner
|
||||
try {
|
||||
$results[$key] = $callable();
|
||||
} catch (\Throwable $e) {
|
||||
\Log::error("Task {$key} failed: ".$e->getMessage());
|
||||
Log::error("Task {$key} failed: ".$e->getMessage());
|
||||
$results[$key] = '';
|
||||
}
|
||||
}
|
||||
@@ -226,7 +227,7 @@ abstract class BaseRunner
|
||||
try {
|
||||
$results[$key] = $callable();
|
||||
} catch (\Throwable $e) {
|
||||
\Log::error("Task {$key} failed: ".$e->getMessage());
|
||||
Log::error("Task {$key} failed: ".$e->getMessage());
|
||||
$results[$key] = '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class TurnstileService
|
||||
{
|
||||
@@ -28,7 +29,7 @@ class TurnstileService
|
||||
|
||||
return isset($result['success']) && $result['success'] === true;
|
||||
} catch (\Exception $e) {
|
||||
\Log::error('Turnstile verification failed: '.$e->getMessage());
|
||||
Log::error('Turnstile verification failed: '.$e->getMessage());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Support;
|
||||
|
||||
use App\Services\TurnstileService;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CaptchaHelper
|
||||
{
|
||||
@@ -24,7 +25,7 @@ class CaptchaHelper
|
||||
|
||||
// If both are configured as enabled, log a warning and use the configured provider
|
||||
if ($recaptchaEnabled && $turnstileEnabled) {
|
||||
\Log::warning('Both reCAPTCHA and Turnstile are enabled. Only one can be active at a time. Using provider: '.$provider);
|
||||
Log::warning('Both reCAPTCHA and Turnstile are enabled. Only one can be active at a time. Using provider: '.$provider);
|
||||
}
|
||||
|
||||
if ($provider === 'turnstile') {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Process;
|
||||
@@ -63,10 +64,10 @@ class UpdatePerformanceHelper
|
||||
public static function clearAllCaches(): array
|
||||
{
|
||||
$cacheOperations = [
|
||||
'config' => fn () => \Artisan::call('config:clear'),
|
||||
'route' => fn () => \Artisan::call('route:clear'),
|
||||
'view' => fn () => \Artisan::call('view:clear'),
|
||||
'cache' => fn () => \Artisan::call('cache:clear'),
|
||||
'config' => fn () => Artisan::call('config:clear'),
|
||||
'route' => fn () => Artisan::call('route:clear'),
|
||||
'view' => fn () => Artisan::call('view:clear'),
|
||||
'cache' => fn () => Artisan::call('cache:clear'),
|
||||
'opcache' => fn () => function_exists('opcache_reset') ? opcache_reset() : true,
|
||||
];
|
||||
|
||||
|
||||
+3
-1
@@ -21,9 +21,11 @@ return [
|
||||
'timezone' => env('APP_TIMEZONE', 'UTC'),
|
||||
|
||||
'aliases' => Facade::defaultAliases()->merge([
|
||||
'Elasticsearch' => App\Facades\Elasticsearch::class,
|
||||
'Google2FA' => PragmaRX\Google2FALaravel\Facade::class,
|
||||
'Gravatar' => Creativeorange\Gravatar\Facades\Gravatar::class,
|
||||
'RedisManager' => Illuminate\Support\Facades\Redis::class,
|
||||
'UserVerification' => Jrean\UserVerification\Facades\UserVerification::class,
|
||||
'Gravatar' => Creativeorange\Gravatar\Facades\Gravatar::class,
|
||||
'Yenc' => App\Facades\Yenc::class,
|
||||
])->toArray(),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user