function advagg_rename in Advanced CSS/JS Aggregation 7.2
Rename; fallback to copy delete if this fails.
Parameters
string $source: A string containing the source location.
string $destination: A string containing the destination location.
Return value
mixed Destination string on success, FALSE on failure.
1 call to advagg_rename()
- advagg_save_data in ./
advagg.missing.inc - Save data to a file.
File
- ./
advagg.missing.inc, line 1448 - Advanced CSS/JS aggregation module.
Code
function advagg_rename($source, $destination) {
$real_source = drupal_realpath($source);
$real_source = $real_source ? $real_source : $source;
$real_destination = drupal_realpath($destination);
$real_destination = $real_destination ? $real_destination : $destination;
// Try php rename.
if (!@rename($real_source, $real_destination)) {
// Try drupal move.
if (!file_unmanaged_move($source, $destination)) {
// Try file scheme's rename method if it exists.
$fs_wrapper = file_stream_wrapper_get_instance_by_scheme(file_uri_scheme($source));
if (!$fs_wrapper || !method_exists($fs_wrapper, 'rename') || !$fs_wrapper
->rename($source, $destination)) {
return FALSE;
}
}
}
return $destination;
}