Fixed the manage index statistics causing a 500 because the old warnings table is Gone.

This commit is contained in:
flash 2023-07-26 22:57:03 +00:00
parent a30df1b17c
commit 8480d5f043
2 changed files with 55 additions and 34 deletions

View file

@ -4,16 +4,16 @@ namespace Misuzu;
$statistics = DB::query(' $statistics = DB::query('
SELECT SELECT
( (
SELECT COUNT(`user_id`) SELECT COUNT(*)
FROM `msz_users` FROM `msz_users`
) AS `stat_users_total`, ) AS `stat_users_total`,
( (
SELECT COUNT(`user_id`) SELECT COUNT(*)
FROM `msz_users` FROM `msz_users`
WHERE `user_deleted` IS NOT NULL WHERE `user_deleted` IS NOT NULL
) AS `stat_users_deleted`, ) AS `stat_users_deleted`,
( (
SELECT COUNT(`user_id`) SELECT COUNT(*)
FROM `msz_users` FROM `msz_users`
WHERE `user_active` IS NOT NULL WHERE `user_active` IS NOT NULL
AND `user_deleted` IS NULL AND `user_deleted` IS NULL
@ -23,117 +23,117 @@ $statistics = DB::query('
FROM `msz_audit_log` FROM `msz_audit_log`
) AS `stat_audit_logs`, ) AS `stat_audit_logs`,
( (
SELECT COUNT(`change_id`) SELECT COUNT(*)
FROM `msz_changelog_changes` FROM `msz_changelog_changes`
) AS `stat_changelog_entries`, ) AS `stat_changelog_entries`,
( (
SELECT COUNT(`category_id`) SELECT COUNT(*)
FROM `msz_comments_categories` FROM `msz_comments_categories`
) AS `stat_comment_categories_total`, ) AS `stat_comment_categories_total`,
( (
SELECT COUNT(`category_id`) SELECT COUNT(*)
FROM `msz_comments_categories` FROM `msz_comments_categories`
WHERE `category_locked` IS NOT NULL WHERE `category_locked` IS NOT NULL
) AS `stat_comment_categories_locked`, ) AS `stat_comment_categories_locked`,
( (
SELECT COUNT(`comment_id`) SELECT COUNT(*)
FROM `msz_comments_posts` FROM `msz_comments_posts`
) AS `stat_comment_posts_total`, ) AS `stat_comment_posts_total`,
( (
SELECT COUNT(`comment_id`) SELECT COUNT(*)
FROM `msz_comments_posts` FROM `msz_comments_posts`
WHERE `comment_deleted` IS NOT NULL WHERE `comment_deleted` IS NOT NULL
) AS `stat_comment_posts_deleted`, ) AS `stat_comment_posts_deleted`,
( (
SELECT COUNT(`comment_id`) SELECT COUNT(*)
FROM `msz_comments_posts` FROM `msz_comments_posts`
WHERE `comment_reply_to` IS NOT NULL WHERE `comment_reply_to` IS NOT NULL
) AS `stat_comment_posts_replies`, ) AS `stat_comment_posts_replies`,
( (
SELECT COUNT(`comment_id`) SELECT COUNT(*)
FROM `msz_comments_posts` FROM `msz_comments_posts`
WHERE `comment_pinned` IS NOT NULL WHERE `comment_pinned` IS NOT NULL
) AS `stat_comment_posts_pinned`, ) AS `stat_comment_posts_pinned`,
( (
SELECT COUNT(`comment_id`) SELECT COUNT(*)
FROM `msz_comments_posts` FROM `msz_comments_posts`
WHERE `comment_edited` IS NOT NULL WHERE `comment_edited` IS NOT NULL
) AS `stat_comment_posts_edited`, ) AS `stat_comment_posts_edited`,
( (
SELECT COUNT(`user_id`) SELECT COUNT(*)
FROM `msz_comments_votes` FROM `msz_comments_votes`
WHERE `comment_vote` > 0 WHERE `comment_vote` > 0
) AS `stat_comment_likes`, ) AS `stat_comment_likes`,
( (
SELECT COUNT(`user_id`) SELECT COUNT(*)
FROM `msz_comments_votes` FROM `msz_comments_votes`
WHERE `comment_vote` < 0 WHERE `comment_vote` < 0
) AS `stat_comment_dislikes`, ) AS `stat_comment_dislikes`,
( (
SELECT COUNT(`post_id`) SELECT COUNT(*)
FROM `msz_forum_posts` FROM `msz_forum_posts`
) AS `stat_forum_posts_total`, ) AS `stat_forum_posts_total`,
( (
SELECT COUNT(`post_id`) SELECT COUNT(*)
FROM `msz_forum_posts` FROM `msz_forum_posts`
WHERE `post_deleted` IS NOT NULL WHERE `post_deleted` IS NOT NULL
) AS `stat_forum_posts_deleted`, ) AS `stat_forum_posts_deleted`,
( (
SELECT COUNT(`post_id`) SELECT COUNT(*)
FROM `msz_forum_posts` FROM `msz_forum_posts`
WHERE `post_edited` IS NOT NULL WHERE `post_edited` IS NOT NULL
) AS `stat_forum_posts_edited`, ) AS `stat_forum_posts_edited`,
( (
SELECT COUNT(`post_id`) SELECT COUNT(*)
FROM `msz_forum_posts` FROM `msz_forum_posts`
WHERE `post_parse` = 0 WHERE `post_parse` = 0
) AS `stat_forum_posts_plain`, ) AS `stat_forum_posts_plain`,
( (
SELECT COUNT(`post_id`) SELECT COUNT(*)
FROM `msz_forum_posts` FROM `msz_forum_posts`
WHERE `post_parse` = 1 WHERE `post_parse` = 1
) AS `stat_forum_posts_bbcode`, ) AS `stat_forum_posts_bbcode`,
( (
SELECT COUNT(`post_id`) SELECT COUNT(*)
FROM `msz_forum_posts` FROM `msz_forum_posts`
WHERE `post_parse` = 2 WHERE `post_parse` = 2
) AS `stat_forum_posts_markdown`, ) AS `stat_forum_posts_markdown`,
( (
SELECT COUNT(`post_id`) SELECT COUNT(*)
FROM `msz_forum_posts` FROM `msz_forum_posts`
WHERE `post_display_signature` != 0 WHERE `post_display_signature` != 0
) AS `stat_forum_posts_signature`, ) AS `stat_forum_posts_signature`,
( (
SELECT COUNT(`topic_id`) SELECT COUNT(*)
FROM `msz_forum_topics` FROM `msz_forum_topics`
) AS `stat_forum_topics_total`, ) AS `stat_forum_topics_total`,
( (
SELECT COUNT(`topic_id`) SELECT COUNT(*)
FROM `msz_forum_topics` FROM `msz_forum_topics`
WHERE `topic_type` = 0 WHERE `topic_type` = 0
) AS `stat_forum_topics_normal`, ) AS `stat_forum_topics_normal`,
( (
SELECT COUNT(`topic_id`) SELECT COUNT(*)
FROM `msz_forum_topics` FROM `msz_forum_topics`
WHERE `topic_type` = 1 WHERE `topic_type` = 1
) AS `stat_forum_topics_pinned`, ) AS `stat_forum_topics_pinned`,
( (
SELECT COUNT(`topic_id`) SELECT COUNT(*)
FROM `msz_forum_topics` FROM `msz_forum_topics`
WHERE `topic_type` = 2 WHERE `topic_type` = 2
) AS `stat_forum_topics_announce`, ) AS `stat_forum_topics_announce`,
( (
SELECT COUNT(`topic_id`) SELECT COUNT(*)
FROM `msz_forum_topics` FROM `msz_forum_topics`
WHERE `topic_type` = 3 WHERE `topic_type` = 3
) AS `stat_forum_topics_global_announce`, ) AS `stat_forum_topics_global_announce`,
( (
SELECT COUNT(`topic_id`) SELECT COUNT(*)
FROM `msz_forum_topics` FROM `msz_forum_topics`
WHERE `topic_deleted` IS NOT NULL WHERE `topic_deleted` IS NOT NULL
) AS `stat_forum_topics_deleted`, ) AS `stat_forum_topics_deleted`,
( (
SELECT COUNT(`topic_id`) SELECT COUNT(*)
FROM `msz_forum_topics` FROM `msz_forum_topics`
WHERE `topic_locked` IS NOT NULL WHERE `topic_locked` IS NOT NULL
) AS `stat_forum_topics_locked`, ) AS `stat_forum_topics_locked`,
@ -147,18 +147,35 @@ $statistics = DB::query('
WHERE `attempt_success` = 0 WHERE `attempt_success` = 0
) AS `stat_login_attempts_failed`, ) AS `stat_login_attempts_failed`,
( (
SELECT COUNT(`session_id`) SELECT COUNT(*)
FROM `msz_sessions` FROM `msz_sessions`
) AS `stat_user_sessions`, ) AS `stat_user_sessions`,
( (
SELECT COUNT(`user_id`) SELECT COUNT(*)
FROM `msz_users_password_resets` FROM `msz_users_password_resets`
) AS `stat_user_password_resets`, ) AS `stat_user_password_resets`,
( (
SELECT COUNT(`warning_id`) SELECT COUNT(*)
FROM `msz_user_warnings` FROM `msz_users_modnotes`
WHERE `warning_type` != 0 ) AS `stat_user_modnotes`,
) AS `stat_user_warnings` (
SELECT COUNT(*)
FROM `msz_users_warnings`
) AS `stat_user_warnings_total`,
(
SELECT COUNT(*)
FROM `msz_users_warnings`
WHERE warn_created > NOW() - INTERVAL 90 DAY
) AS `stat_user_warnings_visible`,
(
SELECT COUNT(*)
FROM `msz_users_bans`
) AS `stat_user_bans_total`,
(
SELECT COUNT(*)
FROM `msz_users_bans`
WHERE ban_expires IS NULL OR ban_expires > NOW()
) AS `stat_user_bans_active`
')->fetch(); ')->fetch();
Template::render('manage.general.overview', [ Template::render('manage.general.overview', [

View file

@ -34,7 +34,11 @@
'stat_login_attempts_failed': 'Failed Login Attempts', 'stat_login_attempts_failed': 'Failed Login Attempts',
'stat_user_sessions': 'Active User Sessions', 'stat_user_sessions': 'Active User Sessions',
'stat_user_password_resets': 'Pending Password Resets', 'stat_user_password_resets': 'Pending Password Resets',
'stat_user_warnings': 'User Warnings', 'stat_user_modnotes': 'Moderator Notes',
'stat_user_warnings_total': 'Total User Warnings',
'stat_user_warnings_visible': 'Visible User Warnings',
'stat_user_bans_total': 'Total User Bans',
'stat_user_bans_active': 'Active User Bans',
} %} } %}
{% block manage_content %} {% block manage_content %}