You are here

function s3fs_stream_wrappers_alter in S3 File System 7.2

Same name and namespace in other branches
  1. 7.3 s3fs.module \s3fs_stream_wrappers_alter()

Implements hook_stream_wrappers_alter().

If configured to do so, s3fs takes control of the public:// stream wrapper.

File

./s3fs.module, line 37
Hook implementations and other primary functionality for S3 File System.

Code

function s3fs_stream_wrappers_alter(&$wrappers) {
  $config = _s3fs_get_config();
  if (!empty($config['use_s3_for_public'])) {
    $wrappers['public'] = array(
      'name' => t('Public files (s3fs)'),
      'class' => 'S3fsStreamWrapper',
      'description' => t('Public files served from Amazon S3.'),
      'type' => STREAM_WRAPPERS_NORMAL,
    );
  }
  if (!empty($config['use_s3_for_private'])) {
    $wrappers['private'] = array(
      'name' => t('Private files (s3fs)'),
      'class' => 'S3fsStreamWrapper',
      'description' => t('Private files served from Amazon S3.'),
      'type' => STREAM_WRAPPERS_NORMAL,
      // Required by the file_eneity module to let it know that this is a private stream.
      'private' => TRUE,
    );
  }
}