Execute pings rework from skeltoac. #2197

git-svn-id: http://svn.automattic.com/wordpress/trunk@3463 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-01-19 00:03:28 +00:00
parent 4dcbfe9b37
commit fe8cbf801a
1 changed files with 16 additions and 25 deletions

View File

@ -1,34 +1,25 @@
<?php <?php
require_once('../wp-config.php'); require_once('../wp-config.php');
register_shutdown_function('execute_all_pings'); // Do pingbacks
//execute_all_pings(); while ($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")) {
function execute_all_pings() {
global $wpdb;
// Do pingbacks
while ($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")) {
$wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';"); $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';");
pingback($ping->post_content, $ping->ID); pingback($ping->post_content, $ping->ID);
echo "Pingback: $ping->post_title : $ping->ID<br/>"; }
}
// Do Enclosures // Do Enclosures
while ($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")) { while ($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")) {
$wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$enclosure->ID} AND meta_key = '_encloseme';"); $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$enclosure->ID} AND meta_key = '_encloseme';");
do_enclose($enclosure->post_content, $enclosure->ID); do_enclose($enclosure->post_content, $enclosure->ID);
echo "Enclosure: $enclosure->post_title : $enclosure->ID<br/>"; }
}
// Do Trackbacks
$trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE TRIM(to_ping) != '' AND post_status != 'draft'");
if (is_array($trackbacks) && count($trackbacks)) { // Do Trackbacks
foreach ($trackbacks as $trackback ) { $trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE CHAR_LENGTH(TRIM(to_ping)) > 7 AND post_status != 'draft'");
echo "Trackback : $trackback->ID<br/>"; if ( is_array($trackbacks) ) {
foreach ( $trackbacks as $trackback ) {
do_trackbacks($trackback->ID); do_trackbacks($trackback->ID);
} }
}
} }
_e('Done.');
?> ?>