Created
September 30, 2009 22:48
-
-
Save hunk/198537 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
## script migration flutter a Magic fields | |
## version: 0.1 | |
## author: Edgar g (hunk) ing.edgar@gmail.com | |
include('wp-config.php'); | |
include('wp-load.php'); | |
global $wpdb; | |
// first change all references of the write panel (flutter) for reference of the write panel (magic fields) | |
$one = $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_mf_write_panel_id' WHERE meta_key = '_rc_cwp_write_panel_id' "); | |
echo "changes reference of the write panels in postmeta <br />"; | |
echo "number of changes: ".$one."<br />"; | |
// array with names of tables flutter and Magic Fields | |
$tables = array(); | |
$tables[$wpdb->prefix."rc_cwp_custom_field_options"] = $wpdb->prefix."mf_custom_field_options"; | |
$tables[$wpdb->prefix."rc_cwp_custom_field_properties"] = $wpdb->prefix."mf_custom_field_properties"; | |
$tables[$wpdb->prefix."rc_cwp_custom_field_types"] = $wpdb->prefix."mf_custom_field_types"; | |
$tables[$wpdb->prefix."rc_cwp_module_groups"] = $wpdb->prefix."mf_module_groups"; | |
$tables[$wpdb->prefix."rc_cwp_panel_category"] = $wpdb->prefix."mf_panel_category"; | |
$tables[$wpdb->prefix."rc_cwp_panel_custom_field"] = $wpdb->prefix."mf_panel_custom_field"; | |
$tables[$wpdb->prefix."rc_cwp_panel_standard_field"] = $wpdb->prefix."mf_panel_standard_field"; | |
$tables[$wpdb->prefix."rc_cwp_post_meta"] = $wpdb->prefix."mf_post_meta"; | |
$tables[$wpdb->prefix."rc_cwp_write_panels"] = $wpdb->prefix."mf_write_panels"; | |
// changes names of table | |
foreach($tables as $k => $v){ | |
$sql = "RENAME TABLE $k TO $v"; | |
$table = $wpdb->query($sql); | |
if($table == 0){ | |
echo "table migrate: ".$k." to ".$v." .............<b>correct</b><br />"; | |
}else{ | |
echo "table migrate: ".$k." to ".$v." .............error<br />"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment