header(); switch ($step) { case 0 : $this->greet(); break; case 1 : $this->get_targets(); break; case 2 : $this->get_terms(); break; case 3 : $this->get_searchwords(); break; case 4 : $this->delete_taxonomies(); break; case 5 : $this->delete_terms(); break; case 6 : $this->optimize_wptables(); break; case 7 : $this->delete_oldtables(); break; case 8 : $this->show_queries(); break; } // load the footer $this->footer(); } function header() { echo '
'.__('If you used bSuite3 for stats collection, you’ll need this (or some manual MySQL queries) to move the data into the new bSuite4 tables.').'
'; if( !count( $wpdb->get_col( $this->query_checktables ))){ echo ''. __('Your server’s default time of ') . ini_get( 'max_execution_time' ) . __(' seconds may be too low to complete this upgrade. Some queries can take as long as 30 minutes to complete on a large data set.') .'
'; echo ''. __('You can try executing the MySQL commands manually if you’d like.') .'
'; }else if( !$bsuite ){ echo ''.__('You must activate bSuite 4 before proceeding.').'
'; }else{ $bsuite->createtables(); // just to make sure echo ''.__('It’s worth mentioning that most people recommend backing up your database before doing things like this.').'
'; echo ''; } echo 'Importing post hits stats.
'; echo 'Please be patient, this could take a long time.
'; flush(); foreach( explode( ';', $this->query_delete_oldtables ) as $query ) $wpdb->get_results( $query ); echo 'Done!
'; echo ''; } function get_terms() { set_time_limit( 0 ); global $wpdb, $bsuite; update_option('bsuite_doing_migration', time() + 3000 ); echo 'Importing old search terms.
'; echo 'Please be patient, this could take a long time.
'; flush(); $wpdb->get_results( $this->query_get_terms ); echo 'Done!
'; echo ''; } function get_searchwords() { set_time_limit( 0 ); global $wpdb, $bsuite; update_option('bsuite_doing_migration', time() + 6000 ); echo 'Importing old search targets.
'; echo 'Please be patient, this could take a long time.
'; flush(); $wpdb->get_results( $this->query_get_searchwords ); echo 'Done!
'; echo ''; } function delete_taxonomies() { set_time_limit( 0 ); global $wpdb, $bsuite; update_option('bsuite_doing_migration', time() + 3000 ); echo 'Cleaning up WordPress’ term_taxonomy table.
'; echo 'Please be patient, this could take a long time.
'; $wpdb->get_results( $this->query_delete_taxonomies ); echo 'Done!
'; echo ''; } function delete_terms() { set_time_limit( 0 ); global $wpdb, $bsuite; update_option('bsuite_doing_migration', time() + 3000 ); echo 'Cleaning up WordPress’ terms table.
'; echo 'Please be patient, this could take a long time.
'; flush(); $wpdb->get_results( $this->query_delete_terms ); echo 'Done!
'; echo ''; } function optimize_wptables() { set_time_limit( 0 ); global $wpdb, $bsuite; update_option('bsuite_doing_migration', time() + 3000 ); echo 'Optimizing WordPress’ terms and term_taxonomies tables.
'; flush(); foreach( explode( ';', $this->query_optimize_wptables ) as $query ) $wpdb->get_results( $query ); echo 'Done!
'; echo ''; } function delete_oldtables() { set_time_limit( 0 ); global $wpdb, $bsuite; update_option('bsuite_doing_migration', time() + 3000 ); echo 'Deleting old bSuite3 tables.
'; flush(); foreach( explode( ';', $this->query_delete_oldtables ) as $query ) $wpdb->get_results( $query ); echo 'Done!
'; echo 'Fini!
'; echo 'All set!
'; echo ''. $this->query_get_targets .''; echo '
'. $this->query_get_terms .''; echo '
'. $this->query_get_searchwords .''; echo '
'. $this->query_delete_taxonomies .''; echo '
'. $this->query_delete_terms .''; echo '
'. $this->query_optimize_wptables .''; echo '
'. $this->query_delete_oldtables .''; echo '