advagg_mod.install in Advanced CSS/JS Aggregation 7.2
Same filename and directory in other branches
Handles AdvAgg mod installation and upgrade tasks.
File
advagg_mod/advagg_mod.installView source
<?php
/**
* @file
* Handles AdvAgg mod installation and upgrade tasks.
*/
/**
* @addtogroup hooks
* @{
*/
/**
* Implements hook_install().
*/
function advagg_mod_install() {
// New install gets a locked admin section.
variable_set('advagg_mod_admin_mode', 0);
}
/**
* Merge advagg_mod_css_defer_rel_preload into advagg_mod_css_defer.
*/
function advagg_mod_update_7201(&$sandbox) {
// Merge advagg_mod_css_defer_rel_preload into advagg_mod_css_defer.
$advagg_mod_css_defer = variable_get('advagg_mod_css_defer', ADVAGG_MOD_CSS_DEFER);
$advagg_mod_css_defer_rel_preload = variable_get('advagg_mod_css_defer_rel_preload', ADVAGG_MOD_CSS_DEFER_REL_PRELOAD);
variable_del('advagg_mod_css_defer_rel_preload');
if (!empty($advagg_mod_css_defer) && !empty($advagg_mod_css_defer_rel_preload)) {
variable_set('advagg_mod_css_defer', 4);
return t('The advagg_mod_css_defer_rel_preload variable has been deleted. The advagg_mod_css_defer variable has been set to a value of 4 (All in head, use link rel="preload"). You can adjust this value on the <a href="@url">AdvAgg Modifications page</a>', array(
'@url' => url('admin/config/development/performance/advagg/mod', array(
'fragment' => 'edit-advagg-mod-css-defer',
)),
));
}
else {
return t('The advagg_mod_css_defer_rel_preload variable has been deleted.');
}
}
/**
* Move advagg_mod_js_get_external_dns to advagg_mod_js_inline_resource_hints.
*/
function advagg_mod_update_7202(&$sandbox) {
$advagg_mod_js_inline_resource_hints = variable_get('advagg_mod_js_inline_resource_hints', NULL);
$advagg_mod_js_get_external_dns = variable_get('advagg_mod_js_get_external_dns', NULL);
if (is_null($advagg_mod_js_get_external_dns)) {
return t('Nothing needed to happen.');
}
variable_del('advagg_mod_js_get_external_dns');
if (!is_null($advagg_mod_js_inline_resource_hints) || empty($advagg_mod_js_inline_resource_hints)) {
return t('Nothing needed to happen.');
}
variable_set('advagg_mod_js_inline_resource_hints', $advagg_mod_js_inline_resource_hints);
return t('Variable has been moved.');
}
/**
* @} End of "addtogroup hooks".
*/
/**
* Implements hook_requirements().
*/
function advagg_mod_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time.
$t = get_t();
// If not at runtime, return here.
if ($phase !== 'runtime') {
return $requirements;
}
// Check version.
$lib_name = 'loadCSS';
$module_name = 'advagg_mod';
list($description, $info) = advagg_get_version_description($lib_name, $module_name);
if (!empty($description)) {
$requirements["{$module_name}_{$lib_name}_updates"] = array(
'title' => $t('@module_name', array(
'@module_name' => $info['name'],
)),
'severity' => REQUIREMENT_WARNING,
'value' => $t('The @name library needs to be updated.', array(
'@name' => $lib_name,
)),
'description' => $description,
);
}
return $requirements;
}
Functions
Name | Description |
---|---|
advagg_mod_install | Implements hook_install(). |
advagg_mod_requirements | Implements hook_requirements(). |
advagg_mod_update_7201 | Merge advagg_mod_css_defer_rel_preload into advagg_mod_css_defer. |
advagg_mod_update_7202 | Move advagg_mod_js_get_external_dns to advagg_mod_js_inline_resource_hints. |