From 929e1f1040e04cbe21faac3aaa25ee30e4fa8c1a Mon Sep 17 00:00:00 2001 From: Tetrakern <26898880+Tetrakern@users.noreply.github.com> Date: Fri, 6 Oct 2023 02:26:36 +0200 Subject: [PATCH] Improve database optimizer routine Now includes comment meta. --- .../functions/settings/_settings_actions.php | 61 +++++++++++++------ 1 file changed, 44 insertions(+), 17 deletions(-) diff --git a/includes/functions/settings/_settings_actions.php b/includes/functions/settings/_settings_actions.php index 06cd6cb6..220e0b10 100644 --- a/includes/functions/settings/_settings_actions.php +++ b/includes/functions/settings/_settings_actions.php @@ -114,7 +114,7 @@ if ( ! defined( 'FICTIONEER_ADMIN_SETTINGS_NOTICES' ) ) { 'fictioneer-not-renamed-role' => __( 'Error. Role could not be renamed.', 'fictioneer' ), 'fictioneer-removed-role' => __( 'Role removed.', 'fictioneer' ), 'fictioneer-not-removed-role' => __( 'Error. Role could not be removed.', 'fictioneer' ), - 'fictioneer-db-optimization-preview' => __( '%s superfluous rows found. Please backup your database before performing any optimization.', 'fictioneer' ), + 'fictioneer-db-optimization-preview' => __( '%s superfluous post meta rows found. %s superfluous comment meta rows found. Please backup your database before performing any optimization.', 'fictioneer' ), 'fictioneer-db-optimization' => __( '%s superfluous rows have been deleted.', 'fictioneer' ), 'fictioneer-add-story-hidden' => __( 'The "fictioneer_story_hidden" meta field has been appended with value 0.', 'fictioneer' ), 'fictioneer-add-story-sticky' => __( 'The "fictioneer_story_sticky" meta field has been appended with value 0.', 'fictioneer' ), @@ -134,29 +134,31 @@ function fictioneer_admin_settings_notices() { $success = $_GET['success'] ?? null; $failure = $_GET['failure'] ?? null; $info = $_GET['info'] ?? null; - $data = $_GET['data'] ?? ''; + $data = explode( ',', $_GET['data'] ?? '' ); + $data = is_array( $data ) ? $data : []; + $data = array_map( 'esc_html', $data ); // Has success notice? if ( ! empty( $success ) && isset( FICTIONEER_ADMIN_SETTINGS_NOTICES[ $success ] ) ) { - echo '
' . sprintf( + echo '
' . vsprintf( FICTIONEER_ADMIN_SETTINGS_NOTICES[ $success ], - esc_html( $data ) + $data ) . '
' . sprintf( + echo '
' . vsprintf( FICTIONEER_ADMIN_SETTINGS_NOTICES[ $failure ], - esc_html( $data ) + $data ) . '
' . sprintf( + echo '
' . vsprintf( FICTIONEER_ADMIN_SETTINGS_NOTICES[ $info ], - esc_html( $data ) + $data ) . '