Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/StreamWrapper/LocalStream.php \Drupal\Core\StreamWrapper\LocalStream::rename()
  2. 9 core/lib/Drupal/Core/StreamWrapper/LocalStream.php \Drupal\Core\StreamWrapper\LocalStream::rename()

Renames a file or directory.

This method is called in response to rename(). Should attempt to rename $path_from to $path_to.

Note, in order for the appropriate error message to be returned this method should not be defined if the wrapper does not support renaming files.

Note, the streamWrapper::$context property is updated if a valid context is passed to the caller function.

Parameters

string $path_from: The URL to the current file.

string $path_to: The URL which the $path_from should be renamed to.

Return value

bool Returns TRUE on success or FALSE on failure.

Overrides PhpStreamWrapperInterface::rename

See also

rename()

http://php.net/manual/en/streamwrapper.rename.php

1 method overrides LocalStream::rename()
LocalReadOnlyStream::rename in core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php
Support for rename().

File

core/lib/Drupal/Core/StreamWrapper/LocalStream.php, line 310

Class

LocalStream
Defines a Drupal stream wrapper base class for local files.

Namespace

Drupal\Core\StreamWrapper

Code

public function rename($from_uri, $to_uri) {
  return rename($this
    ->getLocalPath($from_uri), $this
    ->getLocalPath($to_uri));
}