'; echo '
New Professional Installation Method:
'; echo 'wp aivs install-schemawp aivs check-schemawp aivs sync-productswp aivs test-connectionSetup: Add your PostgreSQL connection string in '; echo 'Settings → AI Supabase '; echo 'and use WP-CLI commands for reliable schema management.
'; echo ''; echo 'Configure Connection '; echo 'Dismiss'; echo '
'; echo ''; } }); // Add plugin action links add_filter('plugin_action_links_' . plugin_basename(__FILE__), function($links) { $connection_mode = get_option('aivesese_connection_mode', 'lite'); $settings_link = 'Settings'; $status_link = 'Status'; // Add WP-CLI indicator $cli_indicator = ''; if (defined('WP_CLI') && WP_CLI && get_option('aivesese_postgres_connection_string')) { $cli_indicator = '⚡ CLI Ready'; } elseif (defined('WP_CLI') && WP_CLI) { $cli_indicator = '⚡ CLI Available'; } if ($connection_mode === 'api') { $mode_indicator = 'API Mode'; } elseif ($connection_mode === 'lite') { $mode_indicator = 'Lite Mode'; } else { $mode_indicator = 'Self-Hosted'; } $result_links = [$settings_link, $status_link, $mode_indicator]; if ($cli_indicator) { $result_links[] = $cli_indicator; } return array_merge($result_links, $links); }, 10, 1); // Add plugin row meta add_filter('plugin_row_meta', function($links, $file) { if ($file === plugin_basename(__FILE__)) { $row_meta = [ 'docs' => 'Documentation', 'support' => 'Support', 'api_service' => '🚀 Get API Service' ]; return array_merge($links, $row_meta); } return $links; }, 10, 2); // Add admin body class for styling add_filter('admin_body_class', function($classes) { $screen = get_current_screen(); if ($screen && strpos($screen->id, 'aivesese') !== false) { $connection_mode = get_option('aivesese_connection_mode', 'lite'); $classes .= ' aivesese-admin aivesese-mode-' . $connection_mode; } return $classes; }); add_action('plugins_loaded', function() { $current_version = get_option('aivesese_plugin_version', '0'); if (version_compare($current_version, AIVESESE_PLUGIN_VERSION, '<')) { // Plugin was updated, run database updates aivesese_update_database(); update_option('aivesese_plugin_version', AIVESESE_PLUGIN_VERSION); } }); function aivesese_update_database() { // Create/update analytics table $analytics = AIVectorSearch_Analytics::instance(); $analytics->create_table(); // Any other database updates for future versions // if (version_compare($old_version, '0.17.0', '<')) { // // Run updates for version 0.17.0 // } } // Load WP-CLI commands if WP-CLI is available if (defined('WP_CLI') && WP_CLI) { require_once AIVESESE_PLUGIN_PATH . 'includes/class-cli-commands.php'; } // Add PostgreSQL connection string to encryption manager add_filter('pre_update_option_aivesese_postgres_connection_string', function($value, $old_value, $option) { if (empty($value)) { return $value; } $encryption_manager = AIVectorSearch_Encryption_Manager::instance(); return wp_json_encode($encryption_manager->encrypt($value)); }, 10, 3); add_filter('option_aivesese_postgres_connection_string', function($value) { if (empty($value)) { return $value; } $arr = json_decode($value, true); if (is_array($arr)) { $encryption_manager = AIVectorSearch_Encryption_Manager::instance(); return $encryption_manager->decrypt($arr); } return $value; // Return as-is if not encrypted (backwards compatibility) }); // Add WP-CLI commands help to status page add_action('aivesese_status_page_footer', function() { if (!defined('WP_CLI') || !WP_CLI) { return; } $has_connection = !empty(get_option('aivesese_postgres_connection_string')); echo '✅ WP-CLI is available and PostgreSQL connection is configured!
'; echo '' . esc_html($command) . '';
echo '' . esc_html($description) . '
'; echo '💡 Recommended workflow:
'; echo 'wp aivs test-connection - Verify database accesswp aivs install-schema - Install database schemawp aivs sync-products - Sync your productswp aivs check-schema - Verify everything is working⚠️ WP-CLI is available but PostgreSQL connection string is not configured.
'; echo 'Add your connection string in Settings to enable WP-CLI commands.
'; echo '