Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ElijahLynn
Last active August 28, 2015 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ElijahLynn/ad1b22d285d44425e4d7 to your computer and use it in GitHub Desktop.
Save ElijahLynn/ad1b22d285d44425e4d7 to your computer and use it in GitHub Desktop.
function amazons3_stream_wrappers() {
// This hook is called before hook_init(), so we have to manually register
// the autoloader. We also need to handle module upgrades where
// composer_manager might not be enabled yet.
if (!module_exists('composer_manager')) {
return array();
}
// If the module has been enabled, but the user didn't update composer
// libraries, prevent failing entirely.
try {
composer_manager_register_autoloader();
}
catch (\RuntimeException $e) {
watchdog('amazons3', 'The Composer autoloader could not be registered. Run drush composer-rebuild and drush composer-manager update to update your vendor directory.');
watchdog_exception('amazons3', $e);
return array();
}
// If the module isn't configured yet, don't register the stream wrapper.
try {
\Drupal\amazons3\StreamWrapperConfiguration::fromDrupalVariables();
}
catch (\InvalidArgumentException $e) {
return array();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment