Changeset 1190755
- Timestamp:
- 07/01/2015 12:04:18 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wp-custom-widget-area/trunk/wp-custom-widget-area.php
r1190664 r1190755 42 42 require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-custom-widget-area-deactivator.php'; 43 43 44 45 44 46 /** This action is documented in includes/class-wp-custom-widget-area-activator.php */ 45 47 register_activation_hook( __FILE__, array( 'Custom_Widget_Area_Activator', 'activate' ) ); … … 73 75 echo "welcome to first metabox showcase"; 74 76 } 77 78 79 // db fix for new version 80 function db_update(){ 81 global $wpdb; 82 $table_name = 'wp_cwa'; 83 if(!!! $session_id) 84 session_start(); 85 86 if(!isset($_SESSION['db_update'])){ 87 $row = $wpdb->get_results( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS 88 WHERE table_name = '$table_name' AND column_name = 'cwa_type'" ); 89 90 if(empty($row)){ 91 $wpdb->query("ALTER TABLE $table_name ADD cwa_type varchar (10) "); 92 $updaterow = $wpdb->get_results( "SELECT id FROM $table_name"); 93 foreach ($updaterow as $data) { 94 # code... 95 $up = $wpdb->update($table_name, array('cwa_type'=> 'widget'), array('id'=>$data->id)); 96 } 97 } 98 $_SESSION['db_update'] = true; 99 } 100 101 } 102 103 db_update();
Note: See TracChangeset
for help on using the changeset viewer.