Changeset 2388816
- Timestamp:
- 09/26/2020 11:20:41 AM (6 years ago)
- Location:
- lifeline-donation/trunk
- Files:
-
- 2 edited
-
lifeline-donation.php (modified) (1 diff)
-
webinane-commerce/includes/Classes/Webinane.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lifeline-donation/trunk/lifeline-donation.php
r2388812 r2388816 49 49 require_once LIFELINE_DONATION_PATH . 'webinane-commerce/webinane-commerce.php'; 50 50 } 51 WebinaneCommerce\Admin\Install::init();51 \WebinaneCommerce\Admin\Install::init(); 52 52 } 53 53 ); 54 55 add_action( 'upgrader_process_complete', function( $upgrader_object, $options ) { 56 $current_plugin_path_name = plugin_basename( __FILE__ ); 57 58 if ($options['action'] == 'update' && $options['type'] == 'plugin' ){ 59 if( isset($options['plugins'])) { 60 foreach($options['plugins'] as $each_plugin){ 61 if ( $each_plugin == $current_plugin_path_name){ 62 \WebinaneCommerce\Classes\Webinane::update_database(); 63 } 64 } 65 } elseif( isset($options['plugin']) ) { 66 if ( $options['plugin'] == $current_plugin_path_name ) { 67 \WebinaneCommerce\Classes\Webinane::update_database(); 68 } 69 } 70 } 71 },10, 2); -
lifeline-donation/trunk/webinane-commerce/includes/Classes/Webinane.php
r2388812 r2388816 243 243 } 244 244 } 245 $settings = get_option('_wpcommerce_settings'); 245 246 } 247 248 /** 249 * Update database. 250 * @return [type] [description] 251 */ 252 static function update_database() { 253 global $wpdb; 254 255 $result = $wpdb->get_results("SHOW COLUMNS FROM `{$wpdb->prefix}wpcommerce_order_items` LIKE 'base_price'"); 256 257 if( ! $result ) { 258 $wpdb->query("ALTER TABLE {$wpdb->prefix}wpcommerce_order_items ADD base_price float DEFAULT '0'"); 259 $wpdb->query("ALTER TABLE {$wpdb->prefix}wpcommerce_order_items ADD currency varchar(3) DEFAULT 'USD'"); 260 } 261 262 $settings = get_option('_wpcommerce_settings'); 246 263 if(! isset($settings['gateways'])) { 247 264 $settings['base_country'] = ['country' => $settings['base_country'], 'state' => $settings['base_state']]; … … 271 288 } 272 289 273 /**274 * Update database.275 * @return [type] [description]276 */277 static function update_database() {278 global $wpdb;279 280 $result = $wpdb->get_results("SHOW COLUMNS FROM `{$wpdb->prefix}wpcommerce_order_items` LIKE 'base_price'");281 282 if( ! $result ) {283 $wpdb->query("ALTER TABLE {$wpdb->prefix}wpcommerce_order_items ADD base_price float DEFAULT '0'");284 $wpdb->query("ALTER TABLE {$wpdb->prefix}wpcommerce_order_items ADD currency varchar(3) DEFAULT 'USD'");285 }286 }287 288 290 289 291 }
Note: See TracChangeset
for help on using the changeset viewer.