-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug-current-provider.php
More file actions
68 lines (57 loc) · 1.84 KB
/
debug-current-provider.php
File metadata and controls
68 lines (57 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/**
* Debug script to check the current provider option value directly from the database.
*
* To use this script, visit it directly in your browser or run it from the command line:
* php debug-current-provider.php
*/
// Load WordPress
require_once dirname( __DIR__, 3 ) . '/wp-load.php';
// Check if the user is logged in and has admin capabilities
if ( ! function_exists( 'current_user_can' ) || ! current_user_can( 'manage_options' ) ) {
die( 'You need to be an administrator to run this script.' );
}
echo '<h1>AI Assistant Provider Debug</h1>';
// Get the option directly
$option_value = get_option( 'ai_assistant_current_provider' );
echo '<h2>Current Provider Option Value:</h2>';
echo '<pre>';
var_dump( $option_value );
echo '</pre>';
// Get the option directly from the database
global $wpdb;
$db_value = $wpdb->get_var(
$wpdb->prepare(
"SELECT option_value FROM {$wpdb->options} WHERE option_name = %s",
'ai_assistant_current_provider'
)
);
echo '<h2>Database Value:</h2>';
echo '<pre>';
var_dump( $db_value );
echo '</pre>';
// Check if the option exists
$option_exists = $wpdb->get_var(
$wpdb->prepare(
"SELECT COUNT(*) FROM {$wpdb->options} WHERE option_name = %s",
'ai_assistant_current_provider'
)
);
echo '<h2>Option Exists in Database:</h2>';
echo '<pre>';
var_dump( (bool) $option_exists );
echo '</pre>';
// Get provider credentials
$credentials = get_option( 'ai_assistant_provider_credentials' );
echo '<h2>Provider Credentials:</h2>';
echo '<pre>';
var_dump( $credentials );
echo '</pre>';
// List all available providers
require_once __DIR__ . '/Providers/Provider_Manager.php';
$provider_manager = new \Ai_Assistant\Providers\Provider_Manager();
$available_providers = $provider_manager->get_available_provider_ids();
echo '<h2>Available Providers:</h2>';
echo '<pre>';
var_dump( $available_providers );
echo '</pre>';