Make WordPress Core

Changeset 3463


Ignore:
Timestamp:
01/19/2006 12:03:28 AM (19 years ago)
Author:
ryan
Message:

Execute pings rework from skeltoac. #2197

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/execute-pings.php

    r3384 r3463  
    11<?php
     2
    23require_once('../wp-config.php');
    34
    4 register_shutdown_function('execute_all_pings');
    5 //execute_all_pings();
     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}
    610
    7 function execute_all_pings() {
    8     global $wpdb;
    9     // Do pingbacks
    10     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")) {
    11         $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';");
    12         pingback($ping->post_content, $ping->ID);
    13         echo "Pingback: $ping->post_title : $ping->ID<br/>";
    14     }
    15     // Do Enclosures
    16     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")) {
    17         $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$enclosure->ID} AND meta_key = '_encloseme';");
    18         do_enclose($enclosure->post_content, $enclosure->ID);
    19         echo "Enclosure: $enclosure->post_title : $enclosure->ID<br/>";
    20     }
    21     // Do Trackbacks
    22     $trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE TRIM(to_ping) != '' AND post_status != 'draft'");
     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}
    2316
    24     if (is_array($trackbacks) && count($trackbacks)) {
    25         foreach ($trackbacks as $trackback  ) {
    26             echo "Trackback : $trackback->ID<br/>";
    27             do_trackbacks($trackback->ID);
    28         }
     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);
    2922    }
    3023}
    3124
    32 _e('Done.');
    33 
    3425?>
Note: See TracChangeset for help on using the changeset viewer.