diff --git a/app/Models/User.php b/app/Models/User.php index a1f24014..3dbc54ed 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -150,7 +150,7 @@ class User extends Authenticatable */ protected $fillable = [ 'username', 'email', 'passhash', 'secret', 'stylesheet', 'editsecret', 'added', 'modcomment', 'enabled', 'status', - 'leechwarn', 'leechwarnuntil', 'page', 'class', 'uploaded', 'downloaded', 'clientselect', 'showclienterror', + 'leechwarn', 'leechwarnuntil', 'page', 'class', 'uploaded', 'downloaded', 'clientselect', 'showclienterror', 'last_home', ]; /** diff --git a/app/Repositories/SettingRepository.php b/app/Repositories/SettingRepository.php index f553efd1..c483fbc1 100644 --- a/app/Repositories/SettingRepository.php +++ b/app/Repositories/SettingRepository.php @@ -7,6 +7,7 @@ use App\Models\User; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Arr; use Illuminate\Support\Facades\DB; +use Nexus\Database\NexusDB; class SettingRepository extends BaseRepository { @@ -49,6 +50,8 @@ class SettingRepository extends BaseRepository ); $result = DB::insert($sql); do_log("sql: $sql, result: $result"); + NexusDB::cache_del("nexus_settings_in_laravel"); + NexusDB::cache_del("nexus_settings_in_nexus"); return $result; } diff --git a/include/constants.php b/include/constants.php index 3cea0e48..de73ccf5 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@ where('uid', $userid)->where('status', $status)->count(); +$baseQuery = \App\Models\HitAndRun::query()->where('uid', $userid)->where('status', $status); +$rescount = (clone $baseQuery)->count(); list($pagertop, $pagerbottom, $limit, $offset, $pageSize) = pager(50, $rescount, "?status=$status"); print(""); print(" @@ -54,9 +55,7 @@ print(""); if ($rescount) { - $query = \App\Models\HitAndRun::query() - ->where('uid', $userid) - ->where('status', $status) + $query = (clone $baseQuery) ->with([ 'torrent' => function ($query) {$query->select(['id', 'size', 'name']);}, 'snatch', @@ -74,12 +73,12 @@ if ($rescount) { foreach($list as $row) { print(" - + - + ");
" . $row->id . "" . $row->torrent->name . "" . optional($row->torrent)->name . " " . mksize($row->snatch->uploaded) . " " . mksize($row->snatch->downloaded) . " " . get_hr_ratio($row->snatch->uploaded, $row->snatch->downloaded) . " " . ($row->status == \App\Models\HitAndRun::STATUS_INSPECTING ? mkprettytime(3600 * get_setting('hr.seed_time_minimum') - $row->snatch->seedtime) : '---') . "" . $row->snatch->completedat->toDateTimeString() . "" . format_datetime($row->snatch->completedat) . " " . ($row->status == \App\Models\HitAndRun::STATUS_INSPECTING ? mkprettytime(\Carbon\Carbon::now()->diffInSeconds($row->snatch->completedat->addHours(get_setting('hr.inspect_time')))) : '---') . " " . nl2br($row->comment) . "