pm.install in Drupal PM (Project Management) 8
Same filename and directory in other branches
Install, update and uninstall functions for the Project Management module.
File
pm.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the Project Management module.
*/
/**
* Implements hook_uninstall().
*/
function pm_uninstall() {
module_load_include('inc', 'pm', 'includes/pm.install');
$module = 'pm';
// Delete variables used by this module.
pm_uninstall_variables($module);
}
/**
* Implements hook_update_last_removed().
*/
function pm_update_last_removed() {
return 6202;
}
/**
* Enable new module dependencies and create billing status field.
*/
function pm_update_7101() {
}
/**
* Make date field available to PM content types.
*/
function pm_update_7102() {
variable_del('pm_yearsrangebegin');
variable_del('pm_yearsrangeend');
}
/**
* Migration from 7.x-1.x to 7.x-2.x.
*/
function pm_update_7103(&$sandbox) {
$module_list = array(
'pmpermission',
);
// Enable new dependencies.
if (!module_enable($module_list, TRUE)) {
throw new DrupalUpdateException('This version requires one or more modules that could not be enabled.');
}
}
/**
* Removal of legacy attribute table.
*/
function pm_update_7104() {
db_drop_table('pmattribute');
}
/**
* Removal of legacy variable.
*/
function pm_update_7105() {
variable_del('pm_organization_nid');
}
/**
* Removal of legacy variable related to icons.
*/
function pm_update_7108() {
variable_del('pm_icons_path');
}
/**
* Migrate pm_icons_display settings to new pm_icon variable.
*/
function pm_update_7200() {
$display_icon = variable_get('pm_icons_display', TRUE);
if ($display_icon) {
variable_set('pm_icon', PM_ICON_SET_DEFAULT_BEHAVIOUR);
}
else {
variable_set('pm_icon', PM_ICON_SET_NO_ICON);
}
variable_del('pm_icons_display');
}
/**
* Remove legacy variables related to taxation.
*/
function pm_update_7201() {
variable_del('pm_tax1_app');
variable_del('pm_tax1_name');
variable_del('pm_tax1_percent');
variable_del('pm_tax2_app');
variable_del('pm_tax2_name');
variable_del('pm_tax2_percent');
}
/**
* Include pmpermission module into core.
*/
function pm_update_7300() {
// Rename all pmpermission_* variable to pm_permission_*.
$result = db_query("SELECT name FROM {variable} WHERE name LIKE 'pmpermission_%'");
foreach ($result as $record) {
$str = $record->name;
$prefix = 'pmpermission';
if (substr($str, 0, strlen($prefix)) == $prefix) {
$str = substr($str, strlen($prefix));
}
$old_variable = $record->name;
$new_variable = 'pm_permission' . $str;
variable_set($new_variable, variable_get($old_variable, ''));
variable_del($old_variable);
}
}
Functions
Name | Description |
---|---|
pm_uninstall | Implements hook_uninstall(). |
pm_update_7101 | Enable new module dependencies and create billing status field. |
pm_update_7102 | Make date field available to PM content types. |
pm_update_7103 | Migration from 7.x-1.x to 7.x-2.x. |
pm_update_7104 | Removal of legacy attribute table. |
pm_update_7105 | Removal of legacy variable. |
pm_update_7108 | Removal of legacy variable related to icons. |
pm_update_7200 | Migrate pm_icons_display settings to new pm_icon variable. |
pm_update_7201 | Remove legacy variables related to taxation. |
pm_update_7300 | Include pmpermission module into core. |
pm_update_last_removed | Implements hook_update_last_removed(). |