Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/woocomme.../includes
File: class-wc-install.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Installation related functions and actions.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WooCommerce\Classes
[4] Fix | Delete
* @version x.x.x
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
use Automattic\Jetpack\Constants;
[8] Fix | Delete
use Automattic\WooCommerce\Admin\API\Reports\Orders\Stats\DataStore;
[9] Fix | Delete
use Automattic\WooCommerce\Enums\ProductType;
[10] Fix | Delete
use Automattic\WooCommerce\Internal\Admin\EmailImprovements\EmailImprovements;
[11] Fix | Delete
use Automattic\WooCommerce\Internal\TransientFiles\TransientFilesEngine;
[12] Fix | Delete
use Automattic\WooCommerce\Internal\DataStores\Orders\{ CustomOrdersTableController, DataSynchronizer, OrdersTableDataStore };
[13] Fix | Delete
use Automattic\WooCommerce\Internal\DataStores\StockNotifications\StockNotificationsDataStore;
[14] Fix | Delete
use Automattic\WooCommerce\Internal\Features\FeaturesController;
[15] Fix | Delete
use Automattic\WooCommerce\Internal\ProductAttributesLookup\DataRegenerator;
[16] Fix | Delete
use Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories\Synchronize as Download_Directories_Sync;
[17] Fix | Delete
use Automattic\WooCommerce\Admin\API\Reports\Orders\Stats\DataStore as OrdersStatsDataStore;
[18] Fix | Delete
use Automattic\WooCommerce\Utilities\FeaturesUtil;
[19] Fix | Delete
use Automattic\WooCommerce\Internal\Utilities\DatabaseUtil;
[20] Fix | Delete
use Automattic\WooCommerce\Internal\WCCom\ConnectionHelper as WCConnectionHelper;
[21] Fix | Delete
use Automattic\WooCommerce\Utilities\{ OrderUtil, PluginUtil };
[22] Fix | Delete
use Automattic\WooCommerce\Internal\Utilities\PluginInstaller;
[23] Fix | Delete
[24] Fix | Delete
defined( 'ABSPATH' ) || exit;
[25] Fix | Delete
[26] Fix | Delete
/**
[27] Fix | Delete
* WC_Install Class.
[28] Fix | Delete
*/
[29] Fix | Delete
class WC_Install {
[30] Fix | Delete
/**
[31] Fix | Delete
* DB updates and callbacks that need to be run per version.
[32] Fix | Delete
*
[33] Fix | Delete
* Please note that these functions are invoked when WooCommerce is updated from a previous version,
[34] Fix | Delete
* but NOT when WooCommerce is newly installed.
[35] Fix | Delete
*
[36] Fix | Delete
* Database schema changes must be incorporated to the SQL returned by get_schema, which is applied
[37] Fix | Delete
* via dbDelta at both install and update time. If any other kind of database change is required
[38] Fix | Delete
* at install time (e.g. populating tables), use the 'woocommerce_installed' hook.
[39] Fix | Delete
*
[40] Fix | Delete
* IMPORTANT:
[41] Fix | Delete
* When adding new update callbacks after feature freeze, always use a unique version key with a suffix (e.g. `10.2.0-1`)
[42] Fix | Delete
* if the base version already exists in the array.
[43] Fix | Delete
* This ensures all users, including those on beta or RC versions, receive the update.
[44] Fix | Delete
*
[45] Fix | Delete
* @var array
[46] Fix | Delete
*/
[47] Fix | Delete
private static $db_updates = array(
[48] Fix | Delete
'2.0.0' => array(
[49] Fix | Delete
'wc_update_200_file_paths',
[50] Fix | Delete
'wc_update_200_permalinks',
[51] Fix | Delete
'wc_update_200_subcat_display',
[52] Fix | Delete
'wc_update_200_taxrates',
[53] Fix | Delete
'wc_update_200_line_items',
[54] Fix | Delete
'wc_update_200_images',
[55] Fix | Delete
'wc_update_200_db_version',
[56] Fix | Delete
),
[57] Fix | Delete
'2.0.9' => array(
[58] Fix | Delete
'wc_update_209_brazillian_state',
[59] Fix | Delete
'wc_update_209_db_version',
[60] Fix | Delete
),
[61] Fix | Delete
'2.1.0' => array(
[62] Fix | Delete
'wc_update_210_remove_pages',
[63] Fix | Delete
'wc_update_210_file_paths',
[64] Fix | Delete
'wc_update_210_db_version',
[65] Fix | Delete
),
[66] Fix | Delete
'2.2.0' => array(
[67] Fix | Delete
'wc_update_220_shipping',
[68] Fix | Delete
'wc_update_220_order_status',
[69] Fix | Delete
'wc_update_220_variations',
[70] Fix | Delete
'wc_update_220_attributes',
[71] Fix | Delete
'wc_update_220_db_version',
[72] Fix | Delete
),
[73] Fix | Delete
'2.3.0' => array(
[74] Fix | Delete
'wc_update_230_options',
[75] Fix | Delete
'wc_update_230_db_version',
[76] Fix | Delete
),
[77] Fix | Delete
'2.4.0' => array(
[78] Fix | Delete
'wc_update_240_options',
[79] Fix | Delete
'wc_update_240_shipping_methods',
[80] Fix | Delete
'wc_update_240_api_keys',
[81] Fix | Delete
'wc_update_240_refunds',
[82] Fix | Delete
'wc_update_240_db_version',
[83] Fix | Delete
),
[84] Fix | Delete
'2.4.1' => array(
[85] Fix | Delete
'wc_update_241_variations',
[86] Fix | Delete
'wc_update_241_db_version',
[87] Fix | Delete
),
[88] Fix | Delete
'2.5.0' => array(
[89] Fix | Delete
'wc_update_250_currency',
[90] Fix | Delete
'wc_update_250_db_version',
[91] Fix | Delete
),
[92] Fix | Delete
'2.6.0' => array(
[93] Fix | Delete
'wc_update_260_options',
[94] Fix | Delete
'wc_update_260_termmeta',
[95] Fix | Delete
'wc_update_260_zones',
[96] Fix | Delete
'wc_update_260_zone_methods',
[97] Fix | Delete
'wc_update_260_refunds',
[98] Fix | Delete
'wc_update_260_db_version',
[99] Fix | Delete
),
[100] Fix | Delete
'3.0.0' => array(
[101] Fix | Delete
'wc_update_300_grouped_products',
[102] Fix | Delete
'wc_update_300_settings',
[103] Fix | Delete
'wc_update_300_product_visibility',
[104] Fix | Delete
'wc_update_300_db_version',
[105] Fix | Delete
),
[106] Fix | Delete
'3.1.0' => array(
[107] Fix | Delete
'wc_update_310_downloadable_products',
[108] Fix | Delete
'wc_update_310_old_comments',
[109] Fix | Delete
'wc_update_310_db_version',
[110] Fix | Delete
),
[111] Fix | Delete
'3.1.2' => array(
[112] Fix | Delete
'wc_update_312_shop_manager_capabilities',
[113] Fix | Delete
'wc_update_312_db_version',
[114] Fix | Delete
),
[115] Fix | Delete
'3.2.0' => array(
[116] Fix | Delete
'wc_update_320_mexican_states',
[117] Fix | Delete
'wc_update_320_db_version',
[118] Fix | Delete
),
[119] Fix | Delete
'3.3.0' => array(
[120] Fix | Delete
'wc_update_330_image_options',
[121] Fix | Delete
'wc_update_330_webhooks',
[122] Fix | Delete
'wc_update_330_product_stock_status',
[123] Fix | Delete
'wc_update_330_set_default_product_cat',
[124] Fix | Delete
'wc_update_330_clear_transients',
[125] Fix | Delete
'wc_update_330_set_paypal_sandbox_credentials',
[126] Fix | Delete
'wc_update_330_db_version',
[127] Fix | Delete
),
[128] Fix | Delete
'3.4.0' => array(
[129] Fix | Delete
'wc_update_340_states',
[130] Fix | Delete
'wc_update_340_state',
[131] Fix | Delete
'wc_update_340_last_active',
[132] Fix | Delete
'wc_update_340_db_version',
[133] Fix | Delete
),
[134] Fix | Delete
'3.4.3' => array(
[135] Fix | Delete
'wc_update_343_cleanup_foreign_keys',
[136] Fix | Delete
'wc_update_343_db_version',
[137] Fix | Delete
),
[138] Fix | Delete
'3.4.4' => array(
[139] Fix | Delete
'wc_update_344_recreate_roles',
[140] Fix | Delete
'wc_update_344_db_version',
[141] Fix | Delete
),
[142] Fix | Delete
'3.5.0' => array(
[143] Fix | Delete
'wc_update_350_reviews_comment_type',
[144] Fix | Delete
'wc_update_350_db_version',
[145] Fix | Delete
),
[146] Fix | Delete
'3.5.2' => array(
[147] Fix | Delete
'wc_update_352_drop_download_log_fk',
[148] Fix | Delete
),
[149] Fix | Delete
'3.5.4' => array(
[150] Fix | Delete
'wc_update_354_modify_shop_manager_caps',
[151] Fix | Delete
'wc_update_354_db_version',
[152] Fix | Delete
),
[153] Fix | Delete
'3.6.0' => array(
[154] Fix | Delete
'wc_update_360_product_lookup_tables',
[155] Fix | Delete
'wc_update_360_term_meta',
[156] Fix | Delete
'wc_update_360_downloadable_product_permissions_index',
[157] Fix | Delete
'wc_update_360_db_version',
[158] Fix | Delete
),
[159] Fix | Delete
'3.7.0' => array(
[160] Fix | Delete
'wc_update_370_tax_rate_classes',
[161] Fix | Delete
'wc_update_370_mro_std_currency',
[162] Fix | Delete
'wc_update_370_db_version',
[163] Fix | Delete
),
[164] Fix | Delete
'3.9.0' => array(
[165] Fix | Delete
'wc_update_390_move_maxmind_database',
[166] Fix | Delete
'wc_update_390_change_geolocation_database_update_cron',
[167] Fix | Delete
'wc_update_390_db_version',
[168] Fix | Delete
),
[169] Fix | Delete
'4.0.0' => array(
[170] Fix | Delete
'wc_update_product_lookup_tables',
[171] Fix | Delete
'wc_update_400_increase_size_of_column',
[172] Fix | Delete
'wc_update_400_reset_action_scheduler_migration_status',
[173] Fix | Delete
'wc_admin_update_0201_order_status_index',
[174] Fix | Delete
'wc_admin_update_0230_rename_gross_total',
[175] Fix | Delete
'wc_admin_update_0251_remove_unsnooze_action',
[176] Fix | Delete
'wc_update_400_db_version',
[177] Fix | Delete
),
[178] Fix | Delete
'4.4.0' => array(
[179] Fix | Delete
'wc_update_440_insert_attribute_terms_for_variable_products',
[180] Fix | Delete
'wc_admin_update_110_remove_facebook_note',
[181] Fix | Delete
'wc_admin_update_130_remove_dismiss_action_from_tracking_opt_in_note',
[182] Fix | Delete
'wc_update_440_db_version',
[183] Fix | Delete
),
[184] Fix | Delete
'4.5.0' => array(
[185] Fix | Delete
'wc_update_450_sanitize_coupons_code',
[186] Fix | Delete
'wc_update_450_db_version',
[187] Fix | Delete
),
[188] Fix | Delete
'5.0.0' => array(
[189] Fix | Delete
'wc_update_500_fix_product_review_count',
[190] Fix | Delete
'wc_admin_update_160_remove_facebook_note',
[191] Fix | Delete
'wc_admin_update_170_homescreen_layout',
[192] Fix | Delete
'wc_update_500_db_version',
[193] Fix | Delete
),
[194] Fix | Delete
'5.6.0' => array(
[195] Fix | Delete
'wc_update_560_create_refund_returns_page',
[196] Fix | Delete
'wc_update_560_db_version',
[197] Fix | Delete
),
[198] Fix | Delete
'6.0.0' => array(
[199] Fix | Delete
'wc_update_600_migrate_rate_limit_options',
[200] Fix | Delete
'wc_admin_update_270_delete_report_downloads',
[201] Fix | Delete
'wc_admin_update_271_update_task_list_options',
[202] Fix | Delete
'wc_admin_update_280_order_status',
[203] Fix | Delete
'wc_admin_update_290_update_apperance_task_option',
[204] Fix | Delete
'wc_admin_update_290_delete_default_homepage_layout_option',
[205] Fix | Delete
'wc_update_600_db_version',
[206] Fix | Delete
),
[207] Fix | Delete
'6.3.0' => array(
[208] Fix | Delete
'wc_update_630_create_product_attributes_lookup_table',
[209] Fix | Delete
'wc_admin_update_300_update_is_read_from_last_read',
[210] Fix | Delete
'wc_update_630_db_version',
[211] Fix | Delete
),
[212] Fix | Delete
'6.4.0' => array(
[213] Fix | Delete
'wc_update_640_add_primary_key_to_product_attributes_lookup_table',
[214] Fix | Delete
'wc_admin_update_340_remove_is_primary_from_note_action',
[215] Fix | Delete
'wc_update_640_db_version',
[216] Fix | Delete
),
[217] Fix | Delete
'6.5.0' => array(
[218] Fix | Delete
'wc_update_650_approved_download_directories',
[219] Fix | Delete
),
[220] Fix | Delete
'6.5.1' => array(
[221] Fix | Delete
'wc_update_651_approved_download_directories',
[222] Fix | Delete
),
[223] Fix | Delete
'6.7.0' => array(
[224] Fix | Delete
'wc_update_670_purge_comments_count_cache',
[225] Fix | Delete
'wc_update_670_delete_deprecated_remote_inbox_notifications_option',
[226] Fix | Delete
),
[227] Fix | Delete
'7.0.0' => array(
[228] Fix | Delete
'wc_update_700_remove_download_log_fk',
[229] Fix | Delete
'wc_update_700_remove_recommended_marketing_plugins_transient',
[230] Fix | Delete
),
[231] Fix | Delete
'7.2.1' => array(
[232] Fix | Delete
'wc_update_721_adjust_new_zealand_states',
[233] Fix | Delete
'wc_update_721_adjust_ukraine_states',
[234] Fix | Delete
),
[235] Fix | Delete
'7.2.2' => array(
[236] Fix | Delete
'wc_update_722_adjust_new_zealand_states',
[237] Fix | Delete
'wc_update_722_adjust_ukraine_states',
[238] Fix | Delete
),
[239] Fix | Delete
'7.5.0' => array(
[240] Fix | Delete
'wc_update_750_add_columns_to_order_stats_table',
[241] Fix | Delete
'wc_update_750_disable_new_product_management_experience',
[242] Fix | Delete
),
[243] Fix | Delete
'7.7.0' => array(
[244] Fix | Delete
'wc_update_770_remove_multichannel_marketing_feature_options',
[245] Fix | Delete
),
[246] Fix | Delete
'7.9.0' => array(
[247] Fix | Delete
'wc_update_790_blockified_product_grid_block',
[248] Fix | Delete
),
[249] Fix | Delete
'8.1.0' => array(
[250] Fix | Delete
'wc_update_810_migrate_transactional_metadata_for_hpos',
[251] Fix | Delete
),
[252] Fix | Delete
'8.3.0' => array(
[253] Fix | Delete
'wc_update_830_rename_checkout_template',
[254] Fix | Delete
'wc_update_830_rename_cart_template',
[255] Fix | Delete
),
[256] Fix | Delete
'8.6.0' => array(
[257] Fix | Delete
'wc_update_860_remove_recommended_marketing_plugins_transient',
[258] Fix | Delete
),
[259] Fix | Delete
'8.7.0' => array(
[260] Fix | Delete
'wc_update_870_prevent_listing_of_transient_files_directory',
[261] Fix | Delete
),
[262] Fix | Delete
'8.9.0' => array(
[263] Fix | Delete
'wc_update_890_update_connect_to_woocommerce_note',
[264] Fix | Delete
'wc_update_890_update_paypal_standard_load_eligibility',
[265] Fix | Delete
),
[266] Fix | Delete
'8.9.1' => array(
[267] Fix | Delete
'wc_update_891_create_plugin_autoinstall_history_option',
[268] Fix | Delete
),
[269] Fix | Delete
'9.1.0' => array(
[270] Fix | Delete
'wc_update_910_add_launch_your_store_tour_option',
[271] Fix | Delete
'wc_update_910_remove_obsolete_user_meta',
[272] Fix | Delete
),
[273] Fix | Delete
'9.2.0' => array(
[274] Fix | Delete
'wc_update_920_add_wc_hooked_blocks_version_option',
[275] Fix | Delete
),
[276] Fix | Delete
'9.3.0' => array(
[277] Fix | Delete
'wc_update_930_add_woocommerce_coming_soon_option',
[278] Fix | Delete
'wc_update_930_migrate_user_meta_for_launch_your_store_tour',
[279] Fix | Delete
),
[280] Fix | Delete
'9.4.0' => array(
[281] Fix | Delete
'wc_update_940_add_phone_to_order_address_fts_index',
[282] Fix | Delete
'wc_update_940_remove_help_panel_highlight_shown',
[283] Fix | Delete
),
[284] Fix | Delete
'9.5.0' => array(
[285] Fix | Delete
'wc_update_950_tracking_option_autoload',
[286] Fix | Delete
),
[287] Fix | Delete
'9.6.1' => array(
[288] Fix | Delete
'wc_update_961_migrate_default_email_base_color',
[289] Fix | Delete
),
[290] Fix | Delete
'9.8.0' => array(
[291] Fix | Delete
'wc_update_980_remove_order_attribution_install_banner_dismissed_option',
[292] Fix | Delete
),
[293] Fix | Delete
'9.8.5' => array(
[294] Fix | Delete
'wc_update_985_enable_new_payments_settings_page_feature',
[295] Fix | Delete
),
[296] Fix | Delete
'9.9.0' => array(
[297] Fix | Delete
'wc_update_990_remove_wc_count_comments_transient',
[298] Fix | Delete
'wc_update_990_remove_email_notes',
[299] Fix | Delete
),
[300] Fix | Delete
'10.0.0' => array(
[301] Fix | Delete
'wc_update_1000_multisite_visibility_setting',
[302] Fix | Delete
'wc_update_1000_remove_patterns_toolkit_transient',
[303] Fix | Delete
),
[304] Fix | Delete
'10.2.0' => array(
[305] Fix | Delete
'wc_update_1020_add_old_refunded_order_items_to_product_lookup_table',
[306] Fix | Delete
),
[307] Fix | Delete
'10.3.0' => array(
[308] Fix | Delete
'wc_update_1030_add_comments_date_type_index',
[309] Fix | Delete
),
[310] Fix | Delete
'10.4.0' => array(
[311] Fix | Delete
'wc_update_1040_add_idx_date_paid_status_parent',
[312] Fix | Delete
'wc_update_1040_cleanup_legacy_ptk_patterns_fetching',
[313] Fix | Delete
),
[314] Fix | Delete
'10.5.0' => array(
[315] Fix | Delete
'wc_update_1050_migrate_brand_permalink_setting',
[316] Fix | Delete
'wc_update_1050_enable_autoload_options',
[317] Fix | Delete
'wc_update_1050_add_idx_user_email',
[318] Fix | Delete
'wc_update_1050_remove_deprecated_marketplace_option',
[319] Fix | Delete
),
[320] Fix | Delete
'10.6.0' => array(
[321] Fix | Delete
'wc_update_1060_add_woo_idx_comment_approved_type_index',
[322] Fix | Delete
),
[323] Fix | Delete
);
[324] Fix | Delete
[325] Fix | Delete
/**
[326] Fix | Delete
* Option name used to track new installations of WooCommerce.
[327] Fix | Delete
*
[328] Fix | Delete
* @var string
[329] Fix | Delete
*/
[330] Fix | Delete
const NEWLY_INSTALLED_OPTION = 'woocommerce_newly_installed';
[331] Fix | Delete
[332] Fix | Delete
/**
[333] Fix | Delete
* Option name used to track new installation versions of WooCommerce.
[334] Fix | Delete
*
[335] Fix | Delete
* @var string
[336] Fix | Delete
*/
[337] Fix | Delete
const INITIAL_INSTALLED_VERSION = 'woocommerce_initial_installed_version';
[338] Fix | Delete
[339] Fix | Delete
/**
[340] Fix | Delete
* Option name used to uniquely identify installations of WooCommerce.
[341] Fix | Delete
*
[342] Fix | Delete
* @var string
[343] Fix | Delete
*/
[344] Fix | Delete
const STORE_ID_OPTION = 'woocommerce_store_id';
[345] Fix | Delete
[346] Fix | Delete
/**
[347] Fix | Delete
* Hook in tabs.
[348] Fix | Delete
*
[349] Fix | Delete
* @return void
[350] Fix | Delete
*/
[351] Fix | Delete
public static function init() {
[352] Fix | Delete
if ( ! empty( $GLOBALS['wc_uninstalling_plugin'] ) ) {
[353] Fix | Delete
return;
[354] Fix | Delete
}
[355] Fix | Delete
[356] Fix | Delete
add_action( 'init', array( __CLASS__, 'check_version' ), 5 );
[357] Fix | Delete
add_action( 'init', array( __CLASS__, 'manual_database_update' ), 20 );
[358] Fix | Delete
add_action( 'woocommerce_newly_installed', array( __CLASS__, 'maybe_enable_hpos' ), 20 );
[359] Fix | Delete
add_action( 'woocommerce_newly_installed', array( __CLASS__, 'add_coming_soon_option' ), 20 );
[360] Fix | Delete
add_action( 'woocommerce_newly_installed', array( __CLASS__, 'enable_email_improvements_for_newly_installed' ), 20 );
[361] Fix | Delete
add_action( 'woocommerce_newly_installed', array( __CLASS__, 'enable_customer_stock_notifications_signups' ), 20 );
[362] Fix | Delete
add_action( 'woocommerce_newly_installed', array( __CLASS__, 'enable_analytics_scheduled_import' ), 20 );
[363] Fix | Delete
add_action( 'woocommerce_updated', array( __CLASS__, 'enable_email_improvements_for_existing_merchants' ), 20 );
[364] Fix | Delete
add_action( 'woocommerce_run_update_callback', array( __CLASS__, 'run_update_callback' ) );
[365] Fix | Delete
add_action( 'woocommerce_update_db_to_current_version', array( __CLASS__, 'update_db_version' ) );
[366] Fix | Delete
add_action( 'admin_init', array( __CLASS__, 'install_actions' ) );
[367] Fix | Delete
add_action( 'woocommerce_page_created', array( __CLASS__, 'page_created' ), 10, 2 );
[368] Fix | Delete
add_filter( 'plugin_action_links_' . WC_PLUGIN_BASENAME, array( __CLASS__, 'plugin_action_links' ) );
[369] Fix | Delete
add_filter( 'plugin_row_meta', array( __CLASS__, 'plugin_row_meta' ), 10, 2 );
[370] Fix | Delete
add_filter( 'wpmu_drop_tables', array( __CLASS__, 'wpmu_drop_tables' ) );
[371] Fix | Delete
add_filter( 'cron_schedules', array( __CLASS__, 'cron_schedules' ) );
[372] Fix | Delete
add_action( 'admin_init', array( __CLASS__, 'newly_installed' ) );
[373] Fix | Delete
add_action( 'woocommerce_activate_legacy_rest_api_plugin', array( __CLASS__, 'maybe_install_legacy_api_plugin' ) );
[374] Fix | Delete
[375] Fix | Delete
// DB update notice.
[376] Fix | Delete
add_filter( 'woocommerce_get_note_from_db', array( \WC_Notes_Run_Db_Update::class, 'maybe_update_notice' ), 10 );
[377] Fix | Delete
add_action( 'woocommerce_hide_update_notice', array( __CLASS__, 'remove_update_db_notice' ) );
[378] Fix | Delete
}
[379] Fix | Delete
[380] Fix | Delete
/**
[381] Fix | Delete
* Trigger `woocommerce_newly_installed` action for new installations.
[382] Fix | Delete
*
[383] Fix | Delete
* @since 8.0.0
[384] Fix | Delete
*
[385] Fix | Delete
* @internal For exclusive usage of WooCommerce core, backwards compatibility not guaranteed.
[386] Fix | Delete
*
[387] Fix | Delete
* @return void
[388] Fix | Delete
*/
[389] Fix | Delete
public static function newly_installed() {
[390] Fix | Delete
if ( 'yes' === get_option( self::NEWLY_INSTALLED_OPTION, false ) ) {
[391] Fix | Delete
/**
[392] Fix | Delete
* Run when WooCommerce has been installed for the first time.
[393] Fix | Delete
*
[394] Fix | Delete
* @since 6.5.0
[395] Fix | Delete
*/
[396] Fix | Delete
do_action( 'woocommerce_newly_installed' );
[397] Fix | Delete
do_action_deprecated( 'woocommerce_admin_newly_installed', array(), '6.5.0', 'woocommerce_newly_installed' );
[398] Fix | Delete
[399] Fix | Delete
update_option( self::NEWLY_INSTALLED_OPTION, 'no' );
[400] Fix | Delete
[401] Fix | Delete
/**
[402] Fix | Delete
* This option is used to track the initial version of WooCommerce that was installed.
[403] Fix | Delete
*
[404] Fix | Delete
* @since 9.2.0
[405] Fix | Delete
*/
[406] Fix | Delete
add_option( self::INITIAL_INSTALLED_VERSION, WC()->version, '', false );
[407] Fix | Delete
}
[408] Fix | Delete
}
[409] Fix | Delete
[410] Fix | Delete
/**
[411] Fix | Delete
* Check WooCommerce version and run the updater is required.
[412] Fix | Delete
*
[413] Fix | Delete
* This check is done on all requests and runs if the versions do not match.
[414] Fix | Delete
*
[415] Fix | Delete
* @return void
[416] Fix | Delete
*/
[417] Fix | Delete
public static function check_version() {
[418] Fix | Delete
$wc_version = get_option( 'woocommerce_version' );
[419] Fix | Delete
$wc_code_version = WC()->version;
[420] Fix | Delete
$requires_update = version_compare( $wc_version, $wc_code_version, '<' );
[421] Fix | Delete
if ( ! Constants::is_defined( 'IFRAME_REQUEST' ) && $requires_update ) {
[422] Fix | Delete
self::install();
[423] Fix | Delete
/**
[424] Fix | Delete
* Run after WooCommerce has been updated.
[425] Fix | Delete
*
[426] Fix | Delete
* @since 2.2.0
[427] Fix | Delete
*/
[428] Fix | Delete
do_action( 'woocommerce_updated' );
[429] Fix | Delete
do_action_deprecated( 'woocommerce_admin_updated', array(), $wc_code_version, 'woocommerce_updated' );
[430] Fix | Delete
}
[431] Fix | Delete
}
[432] Fix | Delete
[433] Fix | Delete
/**
[434] Fix | Delete
* Performan manual database update when triggered by WooCommerce System Tools.
[435] Fix | Delete
*
[436] Fix | Delete
* @since 3.6.5
[437] Fix | Delete
*
[438] Fix | Delete
* @return void
[439] Fix | Delete
*/
[440] Fix | Delete
public static function manual_database_update() {
[441] Fix | Delete
$blog_id = get_current_blog_id();
[442] Fix | Delete
[443] Fix | Delete
add_action( 'wp_' . $blog_id . '_wc_updater_cron', array( __CLASS__, 'run_manual_database_update' ) );
[444] Fix | Delete
}
[445] Fix | Delete
[446] Fix | Delete
/**
[447] Fix | Delete
* Add WC Admin based db update notice.
[448] Fix | Delete
*
[449] Fix | Delete
* @since 4.0.0
[450] Fix | Delete
* @deprecated 10.3.0
[451] Fix | Delete
*
[452] Fix | Delete
* @return void
[453] Fix | Delete
*/
[454] Fix | Delete
public static function wc_admin_db_update_notice() {
[455] Fix | Delete
if (
[456] Fix | Delete
WC()->is_wc_admin_active()
[457] Fix | Delete
&& false !== get_option( 'woocommerce_admin_install_timestamp' )
[458] Fix | Delete
) {
[459] Fix | Delete
new WC_Notes_Run_Db_Update();
[460] Fix | Delete
}
[461] Fix | Delete
}
[462] Fix | Delete
[463] Fix | Delete
/**
[464] Fix | Delete
* Adds the db update notice.
[465] Fix | Delete
*
[466] Fix | Delete
* @since 10.3.0
[467] Fix | Delete
*
[468] Fix | Delete
* @return void
[469] Fix | Delete
*/
[470] Fix | Delete
private static function add_update_db_notice() {
[471] Fix | Delete
if ( ! \WC_Admin_Notices::has_notice( 'update' ) ) {
[472] Fix | Delete
\WC_Admin_Notices::add_notice( 'update', true );
[473] Fix | Delete
}
[474] Fix | Delete
[475] Fix | Delete
try {
[476] Fix | Delete
if ( WC()->is_wc_admin_active() && false !== get_option( 'woocommerce_admin_install_timestamp' ) ) {
[477] Fix | Delete
\WC_Notes_Run_Db_Update::add_notice();
[478] Fix | Delete
}
[479] Fix | Delete
} catch ( Exception $e ) {
[480] Fix | Delete
wc_get_logger()->error( 'Error adding db update note: ' . $e->getMessage(), array( 'source' => 'wc-updater' ) );
[481] Fix | Delete
}
[482] Fix | Delete
}
[483] Fix | Delete
[484] Fix | Delete
/**
[485] Fix | Delete
* Removes the db update notice.
[486] Fix | Delete
*
[487] Fix | Delete
* @since 10.3.0
[488] Fix | Delete
*
[489] Fix | Delete
* @return void
[490] Fix | Delete
*/
[491] Fix | Delete
public static function remove_update_db_notice() {
[492] Fix | Delete
if ( \WC_Admin_Notices::has_notice( 'update' ) ) {
[493] Fix | Delete
\WC_Admin_Notices::remove_notice( 'update', true );
[494] Fix | Delete
}
[495] Fix | Delete
[496] Fix | Delete
try {
[497] Fix | Delete
if ( WC()->is_wc_admin_active() && false !== get_option( 'woocommerce_admin_install_timestamp' ) ) {
[498] Fix | Delete
\WC_Notes_Run_Db_Update::set_notice_actioned();
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function