| 1 | | <?php |
| 2 | | // $Id: blogapi.install,v 1.3 2008/10/12 02:58:23 webchick Exp $ |
| 3 | | |
| 4 | | /** |
| 5 | | * Implementation of hook_install(). |
| 6 | | */ |
| 7 | 1 | function blogapi_install() { |
| 8 | | // Create tables. |
| 9 | 1 | drupal_install_schema('blogapi'); |
| 10 | 1 | } |
| 11 | | |
| 12 | | /** |
| 13 | | * Implementation of hook_uninstall(). |
| 14 | | */ |
| 15 | 1 | function blogapi_uninstall() { |
| 16 | | // Remove tables. |
| 17 | 0 | drupal_uninstall_schema('blogapi'); |
| 18 | 0 | } |
| 19 | | |
| 20 | | |
| 21 | | /** |
| 22 | | * Implementation of hook_schema(). |
| 23 | | */ |
| 24 | 1 | function blogapi_schema() { |
| 25 | 1 | $schema['blogapi_files'] = array( |
| 26 | 1 | 'description' => t('Stores information for files uploaded via the
blogapi.'), |
| 27 | | 'fields' => array( |
| 28 | | 'fid' => array( |
| 29 | 1 | 'description' => t('Primary Key: Unique file ID.'), |
| 30 | 1 | 'type' => 'serial', |
| 31 | 1 | ), |
| 32 | | 'uid' => array( |
| 33 | 1 | 'description' => t('The {users}.uid of the user who is associated
with the file.'), |
| 34 | 1 | 'type' => 'int', |
| 35 | 1 | 'unsigned' => TRUE, |
| 36 | 1 | 'not null' => TRUE, |
| 37 | 1 | 'default' => 0, |
| 38 | 1 | ), |
| 39 | | 'filepath' => array( |
| 40 | 1 | 'description' => t('Path of the file relative to Drupal root.'), |
| 41 | 1 | 'type' => 'varchar', |
| 42 | 1 | 'length' => 255, |
| 43 | 1 | 'not null' => TRUE, |
| 44 | 1 | 'default' => '', |
| 45 | 1 | ), |
| 46 | | 'filesize' => array( |
| 47 | 1 | 'description' => t('The size of the file in bytes.'), |
| 48 | 1 | 'type' => 'int', |
| 49 | 1 | 'unsigned' => TRUE, |
| 50 | 1 | 'not null' => TRUE, |
| 51 | 1 | 'default' => 0, |
| 52 | 1 | ), |
| 53 | 1 | ), |
| 54 | 1 | 'primary key' => array('fid'), |
| 55 | | 'indexes' => array( |
| 56 | 1 | 'uid' => array('uid'), |
| 57 | 1 | ), |
| 58 | | ); |
| 59 | | |
| 60 | 1 | return $schema; |
| 61 | 0 | } |
| 62 | | |
| 63 | | /** |
| 64 | | * @defgroup updates-5.x-to-6.x Blog API updates from 5.x to 6.x |
| 65 | | * @{ |
| 66 | | */ |
| 67 | | |
| 68 | | /** |
| 69 | | * Inform users about the new permission. |
| 70 | | */ |
| 71 | 1 | function blogapi_update_6000() { |
| 72 | 0 | drupal_set_message("Blog API module does not depend on blog module's
permissions anymore, but provides its own 'administer content with blog
api' permission instead. Until <a href=\"" . url('admin/user/permissions',
array('fragment' => 'module-blogapi')) . '">this permission is assigned</a>
to at least one user role, only the site administrator will be able to use
Blog API features.'); |
| 73 | 0 | return array(); |
| 74 | 0 | } |
| 75 | | |
| 76 | | /** |
| 77 | | * Add blogapi_files table to enable size restriction for BlogAPI file
uploads. |
| 78 | | * |
| 79 | | * This table was introduced in Drupal 6.4. |
| 80 | | */ |
| 81 | 1 | function blogapi_update_6001() { |
| 82 | 0 | $ret = array(); |
| 83 | | |
| 84 | 0 | if (!db_table_exists('blogapi_files')) { |
| 85 | 0 | $schema = blogapi_schema(); |
| 86 | 0 | db_create_table($ret, 'blogapi_files', $schema['blogapi_files']); |
| 87 | 0 | } |
| 88 | | |
| 89 | 0 | return $ret; |
| 90 | 0 | } |
| 91 | | |
| 92 | | /** |
| 93 | | * @} End of "defgroup updates-5.x-to-6.x" |
| 94 | | * The next series of updates should start at 7000. |
| 95 | | */ |
| 96 | 1 | |