[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/imce/ -> imce.install (source)

   1  <?php
   2  // $Id: imce.install,v 1.3.2.7 2010/06/05 08:00:45 ufku Exp $
   3  
   4  /**
   5   * @file
   6   * Installs, updates, and uninstalls IMCE.
   7   */
   8  
   9  /**
  10   * Implementation of hook_install().
  11   */
  12  function imce_install() {
  13    drupal_install_schema('imce');
  14    module_load_include('inc', 'imce', 'inc/imce.core.profiles');
  15    imce_install_profiles();
  16    drupal_set_message(t('!module has been installed.', array('!module' => l('IMCE', 'admin/settings/imce'))));
  17  }
  18  
  19  /**
  20   * Implementation of hook_uninstall().
  21   */
  22  function imce_uninstall() {
  23    drupal_uninstall_schema('imce');
  24    variable_del('imce_profiles');
  25    variable_del('imce_roles_profiles');
  26    variable_del('imce_settings_textarea');
  27    variable_del('imce_settings_replace');
  28    variable_del('imce_settings_thumb_method');
  29    variable_del('imce_settings_disable_private');
  30    variable_del('imce_custom_content');
  31    variable_del('imce_custom_process');
  32    variable_del('imce_custom_scan');
  33  }
  34  
  35  /**
  36   * Implementation of hook_schema().
  37   */
  38  function imce_schema() {
  39    $schema['imce_files'] = array(
  40      'description' => 'Stores files created by IMCE.',
  41      'fields' => array(
  42        'fid' => array(
  43          'type' => 'int',
  44          'unsigned' => TRUE,
  45          'not null' => TRUE,
  46          'default' => 0,
  47          'description' => 'The {files}.fid that belongs to IMCE.',
  48        ),
  49      ),
  50      'primary key' => array('fid'),
  51    );
  52    return $schema;
  53  }
  54  
  55  /**
  56   * Update from 5.x to 6.x.
  57   */
  58  function imce_update_6000() {
  59    module_load_include('inc', 'imce', 'inc/imce.core.profiles');
  60    imce_install_profiles();
  61    return array();
  62  }
  63  
  64  /**
  65   * New option: total user quota.
  66   */
  67  function imce_update_6001() {
  68    $profiles = variable_get('imce_profiles', array());
  69    foreach ($profiles as $id => $profile) {
  70      $profiles[$id]['tuquota'] = 0;
  71    }
  72    variable_set('imce_profiles', $profiles);
  73    return array();
  74  }
  75  
  76  /**
  77   * Make file browser tab optional in user profiles.
  78   */
  79  function imce_update_6002() {
  80    $profiles = variable_get('imce_profiles', array());
  81    foreach ($profiles as $id => $profile) {
  82      $profiles[$id]['usertab'] = isset($profiles[$id]['usertab']) ? $profiles[$id]['usertab'] : 1;
  83    }
  84    variable_set('imce_profiles', $profiles);
  85    return array(array('success' => TRUE, 'query' => 'File browser tab in user profiles was made optional.'));
  86  }
  87  
  88  
  89  /**
  90   * Convert 6.x-1.x to 6.x-2.x
  91   */
  92  function imce_update_6200() {
  93    //delete deprecated variables.cancelled!
  94    return array();
  95  }
  96  
  97  /**
  98   * Introduce {imce_files} db table where IMCE files are stored.
  99   */
 100  function imce_update_6201() {
 101    $ret = array();
 102    $table = array(
 103      'description' => 'Stores files created by IMCE.',
 104      'fields' => array(
 105        'fid' => array(
 106          'type' => 'int',
 107          'unsigned' => TRUE,
 108          'not null' => TRUE,
 109          'default' => 0,
 110          'description' => 'The {files}.fid that belongs to IMCE.',
 111        ),
 112      ),
 113      'primary key' => array('fid'),
 114    );
 115    db_create_table($ret, 'imce_files', $table);
 116    return $ret;
 117  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7