function fwp_flush_affected_post_ids($link_id) { global $fwp_affected_posts; if (!isset($fwp_affected_posts)) { return; } $fwp_affected_posts = array_unique($fwp_affected_posts); $data = new stdClass(); $data->posts = $fwp_affected_posts; queue_async_job($data, 'async_clean_post_cache'); // Reset for the next feed unset($fwp_affected_posts); }
<?php add_action('syn_after_init_server', function () { if (true !== WPCOM_IS_VIP_ENV) { return; } global $push_syndication_server; // Override the plugin's default wp-cron based push handling and use the WP.com jobs system instead remove_action('syn_schedule_push_content', array($push_syndication_server, 'schedule_push_content'), 10); add_action('syn_schedule_push_content', function ($post_id, $sites) { $data = new stdClass(); $data->post_id = $post_id; $job_id = queue_async_job($data, 'vip_async_syndication_push_post'); xmpp_message('*****@*****.**', '[syn_schedule_push_content] job id for pushing post #' . $post_id . ' (' . home_url() . '): ' . $job_id); }, 10, 2); // TODO: override schedule_delete_content and schedule_pull_content }); // Failure notifications add_action('syn_post_push_new_post', 'wpcom_vip_push_syndication_debug', 10, 6); add_action('syn_post_push_edit_post', 'wpcom_vip_push_syndication_debug', 10, 6); function wpcom_vip_push_syndication_debug($result, $post_id, $site, $transport_type, $client, $info) { if (!is_wp_error($result)) { return; } // Temp disable return; $debug_output = ''; $debug_output .= 'Result: ' . var_export($result, true) . PHP_EOL . PHP_EOL; $debug_output .= 'Post Id: ' . var_export($post_id, true) . PHP_EOL . PHP_EOL; $debug_output .= 'Blog Id: ' . var_export(get_current_blog_id(), true) . PHP_EOL . PHP_EOL;
/** * Queue action to invalidate nginx cache if on WPCOM * @param int $sitemap_id * @param string $year * @param string $month * @param string $day */ function msm_sitemap_wpcom_queue_cache_invalidation($sitemap_id, $year, $month, $day) { $sitemap_url = home_url('/sitemap.xml'); $sitemap_urls = array($sitemap_url, add_query_arg(array('yyyy' => $year, 'mm' => $month, 'dd' => $day), $sitemap_url)); queue_async_job(array('output_cache' => array('url' => $sitemap_urls)), 'wpcom_invalidate_output_cache_job', -16); }