You are here

public function FileMetadataManager::release in File metadata manager 8

Same name and namespace in other branches
  1. 8.2 src/FileMetadataManager.php \Drupal\file_mdm\FileMetadataManager::release()

Releases the FileMetadata object for the URI.

Parameters

string $uri: The URI to a file.

Return value

bool TRUE if the FileMetadata for the URI was removed from the manager, FALSE otherwise.

Overrides FileMetadataManagerInterface::release

File

src/FileMetadataManager.php, line 141

Class

FileMetadataManager
A service class to provide file metadata.

Namespace

Drupal\file_mdm

Code

public function release($uri) {
  if (!($hash = $this
    ->calculateHash($uri))) {
    return FALSE;
  }
  if (isset($this->files[$hash])) {
    unset($this->files[$hash]);
    return TRUE;
  }
  return FALSE;
}