function _advagg_relocate_save_remote_asset in Advanced CSS/JS Aggregation 7.2
Parse the font family string into a structured array.
Parameters
string $filename: The filename to save.
string $data: The data to save to the file.
bool $local_cache: TRUE if the data came from the cache bin.
string $hash: Contents hash; if different resave data.
Return value
array Returns an array of errors that might have happened.
2 calls to _advagg_relocate_save_remote_asset()
- advagg_relocate_css_post_alter in advagg_relocate/
advagg_relocate.module - Alter the css array.
- advagg_relocate_js_post_alter in advagg_relocate/
advagg_relocate.module - Alter the js array.
File
- advagg_relocate/
advagg_relocate.advagg.inc, line 1082 - Advanced aggregation relocate module.
Code
function _advagg_relocate_save_remote_asset($filename, $data, $local_cache, $hash) {
// Save remote data.
$errors = array();
$saved = FALSE;
$dir = variable_get('advagg_relocate_directory', ADVAGG_RELOCATE_DIRECTORY);
$full_filename = $dir . $filename;
$local_hash = '';
if (!is_readable($full_filename)) {
$errors = advagg_save_data($full_filename, $data);
$saved = TRUE;
}
elseif (empty($local_cache)) {
$file_contents = @advagg_file_get_contents($full_filename);
if (!empty($file_contents)) {
$local_hash = drupal_hash_base64($file_contents);
}
if ($hash !== $local_hash) {
$errors = advagg_save_data($full_filename, $data, TRUE);
$saved = TRUE;
}
}
return array(
$full_filename,
$errors,
$saved,
);
}