Skip to:
Content

BuddyPress.org

Changeset 864


Ignore:
Timestamp:
01/18/2009 01:48:57 AM (16 years ago)
Author:
apeatling
Message:

Fixes #295

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity.php

    r849 r864  
    33
    44define ( 'BP_ACTIVITY_IS_INSTALLED', 1 );
    5 define ( 'BP_ACTIVITY_VERSION', '1.0b1' );
     5define ( 'BP_ACTIVITY_VERSION', '1.0b1.1' );
    66
    77/* How long before activity items in streams are re-cached? */
     
    3838                component_action varchar(75) NOT NULL,
    3939                date_recorded datetime NOT NULL,
    40                 is_private tinyint(1) NOT NULL,
     40                is_private tinyint(1) NOT NULL DEFAULT 0,
     41                no_sitewide_cache tinyint(1) NOT NULL DEFAULT 0,
    4142                KEY item_id (item_id),
    4243                KEY user_id (user_id),
     
    5556                date_cached datetime NOT NULL,
    5657                date_recorded datetime NOT NULL,
    57                 is_private tinyint(1) NOT NULL,
     58                is_private tinyint(1) NOT NULL DEFAULT 0,
    5859                KEY date_cached (date_cached),
    5960                KEY date_recorded (date_recorded),
     
    240241        $activity->date_recorded = $recorded_time;
    241242        $activity->is_private = $is_private;
    242        
     243
    243244        // We don't want to record this on the sitewide stream, otherwise we will get duplicates.
    244         $activity->no_sitewide_recording = true;
     245        $activity->no_sitewide_cache = true;
    245246
    246247        $secondary_user_save = $activity->save();
  • trunk/bp-activity/bp-activity-classes.php

    r849 r864  
    1010    var $component_action;
    1111    var $date_recorded;
    12     var $is_private;
    13    
    14     var $no_sitewide_recording = false;
     12    var $is_private = false;
     13    var $no_sitewide_cache = false;
    1514   
    1615    var $table_name;
     
    4140        $this->date_recorded = $activity->date_recorded;
    4241        $this->is_private = $activity->is_private;
     42        $this->no_sitewide_cache = $activity->no_sitewide_cache;
    4343    }
    4444   
     
    5555        if ( !$this->exists() ) {
    5656            // Insert the new activity into the activity table.
    57             $activity = $wpdb->query( $wpdb->prepare( "INSERT INTO " . $this->table_name . " ( item_id, secondary_item_id, user_id, component_name, component_action, date_recorded, is_private ) VALUES ( %d, %d, %d, %s, %s, FROM_UNIXTIME(%d), %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_recorded, $this->is_private ) );
     57            $activity = $wpdb->query( $wpdb->prepare( "INSERT INTO " . $this->table_name . " ( item_id, secondary_item_id, user_id, component_name, component_action, date_recorded, is_private, no_sitewide_cache ) VALUES ( %d, %d, %d, %s, %s, FROM_UNIXTIME(%d), %d, %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_recorded, $this->is_private, $this->no_sitewide_cache ) );
    5858
    5959            // Fetch the formatted activity content so we can add it to the cache.
     
    6767       
    6868            // Add the cached version of the activity to the sitewide activity table.
    69             if ( !$this->no_sitewide_recording )
     69            if ( !$this->no_sitewide_cache )
    7070                $sitewide_cached = $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['activity']['table_name_sitewide'] . " ( user_id, item_id, secondary_item_id, content, primary_link, component_name, component_action, date_cached, date_recorded ) VALUES ( %d, %d, %d, %s, %s, %s, %s, FROM_UNIXTIME(%d), FROM_UNIXTIME(%d) )", $this->user_id, $this->item_id, $this->secondary_item_id, $activity_content['content'], $activity_content['primary_link'], $this->component_name, $this->component_action, time(), $this->date_recorded ) );
    7171           
     
    168168                        $activities_formatted[$i]['component_action'] = $activities[$i]->component_action;
    169169                        $activities_formatted[$i]['is_private'] = $activities[$i]->is_private;
     170                        $activities_formatted[$i]['no_sitewide_cache'] = $activities[$i]->no_sitewide_cache;
    170171                    }
    171172                }
     
    320321           
    321322            // Add to the sitewide activity stream
    322             if ( !$activity_array[$i]['is_private'] )
     323            if ( !$activity_array[$i]['is_private'] && !$activity_array[$i]['no_sitewide_cache'] )
    323324                $wpdb->query( $wpdb->prepare( "INSERT INTO " . $bp['activity']['table_name_sitewide'] . " ( user_id, content, item_id, secondary_item_id, primary_link, component_name, component_action, date_cached, date_recorded ) VALUES ( %d, %s, %d, %d, %s, %s, %s, FROM_UNIXTIME(%d), %s )", $user_id, $activity_array[$i]['content'], $activity_array[$i]['item_id'], $activity_array[$i]['secondary_item_id'], $activity_array[$i]['primary_link'], $activity_array[$i]['component_name'], $activity_array[$i]['component_action'], time(), $activity_array[$i]['date_recorded'] ) );
    324325        }
Note: See TracChangeset for help on using the changeset viewer.