Mercurial > defr > drupal > core
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 8:85cbd6048071 | 9:acef7ccb09b5 |
|---|---|
| 1 <?php | 1 <?php |
| 2 // $Id: blogapi.install,v 1.1 2008/01/09 09:51:34 goba Exp $ | 2 // $Id: blogapi.install,v 1.1.2.1 2008/08/13 23:59:12 drumm Exp $ |
| 3 | |
| 4 /** | |
| 5 * Implementation of hook_install(). | |
| 6 */ | |
| 7 function blogapi_install() { | |
| 8 // Create tables. | |
| 9 drupal_install_schema('blogapi'); | |
| 10 } | |
| 11 | |
| 12 /** | |
| 13 * Implementation of hook_uninstall(). | |
| 14 */ | |
| 15 function blogapi_uninstall() { | |
| 16 // Remove tables. | |
| 17 drupal_uninstall_schema('blogapi'); | |
| 18 } | |
| 19 | |
| 20 | |
| 21 /** | |
| 22 * Implementation of hook_schema(). | |
| 23 */ | |
| 24 function blogapi_schema() { | |
| 25 //This table was introduced in Drupal 6.4 | |
| 26 $schema['blogapi_files'] = array( | |
| 27 'description' => t('Stores information for files uploaded via the blogapi.'), | |
| 28 'fields' => array( | |
| 29 'fid' => array( | |
| 30 'description' => t('Primary Key: Unique file ID.'), | |
| 31 'type' => 'serial', | |
| 32 ), | |
| 33 'uid' => array( | |
| 34 'description' => t('The {users}.uid of the user who is associated with the file.'), | |
| 35 'type' => 'int', | |
| 36 'unsigned' => TRUE, | |
| 37 'not null' => TRUE, | |
| 38 'default' => 0), | |
| 39 'filepath' => array( | |
| 40 'description' => t('Path of the file relative to Drupal root.'), | |
| 41 'type' => 'varchar', | |
| 42 'length' => 255, | |
| 43 'not null' => TRUE, | |
| 44 'default' => ''), | |
| 45 'filesize' => array( | |
| 46 'description' => t('The size of the file in bytes.'), | |
| 47 'type' => 'int', | |
| 48 'unsigned' => TRUE, | |
| 49 'not null' => TRUE, | |
| 50 'default' => 0), | |
| 51 ), | |
| 52 'primary key' => array('fid'), | |
| 53 'indexes' => array( | |
| 54 'uid' => array('uid'), | |
| 55 ), | |
| 56 ); | |
| 57 | |
| 58 return $schema; | |
| 59 } | |
| 3 | 60 |
| 4 /** | 61 /** |
| 5 * @defgroup updates-5.x-to-6.x Blog API updates from 5.x to 6.x | 62 * @defgroup updates-5.x-to-6.x Blog API updates from 5.x to 6.x |
| 6 * @{ | 63 * @{ |
| 7 */ | 64 */ |
| 12 function blogapi_update_6000() { | 69 function blogapi_update_6000() { |
| 13 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.'); | 70 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.'); |
| 14 return array(); | 71 return array(); |
| 15 } | 72 } |
| 16 | 73 |
| 74 | |
| 75 /** | |
| 76 * Add blogapi_files table to enable size restriction for BlogAPI file uploads. | |
| 77 * | |
| 78 * This table was introduced in Drupal 6.4. | |
| 79 */ | |
| 80 function blogapi_update_6001() { | |
| 81 $schema['blogapi_files'] = array( | |
| 82 'description' => t('Stores information for files uploaded via the blogapi.'), | |
| 83 'fields' => array( | |
| 84 'fid' => array( | |
| 85 'description' => t('Primary Key: Unique file ID.'), | |
| 86 'type' => 'serial', | |
| 87 ), | |
| 88 'uid' => array( | |
| 89 'description' => t('The {users}.uid of the user who is associated with the file.'), | |
| 90 'type' => 'int', | |
| 91 'unsigned' => TRUE, | |
| 92 'not null' => TRUE, | |
| 93 'default' => 0), | |
| 94 'filepath' => array( | |
| 95 'description' => t('Path of the file relative to Drupal root.'), | |
| 96 'type' => 'varchar', | |
| 97 'length' => 255, | |
| 98 'not null' => TRUE, | |
| 99 'default' => ''), | |
| 100 'filesize' => array( | |
| 101 'description' => t('The size of the file in bytes.'), | |
| 102 'type' => 'int', | |
| 103 'unsigned' => TRUE, | |
| 104 'not null' => TRUE, | |
| 105 'default' => 0), | |
| 106 ), | |
| 107 'primary key' => array('fid'), | |
| 108 'indexes' => array( | |
| 109 'uid' => array('uid'), | |
| 110 ), | |
| 111 ); | |
| 112 | |
| 113 $ret = array(); | |
| 114 | |
| 115 if (!db_table_exists('blogapi_files')) { | |
| 116 db_create_table($ret, 'blogapi_files', $schema['blogapi_files']); | |
| 117 } | |
| 118 return $ret; | |
| 119 } | |
| 120 | |
| 17 /** | 121 /** |
| 18 * @} End of "defgroup updates-5.x-to-6.x" | 122 * @} End of "defgroup updates-5.x-to-6.x" |
| 19 * The next series of updates should start at 7000. | 123 * The next series of updates should start at 7000. |
| 20 */ | 124 */ |
| 125 |
