You are here

function advagg_admin_regenerate_htaccess_button in Advanced CSS/JS Aggregation 7.2

Recreate the advagg htaccess files.

Related topics

1 string reference to 'advagg_admin_regenerate_htaccess_button'
advagg_admin_operations_form in ./advagg.admin.inc
Form builder; Do advagg operations.

File

./advagg.admin.inc, line 1554
Admin page callbacks for the advanced CSS/JS aggregation module.

Code

function advagg_admin_regenerate_htaccess_button() {

  // Get paths to .htaccess file.
  list($css_path, $js_path) = advagg_get_root_files_dir();
  $files['css'] = $css_path[0] . '/.htaccess';
  $files['js'] = $js_path[0] . '/.htaccess';

  // Make the advagg_htaccess_check_generate() function available.
  module_load_include('inc', 'advagg', 'advagg.missing');

  // Generate new .htaccess files in advagg dirs.
  $errors = array();
  foreach ($files as $type => $uri) {
    $errors += advagg_htaccess_check_generate(array(
      $uri => $type,
    ), $type, TRUE);
  }
  if (empty($errors)) {
    drupal_set_message(t('The .htaccess files have been regenerated.'));
  }
  else {
    drupal_set_message(t('The .htaccess files failed to be regenerated. @errors', array(
      '@errors' => implode(', ', $errors),
    )));
  }
}