if (in_array(get_option('woocommerce_default_customer_address'), array('geolocation_ajax', 'geolocation'))) { ?> <tr> <td data-export-label="MaxMind GeoIP Database"><?php _e('MaxMind GeoIP Database', 'woocommerce'); ?> :</td> <td class="help"><?php echo wc_help_tip(__('The GeoIP database from MaxMind is used to geolocate customers.', 'woocommerce')); ?> </td> <td><?php if (file_exists(WC_Geolocation::get_local_database_path())) { echo '<mark class="yes"><span class="dashicons dashicons-yes"></span> <code class="private">' . esc_html(WC_Geolocation::get_local_database_path()) . '</code></mark> '; } else { printf('<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf(__('The MaxMind GeoIP Database does not exist - Geolocation will not function. You can download and install it manually from %1$s to the path: %2$s. Scroll down to \\"Downloads\\" and download the \\"Binary / gzip\\" file next to \\"GeoLite Country\\"', 'woocommerce'), make_clickable('http://dev.maxmind.com/geoip/legacy/geolite/'), '<code class="private">' . WC_Geolocation::get_local_database_path() . '</code>') . '</mark>', WC_LOG_DIR); } ?> </td> </tr> <?php } ?> </tr> </tbody> </table> <table class="wc_status_table widefat" cellspacing="0"> <thead> <tr> <th colspan="3" data-export-label="Active Plugins (<?php echo count((array) get_option('active_plugins'));
/** * Get array of database information. Version, prefix, and table existence. * * @return array */ public function get_database_info() { global $wpdb; // WC Core tables to check existence of $tables = apply_filters('woocommerce_database_tables', array('woocommerce_sessions', 'woocommerce_api_keys', 'woocommerce_attribute_taxonomies', 'woocommerce_downloadable_product_permissions', 'woocommerce_order_items', 'woocommerce_order_itemmeta', 'woocommerce_tax_rates', 'woocommerce_tax_rate_locations', 'woocommerce_shipping_zones', 'woocommerce_shipping_zone_locations', 'woocommerce_shipping_zone_methods', 'woocommerce_payment_tokens', 'woocommerce_payment_tokenmeta')); if (get_option('db_version') < 34370) { $tables[] = 'woocommerce_termmeta'; } $table_exists = array(); foreach ($tables as $table) { $table_exists[$table] = $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s;", $wpdb->prefix . $table)) === $wpdb->prefix . $table; } // Return all database info. Described by JSON Schema. return array('wc_database_version' => get_option('woocommerce_db_version'), 'database_prefix' => $wpdb->prefix, 'maxmind_geoip_database' => WC_Geolocation::get_local_database_path(), 'database_tables' => $table_exists); }
/** * Test to make sure database response is correct. * * @since 2.7.0 */ public function test_get_system_status_info_database() { global $wpdb; wp_set_current_user($this->user); $response = $this->server->dispatch(new WP_REST_Request('GET', '/wc/v1/system_status')); $data = $response->get_data(); $database = $data['database']; $this->assertEquals(get_option('woocommerce_db_version'), $database['wc_database_version']); $this->assertEquals($wpdb->prefix, $database['database_prefix']); $this->assertEquals(WC_Geolocation::get_local_database_path(), $database['maxmind_geoip_database']); $this->assertArrayHasKey('woocommerce_payment_tokens', $database['database_tables']); }
if (in_array(get_option('woocommerce_default_customer_address'), array('geolocation_ajax', 'geolocation'))) { ?> <tr> <td data-export-label="PHP Post Max Size"><?php _e('MaxMind GeoIP Database', 'woocommerce'); ?> :</td> <td class="help"><?php echo wc_help_tip(__('The GeoIP database from MaxMind is used to geolocate customers.', 'woocommerce')); ?> </td> <td><?php if (file_exists(WC_Geolocation::get_local_database_path())) { echo '<mark class="yes"><span class="dashicons dashicons-yes"></span> <code class="private">' . esc_html(WC_Geolocation::get_local_database_path()) . '</code></mark> '; } else { printf('<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf(__('The MaxMind GeoIP Database does not exist - Geolocation will not function. You can download and install it manually from %s to the path: %s', 'woocommerce'), make_clickable('http://dev.maxmind.com/geoip/legacy/geolite/'), '<code class="private">' . WC_Geolocation::get_local_database_path() . '</code>') . '</mark>', WC_LOG_DIR); } ?> </td> </tr> <?php } ?> </tr> </tbody> </table> <table class="wc_status_table widefat" cellspacing="0"> <thead> <tr> <th colspan="3" data-export-label="Active Plugins (<?php echo count((array) get_option('active_plugins'));