function total_control_requirements in Total Control Admin Dashboard 6.2
Same name and namespace in other branches
- 6 total_control.install \total_control_requirements()
- 7.2 total_control.install \total_control_requirements()
Test requirements for installation and running.
File
- ./
total_control.install, line 13 - total_control.install
Code
function total_control_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time.
$t = get_t();
// Assume that if the user is running an installation profile that both
// Panels and CTools are the same release.
if ($phase == 'install' && !(defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'install')) {
// Get panels required version.
if (!defined('TOTAL_CONTROL_REQUIRED_PANELS_API')) {
include_once drupal_get_path('module', 'total_control') . '/total_control.module';
}
// Check panels current version.
if (module_exists('panels')) {
include_once drupal_get_path('module', 'panels') . '/panels.module';
$panels_version = module_invoke('panels', 'api_version');
if ($panels_version[0] < 3) {
$requirements['total_control_panels'] = array(
'title' => $t('Panels API Version'),
'value' => $panels_version[0],
'severity' => REQUIREMENT_ERROR,
'description' => t('The Version of Panels is too old. Total Control needs at least %version.0.', array(
'%version' => TOTAL_CONTROL_REQUIRED_PANELS_API,
)),
);
}
}
// Get views required version.
if (!defined('TOTAL_CONTROL_REQUIRED_VIEWS_API')) {
include_once drupal_get_path('module', 'total_control') . '/total_control.module';
}
// Check views current version.
if (module_exists('views')) {
include_once drupal_get_path('module', 'views') . '/views.module';
$views_version = module_invoke('views', 'api_version');
if ($views_version < 2) {
$requirements['total_control_views'] = array(
'title' => $t('Views API Version'),
'value' => $views_version,
'severity' => REQUIREMENT_ERROR,
'description' => t('The Version of Views is too old. Total Control needs at least %version.0.', array(
'%version' => TOTAL_CONTROL_REQUIRED_VIEWS_API,
)),
);
}
}
}
if ($phase == 'runtime') {
// Add a helpful message if more features exist.
$modules = array();
if (!module_exists('search')) {
$search = FALSE;
$modules[] = 'search';
}
if (!module_exists('statistics')) {
$statistics = FALSE;
$modules[] = 'statistics';
}
if (!module_exists('taxonomy')) {
$taxonomy = FALSE;
$modules[] = 'taxonomy';
}
if ($search === FALSE || $statistics === FALSE || $taxonomy === FALSE) {
$requirements['total_control_features'] = array(
'title' => $t('Total Control has hidden features.'),
'description' => t('Try enabling the following modules for even more control: !modules', array(
'!modules' => implode(', ', $modules),
)),
'severity' => REQUIREMENT_WARNING,
);
}
}
return $requirements;
}