diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2008-10-12 02:58:23 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2008-10-12 02:58:23 +0000 |
commit | 145e1ced25627632255a0891bb8130d4c2ef6491 (patch) | |
tree | 33abae7f8a4e1c5d56fbfe99f5ca8e0c63eeb2b0 /modules/blogapi/blogapi.install | |
parent | acd5e95200790938c2b6b5042972100d47847a68 (diff) | |
download | brdo-145e1ced25627632255a0891bb8130d4c2ef6491.tar.gz brdo-145e1ced25627632255a0891bb8130d4c2ef6491.tar.bz2 |
#319467: SA-2008-47 (#295053): Arbitrary file uploads in Blog API.
Diffstat (limited to 'modules/blogapi/blogapi.install')
-rw-r--r-- | modules/blogapi/blogapi.install | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/modules/blogapi/blogapi.install b/modules/blogapi/blogapi.install index 1855b4935..0bf00659c 100644 --- a/modules/blogapi/blogapi.install +++ b/modules/blogapi/blogapi.install @@ -2,6 +2,65 @@ // $Id$ /** + * Implementation of hook_install(). + */ +function blogapi_install() { + // Create tables. + drupal_install_schema('blogapi'); +} + +/** + * Implementation of hook_uninstall(). + */ +function blogapi_uninstall() { + // Remove tables. + drupal_uninstall_schema('blogapi'); +} + + +/** + * Implementation of hook_schema(). + */ +function blogapi_schema() { + $schema['blogapi_files'] = array( + 'description' => t('Stores information for files uploaded via the blogapi.'), + 'fields' => array( + 'fid' => array( + 'description' => t('Primary Key: Unique file ID.'), + 'type' => 'serial', + ), + 'uid' => array( + 'description' => t('The {users}.uid of the user who is associated with the file.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'filepath' => array( + 'description' => t('Path of the file relative to Drupal root.'), + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'filesize' => array( + 'description' => t('The size of the file in bytes.'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + ), + 'primary key' => array('fid'), + 'indexes' => array( + 'uid' => array('uid'), + ), + ); + + return $schema; +} + +/** * @defgroup updates-5.x-to-6.x Blog API updates from 5.x to 6.x * @{ */ @@ -15,6 +74,22 @@ function blogapi_update_6000() { } /** + * Add blogapi_files table to enable size restriction for BlogAPI file uploads. + * + * This table was introduced in Drupal 6.4. + */ +function blogapi_update_6001() { + $ret = array(); + + if (!db_table_exists('blogapi_files')) { + $schema = blogapi_schema(); + db_create_table($ret, 'blogapi_files', $schema['blogapi_files']); + } + + return $ret; +} + +/** * @} End of "defgroup updates-5.x-to-6.x" * The next series of updates should start at 7000. */ |