web/drupal/modules/update/update.install
branchdrupal
changeset 74 0ff3ba646492
equal deleted inserted replaced
73:fcf75e232c5b 74:0ff3ba646492
       
     1 <?php
       
     2 // $Id: update.install,v 1.4.2.2 2009/01/06 15:46:38 goba Exp $
       
     3 
       
     4 /**
       
     5  * Implementation of hook_install().
       
     6  */
       
     7 function update_install() {
       
     8   // Create cache table.
       
     9   drupal_install_schema('update');
       
    10   // Remove stale variables from update_status 5.x contrib, if any.
       
    11   _update_remove_update_status_variables();
       
    12 }
       
    13 
       
    14 /**
       
    15  * Implementation of hook_uninstall().
       
    16  */
       
    17 function update_uninstall() {
       
    18   // Remove cache table.
       
    19   drupal_uninstall_schema('update');
       
    20   // Clear any variables that might be in use
       
    21   $variables = array(
       
    22     'update_check_frequency',
       
    23     'update_fetch_url',
       
    24     'update_last_check',
       
    25     'update_notification_threshold',
       
    26     'update_notify_emails',
       
    27   );
       
    28   foreach ($variables as $variable) {
       
    29     variable_del($variable);
       
    30   }
       
    31   menu_rebuild();
       
    32 }
       
    33 
       
    34 /**
       
    35  * Implementation of hook_schema().
       
    36  */
       
    37 function update_schema() {
       
    38   $schema['cache_update'] = drupal_get_schema_unprocessed('system', 'cache');
       
    39   $schema['cache_update']['description'] = 'Cache table for the Update module to store information about available releases, fetched from central server.';
       
    40   return $schema;
       
    41 }
       
    42 
       
    43 /**
       
    44  * Private helper to clear out stale variables from update_status 5.x contrib.
       
    45  *
       
    46  * @see update_install()
       
    47  * @see update_update_6000()
       
    48  */
       
    49 function _update_remove_update_status_variables() {
       
    50   variable_del('update_status_settings');
       
    51   variable_del('update_status_notify_emails');
       
    52   variable_del('update_status_check_frequency');
       
    53   variable_del('update_status_notification_threshold');
       
    54   variable_del('update_status_last');
       
    55   variable_del('update_status_fetch_url');
       
    56 }
       
    57 
       
    58 /**
       
    59  * Clear out stale variables from update_status.
       
    60  */
       
    61 function update_update_6000() {
       
    62   _update_remove_update_status_variables();
       
    63   return array();
       
    64 }