Same name and namespace in other branches
  1. 7.x-1.x advagg_js_compress/advagg_js_compress.install \advagg_js_compress_requirements() 1 commentaire

Implements hook_requirements().

Fichier

advagg_js_compress/advagg_js_compress.install, line 16

Code

function advagg_js_compress_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;
    }
    // Make sure a compressor is being used.
    if (variable_get('advagg_js_compressor', ADVAGG_JS_COMPRESSOR) == 0 && variable_get('advagg_js_compress_inline', ADVAGG_JS_COMPRESS_INLINE) == 0) {
        // Check all files.
        $file_settings = variable_get('advagg_js_compressor_file_settings', array());
        $compression_used = FALSE;
        foreach ($file_settings as $setting) {
            if (!empty($setting)) {
                $compression_used = TRUE;
                break;
            }
        }
        if (!$compression_used) {
            $config_path = advagg_admin_config_root_path();
            $requirements['advagg_js_compress_not_on'] = array(
                'title' => $t('AdvAgg JS Compressor'),
                'severity' => REQUIREMENT_WARNING,
                'value' => $t('AdvAgg JS Compression is disabled.'),
                'description' => $t('Go to the <a href="@settings">advagg js compress settings page</a> and select a compressor, or go to the <a href="@modules">modules page</a> and disable the "AdvAgg Compress Javascript" module.', array(
                    '@settings' => url($config_path . '/advagg/js-compress'),
                    '@modules' => url('admin/modules', array(
                        'fragment' => 'edit-modules-advanced-cssjs-aggregation',
                    )),
                )),
            );
        }
    }
    $requirements += advagg_js_compress_check_cache_bin();
    return $requirements;
}