芝麻web文件管理V1.00
编辑当前文件:/home/felaukpo/public_html/wp-content/themes/pixelpiernyc/vamtam/admin/classes/migrations.php
get_col( "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE 'envato_purchase_code_%'" ); if ( empty( $potential_tokens ) ) { // Nothing to migrate - completed. delete_option( $last_attempt ); delete_option( $old_token_key ); update_option( $migration_flag, true ); return; } // Extract the actual token values (unique & non-empty). $token_values = array_filter( array_unique( array_map( 'get_option', $potential_tokens ) ) ); $response = wp_remote_post( 'https://updates.vamtam.com/0/envato/check-tokens', array( 'body' => array( 'tokens' => $token_values, ), ) ); if ( is_wp_error( $response ) ) { error_log( 'Token validation request failed: ' . $response->get_error_message() ); return; } $valid_tokens = json_decode( wp_remote_retrieve_body( $response ), true ); if ( ! is_array( $valid_tokens ) ) { error_log( 'Invalid response from token validation endpoint' ); return; } // Migrate valid tokens. $success = true; if ( ! empty( $valid_tokens ) ) { foreach ( $potential_tokens as $index => $option_name ) { $token = $token_values[ $index ]; if ( in_array( $token, $valid_tokens, true ) ) { $theme_id = str_replace( 'envato_purchase_code_', '', $option_name ); $new_option_name = $old_token_key . '_' . $theme_id; if ( ! update_option( $new_option_name, '1' ) ) { $success = false; break; } } } } if ( $success ) { // Tokens migrated - completed. delete_option( $last_attempt ); delete_option( $old_token_key ); update_option( $migration_flag, true ); } } }