You are here

function performance_caching_message in Performance Logging and Monitoring 6

Same name and namespace in other branches
  1. 6.2 performance.module \performance_caching_message()
  2. 7.2 performance.module \performance_caching_message()
  3. 7 performance.module \performance_caching_message()

Display message on settings form.

1 call to performance_caching_message()
performance_settings_form in ./performance.module
System settings form.

File

./performance.module, line 275
Logs detailed and/or summary page generation time and memory consumption for page requests. Copyright Khalid Baheyeldin 2008 of http://2bits.com

Code

function performance_caching_message() {
  $caches = $available = array();
  $type = 'error';
  foreach (performance_data_stores() as $store => $data) {
    if (call_user_func('performance_enabled_' . $store, TRUE, TRUE) && $data['#prod_use']) {
      $caches[] = $data['#name'];
      $type = 'status';
    }
    else {
      if ($data['#prod_use']) {
        $available[] = $data['#name'];
      }
    }
  }
  if (count($caches) > 0) {
    $message = t('%stores enabled. It is reasonably safe to enable summary logging on live sites.', array(
      '%stores' => implode(' + ', $caches),
    ));
  }
  else {
    $message = t('None of the available data stores (%stores) are enabled. It is <strong>not</strong> safe to enable summary logging to the database on live sites!', array(
      '%stores' => implode(', ', $available),
    ));
  }
  drupal_set_message($message, $type, FALSE);
}