[buddypress-trac] [BuddyPress Trac] #3856: Saving activity update action as an array in db

buddypress-trac noreply at wordpress.org
Wed Mar 5 13:57:00 UTC 2014


#3856: Saving activity update action as an array in db
-----------------------------------+------------------
 Reporter:  modemlooper            |       Owner:
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  2.0
Component:  Activity               |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |
-----------------------------------+------------------

Comment (by boonebgorges):

 >  Great work
 > I'm adding a --no-prefix (3856.03--no-prefix.patch) version of the patch
 to ease testing ;)

 Thanks, and thanks :)

 >  i find it "weird" in the activity meta table in case of comments on the
 same blog post to have post_title and post_url repeated at each comment as
 data is the same

 Yeah. The other technique I toyed with was storing it in blogmeta, to
 reduce duplication. There are a couple problems there though. First, we'd
 have to do something kinda funky to key all of this stuff. So, something
 like `bp_blogs_update_blogmeta( $activity->item_id, 'post_url_' .
 $activity->secondary_item_id, $post_url )`. Not a huge deal, but a little
 weird. Second, this technique wouldn't work for comments, because activity
 items don't tell us the post_id - item_id=blog_id and
 secondary_item_id=comment_id. To get the post_id, we have to pull up the
 comment object, which defeats the purpose. That said, we could do
 something like this in the case of comments: `bp_blogs_update_blogmeta(
 $activity->item_id, 'post_id', $post_id )`, and then when building the
 string, we can first pull this blogmeta to get the post ID, then lookup
 the post_url separately using `'post_url_' . $post_id`.

 In short, we save a little bit of room in the database, and reduce
 duplication by a little bit, but we introduce a bit of funny machinery.
 I'm not sure if the tradeoff is worth it. What do you think?

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3856#comment:22>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list