You are here

protected function S3fsStreamWrapper::_delete_cache in S3 File System 7.3

Same name and namespace in other branches
  1. 7 S3fsStreamWrapper.inc \S3fsStreamWrapper::_delete_cache()
  2. 7.2 S3fsStreamWrapper.inc \S3fsStreamWrapper::_delete_cache()

Delete an object's metadata from the cache.

Parameters

mixed $uri: A string (or array of strings) containing the uri(s) of the object(s) to be deleted.

Return value

object|bool Returns a query object or FALSE.

Throws

Exceptions which occur in the database call will percolate.

3 calls to S3fsStreamWrapper::_delete_cache()
S3fsStreamWrapper::rename in ./S3fsStreamWrapper.inc
S3fsStreamWrapper::rmdir in ./S3fsStreamWrapper.inc
Support for rmdir().
S3fsStreamWrapper::unlink in ./S3fsStreamWrapper.inc
Support for unlink().

File

./S3fsStreamWrapper.inc, line 1089
Drupal stream wrapper implementation for S3 File System.

Class

S3fsStreamWrapper
The stream wrapper class.

Code

protected function _delete_cache($uri) {
  if (!is_array($uri)) {
    $uri = array(
      $uri,
    );
  }

  // Build an OR query to delete all the URIs at once.
  $delete_query = db_delete('s3fs_file');
  $or = db_or();
  foreach ($uri as $u) {
    $or
      ->condition('uri', $u, '=');
  }
  $delete_query
    ->condition($or);
  return $delete_query
    ->execute();
}