HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/shoetique/wp-content/plugins/facebook-for-woocommerce/includes/Utilities/DebugTools.php
<?php

namespace WooCommerce\Facebook\Utilities;

/**
 * Class DebugTools
 *
 * @since 3.0.5
 */
class DebugTools {

	/**
	 * Initialize the class.
	 *
	 * @since 3.0.5
	 */
	public function __construct() {
		if ( is_admin() && ! wp_doing_ajax() ) {
			add_filter( 'woocommerce_debug_tools', [ $this, 'add_debug_tool' ] );
		}
	}

	/**
	 * Adds clear settings tool to WC system status -> tools page.
	 *
	 * @since 3.0.5
	 *
	 * @param array $tools system status tools.
	 * @return array
	 */
	public function add_debug_tool( $tools ) {
		if ( ! facebook_for_woocommerce()->get_connection_handler()->is_connected()
			|| ! facebook_for_woocommerce()->get_integration()->is_debug_mode_enabled() ) {
			return $tools;
		}

		$tools['wc_facebook_settings_reset'] = [
			'name'     => __( 'Facebook: Reset connection settings', 'facebook-for-woocommerce' ),
			'button'   => __( 'Reset settings', 'facebook-for-woocommerce' ),
			'desc'     => __( 'This tool will clear your Facebook settings to reset them, allowing you to rebuild your connection.', 'facebook-for-woocommerce' ),
			'callback' => [ $this, 'clear_facebook_settings' ],
		];

		$tools['wc_facebook_delete_background_jobs'] = [
			'name'     => __( 'Facebook: Delete Background Sync Jobs', 'facebook-for-woocommerce' ),
			'button'   => __( 'Clear Background Sync Jobs', 'facebook-for-woocommerce' ),
			'desc'     => __( 'This tool will clear your clear background sync jobs from the options table.', 'facebook-for-woocommerce' ),
			'callback' => [ $this, 'clean_up_old_background_sync_options' ],
		];

		$tools['reset_all_product_fb_settings'] = [
			'name'     => __( 'Facebook: Reset all products', 'facebook-for-woocommerce' ),
			'button'   => __( 'Reset products Facebook settings', 'facebook-for-woocommerce' ),
			'desc'     => __( 'This tool will reset Facebook settings for all products on your WooCommerce store.', 'facebook-for-woocommerce' ),
			'callback' => [ $this, 'reset_all_product_fb_settings' ],
		];

		$tools['wc_facebook_delete_all_products'] = [
			'name'     => __( 'Facebook: Delete all products from your Facebook Catalog', 'facebook-for-woocommerce' ),
			'button'   => __( 'Delete all products', 'facebook-for-woocommerce' ),
			'desc'     => __( 'This tool will delete all products from  your Facebook Catalog.', 'facebook-for-woocommerce' ),
			'callback' => [ $this, 'delete_all_products' ],
		];

		return $tools;
	}

	/**
	 * Runs the Delete Background Sync Jobs tool.
	 *
	 * @since 3.0.5
	 *
	 * @return string
	 */
	public function clean_up_old_background_sync_options() {
		global $wpdb;

		$wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE '%wc_facebook_background_product_sync%'" );

		return __( 'Background sync jobs have been deleted.', 'facebook-for-woocommerce' );
	}

	/**
	 * Runs the clear settings tool.
	 *
	 * @since 3.0.5
	 *
	 * @return string
	 */
	public function clear_facebook_settings() {
		// Disconnect FB.
		facebook_for_woocommerce()->get_connection_handler()->disconnect();

		return esc_html__( 'Cleared all Facebook settings!', 'facebook-for-woocommerce' );
	}

	/**
	 * Runs the reset all catalog products settings tool.
	 *
	 * @since 3.0.5
	 *
	 * @return string
	 */
	public function reset_all_product_fb_settings() {
		facebook_for_woocommerce()->job_manager->reset_all_product_fb_settings->queue_start();
		return esc_html__( 'Reset products Facebook settings job started!', 'facebook-for-woocommerce' );
	}

	/**
	 * Delete products from Facebook catalog.
	 *
	 * @since 3.0.5
	 *
	 * @return string
	 */
	public function delete_all_products() {
		facebook_for_woocommerce()->job_manager->delete_all_products->queue_start();
		return esc_html__( 'Delete products from Facebook catalog job started!', 'facebook-for-woocommerce' );
	}
}