Mercurial > defr > drupal > core
diff modules/blogapi/blogapi.install @ 9:acef7ccb09b5 6.4
Drupal 6.4
author | Franck Deroche <webmaster@defr.org> |
---|---|
date | Tue, 23 Dec 2008 14:32:08 +0100 |
parents | c1f4ac30525a |
children | 3edae6ecd6c6 |
line wrap: on
line diff
--- a/modules/blogapi/blogapi.install Tue Dec 23 14:30:28 2008 +0100 +++ b/modules/blogapi/blogapi.install Tue Dec 23 14:32:08 2008 +0100 @@ -1,5 +1,62 @@ <?php -// $Id: blogapi.install,v 1.1 2008/01/09 09:51:34 goba Exp $ +// $Id: blogapi.install,v 1.1.2.1 2008/08/13 23:59:12 drumm Exp $ + +/** + * 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() { + //This table was introduced in Drupal 6.4 + $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 @@ -14,7 +71,55 @@ return array(); } + +/** + * Add blogapi_files table to enable size restriction for BlogAPI file uploads. + * + * This table was introduced in Drupal 6.4. + */ +function blogapi_update_6001() { + $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'), + ), + ); + + $ret = array(); + + if (!db_table_exists('blogapi_files')) { + 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. */ +