mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
89 lines
2.3 KiB
Text
89 lines
2.3 KiB
Text
<?php
|
|
|
|
/**
|
|
* @file
|
|
* farmOS install file.
|
|
*/
|
|
|
|
/**
|
|
* Implements hook_update_dependencies().
|
|
*/
|
|
function farm_update_dependencies() {
|
|
|
|
// farm_livestock_7000() and farm_equipment_update_7000 both depend on
|
|
// farm_update_7000() because they use the new field_bases provided by
|
|
// farm_fields.
|
|
$farm_7000 = array(
|
|
'farm' => 7000,
|
|
);
|
|
$dependencies['farm_equipment'][7000] = $farm_7000;
|
|
$dependencies['farm_livestock'][7000] = $farm_7000;
|
|
return $dependencies;
|
|
}
|
|
|
|
/**
|
|
* Enable the Farm Fields module.
|
|
*/
|
|
function farm_update_7000(&$sandbox) {
|
|
|
|
// Install the farm_fields module and revert the field_base component on it,
|
|
// so that they are available to update hooks in other modules.
|
|
//
|
|
// Between farmOS 7.x-1.0-beta2 and 7.x-1.0-beta3, we upgraded from
|
|
// Features 1.x to 2.x. This replaced the 'field' component with
|
|
// 'field_base' and 'field_instance'. At the same time, a new module was
|
|
// introduced, to serve as a place to put common field_bases: farm_fields.
|
|
if (!module_exists('farm_fields')) {
|
|
|
|
// Enable the farm_fields module.
|
|
module_enable(array('farm_fields'));
|
|
|
|
// Reset the "default_hook" static cache for field_base Features components.
|
|
module_load_include('inc', 'features', 'features.export');
|
|
features_get_default_hooks('field_base', TRUE);
|
|
|
|
// Load the farm_fields field_base Features include file, otherwise
|
|
// feature_get_default() will not see it, and the revert will fail.
|
|
module_load_include('inc', 'farm_fields', 'farm_fields.features.field_base');
|
|
|
|
// Revert the field_base component of farm_fields.
|
|
features_revert(array('farm_fields' => array('field_base')));
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Update to Openlayers 3
|
|
*/
|
|
function farm_update_7001(&$sandbox) {
|
|
|
|
// Enable new module dependencies.
|
|
$modules = array(
|
|
'openlayers_geofield',
|
|
'views_geojson',
|
|
);
|
|
_farm_enable_modules($modules);
|
|
}
|
|
|
|
/**
|
|
* Enable Entity Reference View Widget.
|
|
*/
|
|
function farm_update_7002(&$sandbox) {
|
|
|
|
// Enable new module dependencies.
|
|
$modules = array(
|
|
'entityreference_view_widget',
|
|
);
|
|
_farm_enable_modules($modules);
|
|
}
|
|
|
|
/**
|
|
* Helper function: enable modules.
|
|
*/
|
|
function _farm_enable_modules($modules = array()) {
|
|
foreach ($modules as $module) {
|
|
if (!module_exists($module)) {
|
|
module_enable(array($module));
|
|
}
|
|
}
|
|
}
|
|
|