Make WordPress Core

Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#20417 closed defect (bug) (fixed)

do_enclose() and other functions should use the WP API when dealing with metadata

Reported by: nacin's profile nacin Owned by:
Milestone: 3.5 Priority: normal
Severity: normal Version: 1.5
Component: Pings/Trackbacks Keywords: has-patch
Focuses: Cc:

Description

do_enclose() does this:

$wpdb->insert($wpdb->postmeta, array('post_id' => $post_ID, 'meta_key' => 'enclosure', 'meta_value' => $meta_value) );

And I am not sure why. Some other functions also use $wpdb to interact with postmeta when not necessary.

Attachments (4)

20417.diff (5.7 KB) - added by nacin 13 years ago.
20417.2.diff (11.2 KB) - added by nacin 13 years ago.
20417.3.diff (11.4 KB) - added by nacin 13 years ago.
Avoids that LIKE query.
20417-meta-api.diff (7.2 KB) - added by nacin 13 years ago.

Download all attachments as: .zip

Change History (13)

@nacin
13 years ago

#1 @nacin
13 years ago

  • Component changed from General to Pings/Trackbacks
  • Keywords has-patch added
  • Version set to 1.5

//TODO: Tidy this ghetto code up

Done. :-)

@nacin
13 years ago

#2 @nacin
13 years ago

[11968] caused some actions to be duplicated; more recent changesets cause more duplication.

20417.2.diff results in no more (add|added|delete|deleted)_(commentmeta|postmeta) actions called outside of meta.php. It results in the proper functions being used more often. It includes the work in 20417.diff to clean up do_enclose() as well.

#3 @designsimply
13 years ago

Tested 20417.2.diff with these steps:

  1. Applied 20417.2.diff to WordPress trunk r20434
  2. Created a new post with audio and video links in it, see example code below
  3. Checked the feed page source to see if the proper <enclosure> tags were added
  • Results: One enclosure tag was created for each unique audio or video link in the post.

Example post content with audio/video links for testing:

This post has a duplicate video link in it. Check to make sure only one enclosure tag is added for this post in the blog's feed.

<a href="http://videos.videopress.com/w0MiG12E/snow2-its-back-h2642_dvd.mp4">Let It Snow</a>

<a href="http://wpcom.files.wordpress.com/2007/01/mattmullenweg-interview.mp3">Matt Mullenweg Interview</a>

<a href="http://videos.videopress.com/w0MiG12E/snow2-its-back-h2642_dvd.mp4">Let It Snow</a>

#4 @nacin
13 years ago

Similar cleanups from mdawaffe in #14493.

@nacin
13 years ago

Avoids that LIKE query.

#5 @nacin
13 years ago

In [20435]:

Use the metadata API rather than raw queries and direct do_action calls. see #20417.

#6 @nacin
12 years ago

  • Milestone changed from 3.4 to Future Release

#7 @nacin
12 years ago

  • Milestone changed from Future Release to 3.5

#8 @ryan
12 years ago

Anything else to do here? Seems new tickets can be opened for whatever "other functions" need attention.

#9 @nacin
12 years ago

  • Resolution set to fixed
  • Status changed from new to closed

The rest of 3.diff can occur in #14493.

Last edited 12 years ago by nacin (previous) (diff)
Note: See TracTickets for help on using tickets.