You are here

function _minify_js_revert_callback in Minify 7

Helper function to remove minified js from cache

1 string reference to '_minify_js_revert_callback'
minify_menu in ./minify.module
Implements hook_menu()

File

./minify.admin.inc, line 332

Code

function _minify_js_revert_callback() {
  $cache_data = variable_get('minify_captured_js', array());
  if (!empty($cache_data)) {
    $key = $_GET['file'];
    if (isset($cache_data[$key])) {

      /* Reset cache data record to prevent use of minified js */
      $minified_file_path = $cache_data[$key]['minified_file_path'];
      $cache_data[$key]['minified_file_path'] = null;
      $cache_data[$key]['minified_size'] = 0;
      $cache_data[$key]['status'] = false;
      $cache_data[$key]['last_minify_at'] = 0;
      $cache_data[$key]['error'] = false;
      $cache_data[$key]['error_msg'] = null;
      $cache_data[$key]['skip'] = false;
      $cache_data[$key]['md5'] = null;
      variable_set('minify_captured_js', $cache_data);

      /* delete the file */
      drupal_unlink($minified_file_path);
      $file_name = $cache_data[$key]['file_name'];
      watchdog('minify', '%file_name reverted successfully.', array(
        '%file_name' => $file_name,
      ), WATCHDOG_NOTICE);
      drupal_set_message(t('%file_name reverted successfully.', array(
        '%file_name' => $file_name,
      )));
    }
  }
  drupal_goto('admin/config/development/performance/minifyjs');
}