WordPress.org

Make WordPress Core

Ticket #2197: execute-pings.php

File execute-pings.php, 1.0 KB (added by skeltoac, 14 years ago)

Removes all output from script, simplifies procedure, refines tb query

Line 
1<?php
2
3require_once('../wp-config.php');
4
5// Do pingbacks
6while ($ping = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme' LIMIT 1")) {
7        $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';");
8        pingback($ping->post_content, $ping->ID);
9}
10
11// Do Enclosures
12while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
13        $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$enclosure->ID} AND meta_key = '_encloseme';");
14        do_enclose($enclosure->post_content, $enclosure->ID);
15}
16
17// Do Trackbacks
18$trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE CHAR_LENGTH(TRIM(to_ping)) > 7 AND post_status != 'draft'");
19if ( is_array($trackbacks) ) {
20        foreach ( $trackbacks as $trackback ) {
21                do_trackbacks($trackback->ID);
22        }
23}
24
25?>