You are here

function mostpopular_clear_caches in Drupal Most Popular 6

Clears all of the cached values from services, and resets the last time the service was run to 0.

Parameters

integer $sid: The service ID. If null, all services will be cleared.

integer $iid: The interval ID. If null, all intervals will be cleared.

2 calls to mostpopular_clear_caches()
mostpopular_intervals_form_submit in ./mostpopular.admin.inc
mostpopular_services_form_submit in ./mostpopular.admin.inc

File

./mostpopular.api.php, line 171
Provides functions for other modules to use to interact with the Most Popular data.

Code

function mostpopular_clear_caches($sid = NULL, $iid = NULL) {
  MostPopularService::clear();
  MostPopularLastRun::clear();
  MostPopularLastRun::resetLastRun($sid, $iid);
  MostPopularItem::reset($sid, $iid);
  drupal_set_message(t('The most popular caches have been cleared for %service and %interval. ' . 'You should refresh the stats.', array(
    '%service' => empty($sid) ? 'all services' : MostPopularService::fetch($sid)->title,
    '%interval' => empty($iid) ? 'all intervals' : MostPopularInterval::fetch($iid)->title,
  )));
}