@OpenGeek
Seems to be working - cheers
If the following is of interest:
I took a closer look at the file and found the following changes that have been made in the 1.0.3 cache_sync processor.
Lines: 171 to 176
// clean comments from snippet code
$code = '<?php ' . trim($tmp1['snippet']);
$code = trim($tmp1['snippet']);
$code = extension_loaded('tokenizer') ? strip_tokens($code) : $code;
$code = str_replace('<?php ', '', $code);
$tmpPHP .= '$s[\''.$modx->db->escape($tmp1['name']).'\']'." = '".$this->escapeSingleQuotes($code)."';\n";
Lines: 192 to 193
$code =& $tmp1['plugincode'];
$code = extension_loaded('tokenizer') ? strip_tokens($code) : $code;
Lines: 219 to 240 (Version 1.0.0 starts at line 212)
// close and write the file
$tmpPHP .= '?>';
$filename = $this->cachePath.'siteCache.idx.php';
// invoke OnBeforeCacheUpdate event
if ($modx) $modx->invokeEvent('OnBeforeCacheUpdate');
if (!$handle = fopen($filename, 'w')) {
echo 'Cannot open file (',$filename,')';
exit;
}
// Write $somecontent to our opened file.
if (fwrite($handle, $tmpPHP) === FALSE) {
echo 'Cannot write main MODx cache file! Make sure the assets/cache directory is writable!';
exit;
}
fclose($handle);
unset($tmpPHP);
// invoke OnCacheUpdate event
if ($modx) $modx->invokeEvent('OnCacheUpdate');
Lines: 314 to 359
/**
* strip_tokens
*
* can be used to remove comments from php code
*
* from http://www.php.net/manual/en/function.php-strip-whitespace.php#91065
*
* @param string $code
* @return string code with certain php tokens removed (defaults to comments)
*/
function strip_tokens($code) {
$args = func_get_args();
$arg_count = count($args);
// if no tokens to strip have been specified then strip comments by default
if( $arg_count === 1 ) {
$args[1] = T_COMMENT;
$args[2] = T_DOC_COMMENT;
}
// build a keyed array of tokens to strip
for( $i = 1; $i < count($args); ++$i )
$strip[ $args[$i] ] = true;
// set a keyed array of newline characters used to preserve line numbering
$newlines = array("\n" => true, "\r" => true);
$tokens = @token_get_all($code);
reset($tokens);
$return = '';
$token = current($tokens);
while( $token ) {
if( !is_array($token) )
$return.= $token;
elseif( !isset($strip[ $token[0] ]) )
$return.= $token[1];
else {
// return only the token's newline characters to preserve line numbering
for( $i = 0, $token_length = strlen($token[1]); $i < $token_length; ++$i )
if( isset($newlines[ $token[1][$i] ]) )
$return.= $token[1][$i];
}
$token = next($tokens);
} // while more tokens
return $return;
}
Cheers and hopefully this will be sorted soon in the official distribution package.