From 849e510311b764406ed453235c715790fcac6355 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 20 Apr 2023 00:00:55 -0600 Subject: [PATCH 1/2] Update db:raw queries to support laravel v10 --- .../Admin/AdminSettingsController.php | 8 +++-- app/Jobs/CommentPipeline/CommentPipeline.php | 4 ++- .../StatusPipeline/StatusReplyPipeline.php | 4 ++- .../views/admin/settings/system.blade.php | 29 +++++++++++++------ 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/app/Http/Controllers/Admin/AdminSettingsController.php b/app/Http/Controllers/Admin/AdminSettingsController.php index ab1a4ab5c..d51870822 100644 --- a/app/Http/Controllers/Admin/AdminSettingsController.php +++ b/app/Http/Controllers/Admin/AdminSettingsController.php @@ -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; diff --git a/app/Jobs/CommentPipeline/CommentPipeline.php b/app/Jobs/CommentPipeline/CommentPipeline.php index e8ed821da..0ae4ed4a2 100644 --- a/app/Jobs/CommentPipeline/CommentPipeline.php +++ b/app/Jobs/CommentPipeline/CommentPipeline.php @@ -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 { diff --git a/app/Jobs/StatusPipeline/StatusReplyPipeline.php b/app/Jobs/StatusPipeline/StatusReplyPipeline.php index c515ffed0..2c41aa146 100644 --- a/app/Jobs/StatusPipeline/StatusReplyPipeline.php +++ b/app/Jobs/StatusPipeline/StatusReplyPipeline.php @@ -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 { diff --git a/resources/views/admin/settings/system.blade.php b/resources/views/admin/settings/system.blade.php index c68d822f8..5d13d31cf 100644 --- a/resources/views/admin/settings/system.blade.php +++ b/resources/views/admin/settings/system.blade.php @@ -1,6 +1,4 @@ -@extends('admin.partial.template') - -@include('admin.settings.sidebar') +@extends('admin.partial.template-full') @section('section')
@@ -8,10 +6,22 @@

System information


+ {{--
+
+

Update Available

+

+ v0.10.6 + + v0.10.7 +

+ Update +
+
+
--}}

STACK

-
+

{{$sys['pixelfed']}}

@@ -19,7 +29,7 @@
-
+

{{$sys['database']['version']}}

@@ -27,7 +37,7 @@
-
+

{{$sys['php']}}

@@ -35,7 +45,7 @@
-
+

{{$sys['laravel']}}

@@ -51,11 +61,12 @@ Loading…
-
+
-
+

0.0.0

+

From d878672368f69c22c2caa5a06a101d0e15b73def Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 20 Apr 2023 00:01:18 -0600 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62c59ba22..82978b834 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - Update LandingController, fix config variable names ([b716926b](https://github.com/pixelfed/pixelfed/commit/b716926b)) - Update Privacy Settings, add Directory setting ([634c15e4](https://github.com/pixelfed/pixelfed/commit/634c15e4)) - Update site config ([6d59dc8e](https://github.com/pixelfed/pixelfed/commit/6d59dc8e)) +- Update db:raw queries to support laravel v10 ([849e5103](https://github.com/pixelfed/pixelfed/commit/849e5103)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.5 (2023-03-25)](https://github.com/pixelfed/pixelfed/compare/v0.11.4...v0.11.5)