You are here

function _advagg_admin_settings_cache in Advanced CSS/JS Aggregation 7

1 call to _advagg_admin_settings_cache()
advagg_advagg_admin_form in includes/admin.inc
Implements hook_advagg_admin_form(). @see: advagg_form_system_performance_settings_alter().

File

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

Code

function _advagg_admin_settings_cache(&$form, &$form_state) {
  $bundle_count = db_query("SELECT COUNT(*) FROM (SELECT bundle_md5 FROM {advagg_bundles} GROUP BY bundle_md5) as temp")
    ->fetchField();
  $callbacks = array(
    'advagg_admin_flush_cache_button' => array(
      '#value' => t('Flush AdvAgg Cache'),
      '#description' => t('Scan all files referenced in aggregated files. If any of them have changed, increment the counters containing that file and rebuild the bundle.'),
    ),
    'advagg_admin_batch_rebuild' => array(
      '#value' => t('Increment Counters'),
      '#description' => t('Recreate all aggregated files by incrementing internal counter for every bundle. %count Files', array(
        '%count' => $bundle_count,
      )),
    ),
    'advagg_admin_master_reset' => array(
      '#value' => t('Master Reset'),
      '#description' => t('Clean Slate - Truncate all advagg tables and delete all advagg files. Useful for testing purposes. Running this on a production site is not a good idea.'),
    ),
    'advagg_admin_recreate_htaccess' => array(
      '#value' => t('Recreate htaccess files'),
      '#description' => t('This will recreate the htaccess files located in the advagg_* directories.'),
    ),
    'advagg_admin_toggle_bypass_cookie' => array(
      '#value' => t('Toggle By-Pass Cookie'),
      '#description' => t('This will set or remove a cookie that disables aggregation for the remainder of this browser session.'),
    ),
  );

  // Generate dynamic buttons.
  foreach ($callbacks as $callback => $data) {
    $form[$callback] = array(
      '#type' => 'submit',
      '#value' => $data['#value'],
      '#prefix' => '<div style="clear: both; float: left; margin-bottom: 20px; width: 100%;">',
      '#suffix' => '<div class="description" style="margin-bottom: 20px; overflow: auto;">' . $data['#description'] . '</div></div>',
      '#attributes' => array(
        'style' => 'float: left; margin-right: 10px; min-width: 200px;',
      ),
      '#submit' => array(
        $callback,
      ),
    );
  }
}