Last active
August 28, 2015 18:38
-
-
Save ElijahLynn/ad1b22d285d44425e4d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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