You are here

function optimizedb_hide_notification in OptimizeDB 7

Same name and namespace in other branches
  1. 6 optimizedb.module \optimizedb_hide_notification()

Page hide notification.

1 string reference to 'optimizedb_hide_notification'
optimizedb_menu in ./optimizedb.module
Implements hook_menu().

File

./optimizedb.module, line 293
Database Optimization.

Code

function optimizedb_hide_notification() {
  if ($message = optimizedb_check_works()) {
    return $message;
  }
  $time = REQUEST_TIME;
  $notify_optimize = variable_get('optimizedb_notify_optimize', FALSE);

  // There is a need to disable the notification?
  if ($notify_optimize) {
    variable_set('optimizedb_notify_optimize', FALSE);

    // If the notification of the need to optimize hiding, so she runs.
    variable_set('optimizedb_last_optimization', $time);
    $optimization_period = (int) variable_get('optimizedb_optimization_period', 0);
    $time_next_optimization = strtotime('+ ' . $optimization_period . ' day', $time);
    drupal_set_message(t('The following message on the need to perform optimization, you get - @date.', array(
      '@date' => format_date($time_next_optimization),
    )));
  }
  else {
    drupal_set_message(t('Alerts are not available.'));
  }
  return '';
}