WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 18 months ago

Last modified 18 months ago

#20417 closed defect (bug) (fixed)

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

Reported by: 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 2 years ago.
20417.2.diff (11.2 KB) - added by nacin 2 years ago.
20417.3.diff (11.4 KB) - added by nacin 2 years ago.
Avoids that LIKE query.
20417-meta-api.diff (7.2 KB) - added by nacin 2 years ago.

Download all attachments as: .zip

Change History (13)

nacin2 years ago

comment:1 nacin2 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. :-)

nacin2 years ago

comment:2 nacin2 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.

comment:3 designsimply2 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>

comment:4 nacin2 years ago

Similar cleanups from mdawaffe in #14493.

nacin2 years ago

Avoids that LIKE query.

nacin2 years ago

comment:5 nacin2 years ago

In [20435]:

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

comment:6 nacin2 years ago

  • Milestone changed from 3.4 to Future Release

comment:7 nacin22 months ago

  • Milestone changed from Future Release to 3.5

comment:8 ryan18 months ago

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

comment:9 nacin18 months ago

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

The rest can occur in #20417.

Version 0, edited 18 months ago by nacin (next)
Note: See TracTickets for help on using tickets.