mobile_switch_block.install in Mobile Switch Block 6
Same filename and directory in other branches
Install, update and uninstall functions for the Mobile Switch Block module.
File
mobile_switch_block.installView source
<?php
/**
 * @file
 * Install, update and uninstall functions for the Mobile Switch Block module.
 */
/**
 * Implementation of hook_requirements().
 */
function mobile_switch_block_requirements($phase) {
  $requirements = array();
  $t = get_t();
  $requirements['mobile_switch']['value'] = '';
  $info = drupal_parse_info_file(drupal_get_path('module', 'mobile_switch') . '/mobile_switch.info');
  switch ($phase) {
    case 'install':
      // Ensure Mobile Switch module version.
      // Release datestamps or+ are ok:
      // 6.x-1.0-beta1: 1349261467
      // dev:           1349267870
      if ($info['datestamp'] < 1349261467) {
        $requirements['mobile_switch'] = array(
          'severity' => REQUIREMENT_ERROR,
          'description' => $t('<em>Mobile Switch Block</em> module: The version of the required <em>Mobile Switch</em> module is too low. Please update this module.'),
        );
      }
      else {
        $requirements['mobile_switch'] = array(
          'severity' => REQUIREMENT_OK,
        );
      }
      break;
  }
  $requirements['mobile_switch']['value'] = $t('!version', array(
    '!version' => $info['version'],
  ));
  $requirements['mobile_switch']['title'] = $t('<em>Mobile Switch</em> module');
  return $requirements;
}
/**
 * Implementation of hook_uninstall().
 */
function mobile_switch_block_uninstall() {
  $query = db_query("SELECT * FROM {variable} WHERE name LIKE '%mobile_switch_block%'");
  while ($result = db_fetch_object($query)) {
    variable_del($result->name);
  }
}Functions
| 
            Name | 
                  Description | 
|---|---|
| mobile_switch_block_requirements | Implementation of hook_requirements(). | 
| mobile_switch_block_uninstall | Implementation of hook_uninstall(). |