Force destruction of SimplePie objects for versions of PHP that don't release memory properly. Props arena, scribu. fixes #11074

git-svn-id: https://develop.svn.wordpress.org/trunk@12193 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-11-16 22:42:58 +00:00
parent 9e1e57f5a8
commit cac2e59fda
2 changed files with 27 additions and 2 deletions

View File

@ -624,11 +624,15 @@ function wp_dashboard_incoming_links_output() {
printf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message());
echo '</p>';
}
$rss->__destruct();
unset($rss);
return;
}
if ( !$rss->get_item_quantity() ) {
echo '<p>' . __('This dashboard widget queries <a href="http://blogsearch.google.com/">Google Blog Search</a> so that when another blog links to your site it will show up here. It has found no incoming links&hellip; yet. It&#8217;s okay &#8212; there is no rush.') . "</p>\n";
$rss->__destruct();
unset($rss);
return;
}
@ -682,7 +686,8 @@ function wp_dashboard_incoming_links_output() {
}
echo "</ul>\n";
$rss->__destruct();
unset($rss);
}
function wp_dashboard_incoming_links_control() {
@ -737,12 +742,18 @@ function wp_dashboard_secondary_output() {
printf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message());
echo '</p></div>';
}
$rss->__destruct();
unset($rss);
} elseif ( !$rss->get_item_quantity() ) {
$rss->__destruct();
unset($rss);
return false;
} else {
echo '<div class="rss-widget">';
wp_widget_rss_output( $rss, $widgets['dashboard_secondary'] );
echo '</div>';
$rss->__destruct();
unset($rss);
}
}
@ -825,6 +836,9 @@ function wp_dashboard_plugins_output() {
echo "<h4>$label</h4>\n";
echo "<h5><a href='$link'>$title</a></h5>&nbsp;<span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span>\n";
echo "<p>$description</p>\n";
$$feed->__destruct();
unset($$feed);
}
}
@ -922,6 +936,8 @@ function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
$widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title()));
else
$widget_options[$widget_id]['title'] = htmlentities(__('Unknown Feed'));
$rss->__destruct();
unset($rss);
}
update_option( 'dashboard_widget_options', $widget_options );
}

View File

@ -732,6 +732,8 @@ class WP_Widget_RSS extends WP_Widget {
echo $before_title . $title . $after_title;
wp_widget_rss_output( $rss, $instance );
echo $after_widget;
$rss->__destruct();
unset($rss);
}
function update($new_instance, $old_instance) {
@ -770,7 +772,8 @@ function wp_widget_rss_output( $rss, $args = array() ) {
if ( is_wp_error($rss) ) {
if ( is_admin() || current_user_can('manage_options') )
echo '<p>' . sprintf( __('<strong>RSS Error</strong>: %s'), $rss->get_error_message() ) . '</p>';
$rss->__destruct();
unset($rss);
return;
}
@ -787,6 +790,8 @@ function wp_widget_rss_output( $rss, $args = array() ) {
if ( !$rss->get_item_quantity() ) {
echo '<ul><li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li></ul>';
$rss->__destruct();
unset($rss);
return;
}
@ -838,6 +843,8 @@ function wp_widget_rss_output( $rss, $args = array() ) {
}
}
echo '</ul>';
$rss->__destruct();
unset($rss);
}
@ -947,6 +954,8 @@ function wp_widget_rss_process( $widget_rss, $check_feed = true ) {
while ( stristr($link, 'http') != $link )
$link = substr($link, 1);
}
$rss->__destruct();
unset($rss);
}
return compact( 'title', 'url', 'link', 'items', 'error', 'show_summary', 'show_author', 'show_date' );