Ticket #2933: ping.patch
| File ping.patch, 2.9 KB (added by c960657, 6 years ago) |
|---|
-
wp-includes/comment.php
635 635 } 636 636 637 637 function generic_ping($post_id = 0) { 638 $errors = get_option('ping_errors'); 639 if ( !is_array($errors) ) 640 $errors = array(); 638 641 $services = get_settings('ping_sites'); 639 642 $services = preg_replace("|(\s)+|", '$1', $services); // Kill dupe lines 640 643 $services = trim($services); 641 644 if ( '' != $services ) { 642 645 $services = explode("\n", $services); 643 646 foreach ($services as $service) { 644 weblog_ping($service); 647 $error = weblog_ping($service); 648 if ( $error ) { 649 if ( !isset($errors[$service]) ) 650 $errors[$service] = array('count' => 0); 651 $errors[$service]['count']++; 652 $errors[$service]['last_message'] = $error; 653 } else { 654 unset($errors[$service]); 655 } 645 656 } 646 657 } 658 update_option('ping_errors', $errors); 647 659 648 660 return $post_id; 649 661 } … … 791 803 $home = trailingslashit( get_option('home') ); 792 804 if ( !$client->query('weblogUpdates.extendedPing', get_settings('blogname'), $home, get_bloginfo('rss2_url') ) ) // then try a normal ping 793 805 $client->query('weblogUpdates.ping', get_settings('blogname'), $home); 806 807 $error = false; 808 if ( $client->isError() ) { 809 $error = $client->getErrorMessage(); 810 } else { 811 $response = $client->getResponse(); 812 if ( !isset($response['flerror']) || $response['flerror'] ) { 813 $error = isset($response['message']) && $response['message'] 814 ? $response['message'] : 'Invalid response'; 815 } 816 } 817 return $error; 794 818 } 795 819 796 820 ?> -
wp-admin/options-writing.php
99 99 <p><?php _e('When you publish a new post, WordPress automatically notifies the following site update services. For more about this, see <a href="http://codex.wordpress.org/Update_Services">Update Services</a> on the Codex. Separate multiple service URIs with line breaks.') ?></p> 100 100 101 101 <textarea name="ping_sites" id="ping_sites" style="width: 98%;" rows="3" cols="50"><?php form_option('ping_sites'); ?></textarea> 102 103 <?php 104 $min_ping_error_count = 3; 105 ?> 106 <p><?php _e('These update services has failed the last ' . $min_ping_error_count . ' times or more. You should consider removing these services from the list above.') ?></p> 107 <dl> 108 <?php 109 $has_errors = false; 110 $services = get_option('ping_sites'); 111 foreach (get_option('ping_errors') as $service => $error) : 112 if ($error['count'] >= $min_ping_error_count && strpos($services, $service) !== false) : 113 echo "<dt>" . htmlspecialchars($service) . "<dt>"; 114 echo "<dd>" . htmlspecialchars($error['last_message']) . "<dd>"; 115 $has_errors = true; 116 endif; 117 endforeach; 118 119 if (!$has_errors) : 120 echo "<dd><em>" . __('No errors') . "</em></dd>"; 121 endif; 122 ?> 123 </dl> 102 124 </fieldset> 103 125 104 126 <p class="submit">
