mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 22:41:27 +00:00
Update db:raw queries to support laravel v10
This commit is contained in:
parent
848181913f
commit
849e510311
4 changed files with 32 additions and 13 deletions
|
@ -243,16 +243,20 @@ trait AdminSettingsController
|
||||||
];
|
];
|
||||||
switch (config('database.default')) {
|
switch (config('database.default')) {
|
||||||
case 'pgsql':
|
case 'pgsql':
|
||||||
|
$exp = DB::raw('select version();');
|
||||||
|
$expQuery = $exp->getValue(DB::connection()->getQueryGrammar());
|
||||||
$sys['database'] = [
|
$sys['database'] = [
|
||||||
'name' => 'Postgres',
|
'name' => 'Postgres',
|
||||||
'version' => explode(' ', DB::select(DB::raw('select version();'))[0]->version)[1]
|
'version' => explode(' ', DB::select($expQuery)[0]->version)[1]
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
|
$exp = DB::raw('select version()');
|
||||||
|
$expQuery = $exp->getValue(DB::connection()->getQueryGrammar());
|
||||||
$sys['database'] = [
|
$sys['database'] = [
|
||||||
'name' => 'MySQL',
|
'name' => 'MySQL',
|
||||||
'version' => DB::select( DB::raw("select version()") )[0]->{'version()'}
|
'version' => DB::select($expQuery)[0]->{'version()'}
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,9 @@ class CommentPipeline implements ShouldQueue
|
||||||
$actor = $comment->profile;
|
$actor = $comment->profile;
|
||||||
|
|
||||||
if(config('database.default') === 'mysql') {
|
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->reply_count = count($count);
|
||||||
$status->save();
|
$status->save();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -70,7 +70,9 @@ class StatusReplyPipeline implements ShouldQueue
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config('database.default') === 'mysql') {
|
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->reply_count = count($count);
|
||||||
$reply->save();
|
$reply->save();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
@extends('admin.partial.template')
|
@extends('admin.partial.template-full')
|
||||||
|
|
||||||
@include('admin.settings.sidebar')
|
|
||||||
|
|
||||||
@section('section')
|
@section('section')
|
||||||
<div class="title">
|
<div class="title">
|
||||||
|
@ -8,10 +6,22 @@
|
||||||
<p class="lead">System information</p>
|
<p class="lead">System information</p>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<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>
|
<p class="h6 text-uppercase text-center">STACK</p>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-md-3">
|
<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">
|
<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>
|
<p class="font-weight-ultralight h2 mb-0 text-truncate" title="{{$sys['pixelfed']}}" data-toggle="tooltip">{{$sys['pixelfed']}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -19,7 +29,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-3">
|
<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">
|
<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>
|
<p class="font-weight-ultralight h2 mb-0 text-truncate" title="{{$sys['database']['version']}}" data-toggle="tooltip">{{$sys['database']['version']}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -27,7 +37,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-3">
|
<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">
|
<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>
|
<p class="font-weight-ultralight h2 mb-0 text-truncate" title="{{$sys['php']}}" data-toggle="tooltip">{{$sys['php']}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -35,7 +45,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-3">
|
<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">
|
<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>
|
<p class="font-weight-ultralight h2 mb-0 text-truncate" title="{{$sys['laravel']}}" data-toggle="tooltip">{{$sys['laravel']}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -51,11 +61,12 @@
|
||||||
<span class="sr-only">Loading…</span>
|
<span class="sr-only">Loading…</span>
|
||||||
</div>
|
</div>
|
||||||
</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="card-body">
|
||||||
<div class="d-flex justify-content-between align-items-center">
|
<div class="">
|
||||||
<div>
|
<div>
|
||||||
<p class="h1 latest-version mb-0 mr-4">0.0.0</p>
|
<p class="h1 latest-version mb-0 mr-4">0.0.0</p>
|
||||||
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-left px-3">
|
<div class="text-left px-3">
|
||||||
<p class="mb-0 latest-name h2 font-weight-bold"></p>
|
<p class="mb-0 latest-name h2 font-weight-bold"></p>
|
||||||
|
|
Loading…
Reference in a new issue