[Plugin: W3 Total Cache] Logic tweak handling results of upload, delete and purge
-
\lib\w3\Plugin\Cdn.php
/**
* Uploads files to CDN
*
* @param array $files
* @param boolean $queue_failed
* @param array $results
* @return boolean
*/
function upload($files, $queue_failed, &$results) {
// kg: exit if no files are available to process as can
// happen if using hooks to remove items from files array
if(empty($files)) return true;$cdn = & $this->get_cdn();
$force_rewrite = $this->_config->get_boolean(‘cdn.force.rewrite’);@set_time_limit($this->_config->get_integer(‘timelimit.cdn_upload’));
// kg: $cdn->upload returns $count of files uploaded, However, when
// files fail this only queued when $count==0, errors can occur where $count > 0.
// Instead, scan the results array for errors
//if (!$cdn->upload($files, $results, $force_rewrite)) {
$numFilesUploaded = $cdn->upload($files, $results, $force_rewrite);
if (0 < $this->w3tc_error_count($results)) {
// fix-end
if ($queue_failed) {
foreach ($results as $result) {
if ($result[‘result’] != W3TC_CDN_RESULT_OK) {
$this->queue_add($result[‘local_path’], $result[‘remote_path’], W3TC_CDN_COMMAND_UPLOAD, $result[‘error’]);
}
}
}return false;
}return true;
}Also apply the above logic changes to delete() and purge().
Your thoughts FT ??
kg
- The topic ‘[Plugin: W3 Total Cache] Logic tweak handling results of upload, delete and purge’ is closed to new replies.