You are here

function Resource::move in D7 Media 6

Move a Resource.

Parameters

string $destination (optional) @see file_copy.:

int $replace (optional) @see file_destination:

Return value

bool

See also

file_copy()

1 method overrides Resource::move()
ResourceUpload::move in resource/resource.module
Move a Resource.

File

resource/resource.module, line 252
Resource API for Drupal, a replacement for files.

Class

Resource
Base Resource class.

Code

function move($destination, $replace = FILE_EXISTS_RENAME) {
  $destination = $this
    ->_destination($destination, $rename);
  if (copy($this->url, $destination)) {
    unlink($this->url);
    $orig = clone $this;
    $this->url = $destination;
    if ($this
      ->save()) {
      module_invoke_all('resource_move', $this, $orig);
      return ResourceFactory::loadId($this->rid);
    }
  }
  return FALSE;
}