Quantcast
Channel: WordPress.org Forums » [W3 Total Cache] Support
Viewing all articles
Browse latest Browse all 19282

keendev on "[Plugin: W3 Total Cache] Rackspace Cloud Files Delay Upload Command"

$
0
0

Ok so i took a buzz and tried to tackle this myself.

Step 1:

add_filter('w3tc_cdn_update_attachment', 'pending_images_to_queue', 10, 1);
add_filter('w3tc_cdn_update_attachment_metadata', 'pending_images_to_queue', 10, 1);

function pending_images_to_queue($files) {

	$w3plugin_cdnCommon = new W3_Plugin_CdnCommon();

	foreach ($files as $file) {

		$w3plugin_cdnCommon->queue_add($file['local_path'], $file['remote_path'], '1', '');

	}

	return array();

}

Step 2: (Create Cron which will handle the uploading)

<?php
define('WP_USE_THEMES', false);
require('wp-blog-header.php');

set_time_limit(600);

$w3_plugin_cdn_normal = w3_instance('W3_Plugin_Cdn');
$n = $w3_plugin_cdn_normal->cron_queue_process();

echo  sprintf(__('Number of processed queue items: %d', 'w3-total-cache'), $n);

?>

If I could get a developer to let me know what they think that would be appreciated.


Viewing all articles
Browse latest Browse all 19282

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>