Rename; fallback to copy delete if this fails.

Paramètres

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 dans ./advagg.missing.inc
Save data to a file.

Fichier

./advagg.missing.inc, line 1448

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;
}