Update db:raw queries to support laravel v10

This commit is contained in:
Daniel Supernault 2023-04-20 00:00:55 -06:00
parent 848181913f
commit 849e510311
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
4 changed files with 32 additions and 13 deletions

View File

@ -243,16 +243,20 @@ trait AdminSettingsController
];
switch (config('database.default')) {
case 'pgsql':
$exp = DB::raw('select version();');
$expQuery = $exp->getValue(DB::connection()->getQueryGrammar());
$sys['database'] = [
'name' => 'Postgres',
'version' => explode(' ', DB::select(DB::raw('select version();'))[0]->version)[1]
'version' => explode(' ', DB::select($expQuery)[0]->version)[1]
];
break;
case 'mysql':
$exp = DB::raw('select version()');
$expQuery = $exp->getValue(DB::connection()->getQueryGrammar());
$sys['database'] = [
'name' => 'MySQL',
'version' => DB::select( DB::raw("select version()") )[0]->{'version()'}
'version' => DB::select($expQuery)[0]->{'version()'}
];
break;

View File

@ -60,7 +60,9 @@ class CommentPipeline implements ShouldQueue
$actor = $comment->profile;
if(config('database.default') === 'mysql') {
$count = DB::select(DB::raw("select id, in_reply_to_id from statuses, (select @pv := :kid) initialisation where id > @pv and find_in_set(in_reply_to_id, @pv) > 0 and @pv := concat(@pv, ',', id)"), [ 'kid' => $status->id]);
$exp = DB::raw("select id, in_reply_to_id from statuses, (select @pv := :kid) initialisation where id > @pv and find_in_set(in_reply_to_id, @pv) > 0 and @pv := concat(@pv, ',', id)");
$expQuery = $exp->getValue(DB::connection()->getQueryGrammar());
$count = DB::select($expQuery, [ 'kid' => $status->id ]);
$status->reply_count = count($count);
$status->save();
} else {

View File

@ -70,7 +70,9 @@ class StatusReplyPipeline implements ShouldQueue
}
if(config('database.default') === 'mysql') {
$count = DB::select(DB::raw("select id, in_reply_to_id from statuses, (select @pv := :kid) initialisation where id > @pv and find_in_set(in_reply_to_id, @pv) > 0 and @pv := concat(@pv, ',', id)"), [ 'kid' => $reply->id]);
$exp = DB::raw("select id, in_reply_to_id from statuses, (select @pv := :kid) initialisation where id > @pv and find_in_set(in_reply_to_id, @pv) > 0 and @pv := concat(@pv, ',', id)");
$expQuery = $exp->getValue(DB::connection()->getQueryGrammar());
$count = DB::select($expQuery, [ 'kid' => $reply->id ]);
$reply->reply_count = count($count);
$reply->save();
} else {

View File

@ -1,6 +1,4 @@
@extends('admin.partial.template')
@include('admin.settings.sidebar')
@extends('admin.partial.template-full')
@section('section')
<div class="title">
@ -8,10 +6,22 @@
<p class="lead">System information</p>
</div>
<hr>
{{-- <div class="card shadow-none border mb-4">
<div class="card-body text-center">
<p class="lead">Update Available</p>
<p class="text-lighter">
<span class="font-weight-bold">v0.10.6</span>
<i class="fas fa-arrow-right mx-2"></i>
<span class="font-weight-bold text-primary">v0.10.7</span>
</p>
<a class="btn btn-primary font-weight-bold btn-block" href="#">Update</a>
</div>
</div>
<hr> --}}
<p class="h6 text-uppercase text-center">STACK</p>
<div class="row">
<div class="col-12 col-md-3">
<div class="card mb-3 border-left-blue">
<div class="card shadow-none border mb-3 border-left-blue">
<div class="card-body text-center">
<p class="font-weight-ultralight h2 mb-0 text-truncate" title="{{$sys['pixelfed']}}" data-toggle="tooltip">{{$sys['pixelfed']}}</p>
</div>
@ -19,7 +29,7 @@
</div>
</div>
<div class="col-12 col-md-3">
<div class="card mb-3 border-left-blue">
<div class="card shadow-none border mb-3 border-left-blue">
<div class="card-body text-center">
<p class="font-weight-ultralight h2 mb-0 text-truncate" title="{{$sys['database']['version']}}" data-toggle="tooltip">{{$sys['database']['version']}}</p>
</div>
@ -27,7 +37,7 @@
</div>
</div>
<div class="col-12 col-md-3">
<div class="card mb-3 border-left-blue">
<div class="card shadow-none border mb-3 border-left-blue">
<div class="card-body text-center">
<p class="font-weight-ultralight h2 mb-0 text-truncate" title="{{$sys['php']}}" data-toggle="tooltip">{{$sys['php']}}</p>
</div>
@ -35,7 +45,7 @@
</div>
</div>
<div class="col-12 col-md-3">
<div class="card mb-3 border-left-blue">
<div class="card shadow-none border mb-3 border-left-blue">
<div class="card-body text-center">
<p class="font-weight-ultralight h2 mb-0 text-truncate" title="{{$sys['laravel']}}" data-toggle="tooltip">{{$sys['laravel']}}</p>
</div>
@ -51,11 +61,12 @@
<span class="sr-only">Loading…</span>
</div>
</div>
<div class="card card-release d-none">
<div class="card shadow-none border card-release d-none" style="max-height: 500px;overflow-y: auto;">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="">
<div>
<p class="h1 latest-version mb-0 mr-4">0.0.0</p>
<hr>
</div>
<div class="text-left px-3">
<p class="mb-0 latest-name h2 font-weight-bold"></p>