Changeset 45261
- Timestamp:
- 05/11/08 17:25:33 (2 months ago)
- Files:
-
- 1 modified
-
bsuite/trunk/core.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bsuite/trunk/core.php
r44934 r45261 192 192 add_filter('cron_schedules', array(&$this, 'cron_reccurences')); 193 193 if( $this->loadavg < 4 ){ // only do cron if load is low-ish 194 add_filter('bsuite_interval', array(&$this, 'bstat_migrator'));194 // add_filter('bsuite_interval', array(&$this, 'bstat_migrator')); 195 195 // add_filter('bsuite_interval', array(&$this, 'searchsmart_upindex_passive')); 196 196 } … … 616 616 617 617 if ( 618 ( get_option( 'bsuite_doing_migration') > time() ) ||619 ( get_option( 'bsuite_doing_report') > time() )618 ( get_option( 'bsuite_doing_migration') > time() ) || 619 ( get_option( 'bsuite_doing_report') > time() ) 620 620 ) 621 621 return( TRUE ); 622 622 623 update_option('bsuite_doing_migration', time() + 250 ); 623 update_option( 'bsuite_doing_migration', time() + 250 ); 624 $status = get_option ( 'bsuite_doing_migration_status' ); 624 625 625 626 $getcount = 100; … … 633 634 LIMIT $getcount" ); 634 635 636 $status['count_incoming'] = count( $res ); 637 update_option( 'bsuite_doing_migration_status', $status ); 638 635 639 foreach( $res as $hit ){ 636 640 $object_id = $object_type = $session_id = 0; … … 671 675 } 672 676 673 if( count( $targets )){ 677 $status['count_targets'] = count( $targets ); 678 $status['count_searchwords'] = count( $searchwords ); 679 $status['count_shistory'] = count( $shistory ); 680 update_option( 'bsuite_doing_migration_status', $status ); 681 682 if( count( $targets ) && !$status['did_targets'] ){ 674 683 if ( false === $wpdb->query( "INSERT INTO $this->hits_targets (object_id, object_type, hit_count, hit_date) VALUES ". implode( $targets, ',' ) ." ON DUPLICATE KEY UPDATE hit_count = hit_count + 1;" )) 675 684 return new WP_Error('db_insert_error', __('Could not insert bsuite_hits_target into the database'), $wpdb->last_error); 676 } 677 678 if( count( $searchwords )){ 685 686 $status['did_targets'] = 1 ; 687 update_option( 'bsuite_doing_migration_status', $status ); 688 } 689 690 if( count( $searchwords ) && !$status['did_searchwords'] ){ 679 691 if ( false === $wpdb->query( "INSERT INTO $this->hits_searchwords (object_id, object_type, term_id, hit_count, hit_date) VALUES ". implode( $searchwords, ',' ) ." ON DUPLICATE KEY UPDATE hit_count = hit_count + 1;" )) 680 692 return new WP_Error('db_insert_error', __('Could not insert bsuite_hits_searchword into the database'), $wpdb->last_error); 681 } 682 683 if( count( $shistory )){ 693 694 $status['did_searchwords'] = 1; 695 update_option( 'bsuite_doing_migration_status', $status ); 696 } 697 698 if( count( $shistory ) && !$status['did_shistory'] ){ 684 699 if ( false === $wpdb->query( "INSERT INTO $this->hits_shistory (sess_id, object_id, object_type) VALUES ". implode( $shistory, ',' ) .';' )) 685 700 return new WP_Error('db_insert_error', __('Could not insert bsuite_hits_session_history into the database'), $wpdb->last_error); 701 702 $status['did_shistory'] = count( $shistory ); 703 update_option( 'bsuite_doing_migration_status', $status ); 686 704 } 687 705 688 706 if( count( $res )){ 689 707 if ( false === $wpdb->query( "DELETE FROM $this->hits_incoming WHERE in_time < '$since' ORDER BY in_time ASC LIMIT ". count( $res ) .';')) 690 return new WP_Error('db_insert_error', __('Could not clean up the incomin stats table'), $wpdb->last_error);708 return new WP_Error('db_insert_error', __('Could not clean up the incoming stats table'), $wpdb->last_error); 691 709 if( $getcount > count( $res )) 692 710 $wpdb->query( "OPTIMIZE TABLE $this->hits_incoming;"); … … 733 751 734 752 update_option( 'bsuite_doing_migration', 0 ); 753 update_option( 'bsuite_doing_migration_status', array() ); 735 754 return(TRUE); 736 755 }
