Created
January 6, 2016 02:02
-
-
Save anonymous/48de54997b71cf19f107 to your computer and use it in GitHub Desktop.
Custom Drupal 7 module to toggle the Storage API "External" setting for Amazon S3 containers. See: https://www.drupal.org/node/1832364
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
name = "S3 External Toggle" | |
description = "Enable to set all Storage API Amazon S3 containers to 'External' (disable to reverse the setting)" | |
package = "Storage API" | |
core = 7.x | |
version = 7.x-1.0 | |
dependencies[] = storage |
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
<?php | |
/** | |
* Implement hook_enable() | |
*/ | |
function storage_api_external_enable() { | |
db_update('storage_container') | |
->fields(array('external' => 1)) | |
->condition('service_id', 'storage:s3', '=') | |
->execute(); | |
} | |
/** | |
* Implement hook_disable() | |
*/ | |
function storage_api_external_disable() { | |
db_update('storage_container') | |
->fields(array('external' => 0)) | |
->condition('service_id', 'storage:s3', '=') | |
->execute(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment