diff --git a/pantheon-sessions.php b/pantheon-sessions.php index fef8f65..e4552db 100644 --- a/pantheon-sessions.php +++ b/pantheon-sessions.php @@ -73,24 +73,24 @@ private function load() { add_action( 'clear_auth_cookie', [ __CLASS__, 'action_clear_auth_cookie' ] ); } - add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); - add_action( 'wp_ajax_dismiss_notice', [ $this, 'dismiss_notice' ] ); + add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); + add_action( 'wp_ajax_dismiss_notice', [ $this, 'dismiss_notice' ] ); } - /** - * Enqueue scripts - */ - public function enqueue_scripts() { - wp_enqueue_script( 'notices', plugins_url( '/assets/js/notices.js', __FILE__ ), ['jquery'], PANTHEON_SESSIONS_VERSION, true ); - } - - /** - * Dismiss the notice when the button is clicked. - */ - public function dismiss_notice() { - $user_id = get_current_user_id(); - update_user_meta( $user_id, 'notice_dismissed', true ); - } + /** + * Enqueue scripts + */ + public function enqueue_scripts() { + wp_enqueue_script( 'notices', plugins_url( '/assets/js/notices.js', __FILE__ ), [ 'jquery' ], PANTHEON_SESSIONS_VERSION, true ); + } + + /** + * Dismiss the notice when the button is clicked. + */ + public function dismiss_notice() { + $user_id = get_current_user_id(); + update_user_meta( $user_id, 'notice_dismissed', true ); + } /** * Define our constants @@ -288,32 +288,34 @@ public static function check_native_primary_keys() { $table_name = $wpdb->prefix . 'pantheon_sessions'; $old_table = $wpdb->prefix . 'bak_pantheon_sessions'; $query = "SHOW KEYS FROM {$table_name} WHERE key_name = 'PRIMARY';"; - $is_pantheon = isset( $_ENV['PANTHEON_ENVIRONMENT'] ) ? true : false; - $wp_cli_cmd = $is_pantheon ? 'terminus wp <site>.<env> --' : 'wp'; - $cli_add_index = $wp_cli_cmd . 'pantheon session add-index'; + $is_pantheon = isset( $_ENV['PANTHEON_ENVIRONMENT'] ) ? true : false; + $wp_cli_cmd = $is_pantheon ? 'terminus wp <site>.<env> --' : 'wp'; + $cli_add_index = $wp_cli_cmd . 'pantheon session add-index'; $key_existence = $wpdb->get_results( $query ); - $user_id = get_current_user_id(); - $dismissed = get_user_meta( $user_id, 'notice_dismissed', true ); + $user_id = get_current_user_id(); + $dismissed = get_user_meta( $user_id, 'notice_dismissed', true ); if ( empty( $key_existence ) ) { - if ( ! $dismissed ) { - // If the key doesn't exist, recommend remediation. - ?> -
- -
-- $cli_add_index" ) ); - ?> -
-+ +
++ $cli_add_index" ) ); + ?> +
+
- $cli_key_finalize", "$cli_key_revert
" ) );
- ?>
-
$cli_key_revert
" ) );
+ ?>
+