mobile_switch_block.install in Mobile Switch Block 7
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.
*/
/**
* Implements 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:
// 7.x-1.4: 1348671046
// dev: 1348621394
if ($info['datestamp'] < 1348621394) {
$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;
}
/**
* Implements hook_uninstall().
*/
function mobile_switch_block_uninstall() {
$results = db_select('variable', 'v')
->fields('v', array(
'name',
))
->condition('name', '%mobile_switch_block%', 'LIKE')
->execute()
->fetchAll();
foreach ($results as $result) {
variable_del($result->name);
}
}
Functions
Name | Description |
---|---|
mobile_switch_block_requirements | Implements hook_requirements(). |
mobile_switch_block_uninstall | Implements hook_uninstall(). |