pmtimetracking.install in Drupal PM (Project Management) 7.2
Same filename and directory in other branches
Install functions for PM Timetracking.
File
pmtimetracking/pmtimetracking.installView source
<?php
/**
* @file
* Install functions for PM Timetracking.
*/
/**
* Implements hook_install().
*/
function pmtimetracking_install() {
variable_set('node_options_pmtimetracking', array(
'status',
));
// PM Permissions default configurations.
variable_set('pmpermission_field_parent_reference_for_pmtimetracking', 'pmtimetracking_parent');
variable_set('pmpermission_node_pmtimetracking_enabled', TRUE);
// Create and attaches fields to pmtimetracking content type.
module_load_include('inc', 'pmtimetracking', 'includes/pmtimetracking.migrate');
// Parameter $sandbox is passed as a placeholder.
$sandbox = array();
pmtimetracking_migrate_create_fields($sandbox);
}
/**
* Implements hook_uninstall().
*/
function pmtimetracking_uninstall() {
variable_del('pmpermission_field_parent_reference_for_pmtimetracking');
variable_del('pmpermission_node_pmtimetracking_enabled');
// Clean up field instances (and field) and its data.
module_load_include('inc', 'pmtimetracking', 'includes/pmtimetracking.field_instance');
module_load_include('inc', 'pmtimetracking', 'includes/pmtimetracking.field_base');
$declared_field_bases = pmtimetracking_default_field_bases();
$declared_field_instances = pmtimetracking_default_field_instances();
$field_instance = field_info_instances('node', 'pmtimetracking');
foreach ($declared_field_instances as $declared_instance) {
$instance = $field_instance[$declared_instance['field_name']];
if ($instance) {
// Only delete field base if declared by this module.
$delete_field_base = isset($declared_field_bases[$declared_instance['field_name']]);
field_delete_instance($instance, $delete_field_base);
}
}
}
/**
* Implements hook_update_last_removed().
*/
function pmtimetracking_update_last_removed() {
return 6201;
}
/**
* Migrate PM Timetracking nodes to field_api fields.
*/
function pmtimetracking_update_7106(&$sandbox) {
module_load_include('inc', 'pmtimetracking', 'includes/pmtimetracking.migrate');
if (pmtimetracking_migrate_update_could_be_performed()) {
return pmtimetracking_migrate($sandbox);
}
}
/**
* Deactivate auto duration settings to maintain behaviour of existing sites.
*/
function pmtimetracking_update_7201() {
variable_set('pmtimetracking_auto_duration', FALSE);
variable_set('pmtimetracking_auto_billing_duration', FALSE);
}
/**
* Implements hook_update_dependencies().
*/
function pmtimetracking_update_dependencies() {
// pmperson_update_7104() migrates pmperson data to drupal user.
// pmtimetracking migration depends on its completion.
$dependencies['pmtimetracking'][7106] = array(
'pmproject' => 7104,
);
return $dependencies;
}
Functions
Name | Description |
---|---|
pmtimetracking_install | Implements hook_install(). |
pmtimetracking_uninstall | Implements hook_uninstall(). |
pmtimetracking_update_7106 | Migrate PM Timetracking nodes to field_api fields. |
pmtimetracking_update_7201 | Deactivate auto duration settings to maintain behaviour of existing sites. |
pmtimetracking_update_dependencies | Implements hook_update_dependencies(). |
pmtimetracking_update_last_removed | Implements hook_update_last_removed(). |