[177a560] | 1 | <?php |
---|
| 2 | |
---|
| 3 | /** |
---|
| 4 | * @file |
---|
| 5 | * Provides installation related function to editablefields module. |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | /** |
---|
| 9 | * Implementation of hook_schema(). |
---|
| 10 | */ |
---|
| 11 | function editablefields_schema() { |
---|
| 12 | $schema['editablefields_preset'] = array( |
---|
| 13 | 'description' => t('Table storing preset definitions.'), |
---|
| 14 | 'export' => array( |
---|
| 15 | 'key' => 'name', |
---|
| 16 | 'identifier' => 'preset', // Exports will be defined as $preset |
---|
| 17 | 'default hook' => 'default_editablefields_preset', // Function hook name. |
---|
| 18 | 'api' => array( |
---|
| 19 | 'owner' => 'editablefields', |
---|
| 20 | 'api' => 'default_editablefields_presets', // Base name for api include files. |
---|
| 21 | 'minimum_version' => 1, |
---|
| 22 | 'current_version' => 1, |
---|
| 23 | ), |
---|
| 24 | ), |
---|
| 25 | 'fields' => array( |
---|
| 26 | 'name' => array( |
---|
| 27 | 'type' => 'varchar', |
---|
| 28 | 'length' => '255', |
---|
| 29 | 'description' => 'Unique ID for presets. Used to identify them programmatically.', |
---|
| 30 | ), |
---|
| 31 | 'pid' => array( |
---|
| 32 | 'type' => 'serial', |
---|
| 33 | 'unsigned' => TRUE, |
---|
| 34 | 'not null' => TRUE, |
---|
| 35 | 'description' => 'Primary ID field for the table. Not used for anything except internal lookups.', |
---|
| 36 | 'no export' => TRUE, // Do not export database-only keys. |
---|
| 37 | ), |
---|
| 38 | 'description' => array( |
---|
| 39 | 'type' => 'varchar', |
---|
| 40 | 'length' => '255', |
---|
| 41 | 'description' => 'A human readable name of a preset.', |
---|
| 42 | ), |
---|
| 43 | 'config' => array( |
---|
| 44 | 'type' => 'text', |
---|
| 45 | 'size' => 'big', |
---|
| 46 | 'description' => 'Configuration data.', |
---|
| 47 | ), |
---|
| 48 | ), |
---|
| 49 | 'primary key' => array('pid'), |
---|
| 50 | 'unique keys' => array( |
---|
| 51 | 'name' => array('name'), |
---|
| 52 | ), |
---|
| 53 | ); |
---|
| 54 | return $schema; |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | /** |
---|
| 58 | * Implementation of hook_install(). |
---|
| 59 | */ |
---|
| 60 | function editablefields_install() { |
---|
| 61 | drupal_install_schema('editablefields'); |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | /** |
---|
| 65 | * Implementation of hook_install(). |
---|
| 66 | */ |
---|
| 67 | function editablefields_uninstall() { |
---|
| 68 | drupal_uninstall_schema('editablefields'); |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | /** |
---|
| 73 | * Update to the 6.x-3.x branch. |
---|
| 74 | */ |
---|
| 75 | function editablefields_update_6000() { |
---|
| 76 | $ret = array(); |
---|
| 77 | |
---|
| 78 | // Check the new dependency on Ctools. |
---|
| 79 | if (!module_exists('ctools')) { |
---|
| 80 | $ret['#abort'] = array('success' => FALSE, 'query' => 'Editablefields |
---|
| 81 | 6.x-3.x requires the Ctools module. No updates were run.'); |
---|
| 82 | return $ret; |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | $ret[] = array( |
---|
| 86 | 'success' => TRUE, |
---|
| 87 | 'query' => t('Installing schema.'), |
---|
| 88 | ); |
---|
| 89 | // install schema |
---|
| 90 | $schema_ret = drupal_install_schema('editablefields'); |
---|
| 91 | $ret = array_merge($ret, $schema_ret); |
---|
| 92 | |
---|
| 93 | return $ret; |
---|
| 94 | } |
---|