Storage API

Prerequisites

Database: MySQL or PostgreSQL
Other databases are not supported and could result in unexpected behavior. MariaDB being a form fit and function replacement for MySQL seems to work fine.

Installation

- Install as you would a normal module
- A default storage class and container are created when then the module is installed.

Container Configuration with S3 via Settings.php

If you need to configure containers via code. You can now do so using settings.php. Caveat is the container must be created in the UI first to create the storage ID numbers in the database. Refer to #2325149: Allow configuration management through settings.php for details about how this works and the use-case.

An Example:

/**
 * Storage API settings
 *
 * Key would be container ID as appears in storage API config. Note that this
 * only makes sense for a specific type of deployment with predictable IDs. This
 * use case happens to be one of them.
 */
$conf['storage_api_container_settings'] = array(
  '1' => array(
    'path'     => 'sites/local/files/somewhere',
    'base_url' => 'sites/local/files/somewhere',
  ),
  '2' => array(
    'access_key_id'        => 'ACCESSKEYHERE',
    'secret_access_key'    => 'SECRETKEYHERE',
    'bucket'               => 'mybucket',
    'cname'                => 1,
    'reduced_redundancy'   => 0,
    'cloudfront'           => 0,
    'cloudfront_streaming' => 0,
    'location'             => '',
    'url_lifetime'         => 3601,
  ),
);

Links

Project page

Important Notices

If you are currently using CKEditor module (version 7.x-1.16 or earlier) and have upgraded to Storage API 1.8 and are experiencing problems. The issue revolves around the CKEditor module.

Here is the issue to reference in the Storage API queue:
#2499135: Nested storage_core_bridge_storage_access Function Call
Here is the problem in the CKEditor module queue and a patch to fix it:
#2437749: Infinity bucle in some cases in ckeditor_file_download

The fix was included in CKEditor 7.x-1.17.

Using File Streams

To use this module with some third-party modules that do not use the core file processing. You will need to install Storage API Stream Wrapper

Classes and Containers

Containers

Data URIs

Instead of linking to a file, Data URIs contain the file itself. This means that images can be embedded directly into HTML documents.

Deduplication

Storage API has built in deduplication. This reduces the storage and network footprint.

In-request file generation

Storage API has a mechanism for generating files in-request. This is useful when generating a file needed by a page would delay the

Screencasts

Note these screencasts were recorded in 2012 and certain things could be different.

Selectors

A selector is a select form item that is used to control which class files should be in.

Storage services

Each storage service is implemented as a PHP class. More can be defined via a module hook.

Guide maintainers

jbrown's picture