@@ -933,19 +933,35 @@ public function instanceStats(Request $request)
933933 $ res = [
934934 [
935935 'name ' => 'Total ' ,
936- 'value ' => Instance::whereNotNull ( ' software ' )-> whereFederationState ( 5 )->count (),
936+ 'value ' => Instance::active ( )->count (),
937937 ],
938938 [
939939 'name ' => 'New ' ,
940- 'value ' => Instance::whereNotNull ('software ' )->whereFederationState (5 )->where ('created_at ' , '> ' , now ()->subHours (24 ))->count (),
940+ 'value ' => Instance::active ()->where ('created_at ' , '> ' , now ()->subHours (24 ))->count (),
941+ ],
942+ [
943+ 'name ' => 'Blocked ' ,
944+ 'value ' => Instance::whereFederationState (2 )->count (),
941945 ],
942946 [
943947 'name ' => 'Users ' ,
944- 'value ' => Instance::whereNotNull ('software ' )->where ('federation_state ' , 5 )->sum ('user_count ' ),
948+ 'value ' => Instance::active ()->sum ('user_count ' ),
949+ ],
950+ [
951+ 'name ' => 'Videos ' ,
952+ 'value ' => Instance::active ()->sum ('video_count ' ),
953+ ],
954+ [
955+ 'name ' => 'Followers ' ,
956+ 'value ' => Instance::active ()->sum ('follower_count ' ),
957+ ],
958+ [
959+ 'name ' => 'Following ' ,
960+ 'value ' => Instance::active ()->sum ('following_count ' ),
945961 ],
946962 [
947963 'name ' => 'Comments ' ,
948- 'value ' => Instance::whereNotNull ( ' software ' )-> where ( ' federation_state ' , 5 )->sum ('comment_count ' ),
964+ 'value ' => Instance::active ( )->sum ('comment_count ' ),
949965 ],
950966 ];
951967
@@ -954,14 +970,16 @@ public function instanceStats(Request $request)
954970
955971 public function instanceAdvancedStats ()
956972 {
957- $ totalInstances = Instance::count ();
958- $ activeInstances = Instance::where ( ' is_blocked ' , false )->count ();
959- $ allowedVideoPosts = Instance::where ('allow_video_posts ' , true )->count ();
960- $ allowedInFyf = Instance::where ('allow_videos_in_fyf ' , true )->count ();
973+ $ totalInstances = Instance::active ()-> count ();
974+ $ activeInstances = Instance::active ( )->count ();
975+ $ allowedVideoPosts = Instance::active ()-> where ('allow_video_posts ' , true )->count ();
976+ $ allowedInFyf = Instance::active ()-> where ('allow_videos_in_fyf ' , true )->count ();
961977
962978 $ softwareStats = Instance::select ('software ' )
963979 ->selectRaw ('COUNT(*) as count ' )
964980 ->selectRaw ('SUM(CASE WHEN allow_video_posts = 1 THEN 1 ELSE 0 END) as allow_video_posts_count ' )
981+ ->where ('is_blocked ' , false )
982+ ->active ()
965983 ->groupBy ('software ' )
966984 ->orderByDesc ('count ' )
967985 ->get ();
0 commit comments