function system_cron

7.x system.module system_cron()
6.x system.module system_cron()
5.x system.module system_cron()

Implementation of hook_cron

We will perform operations necessary for keep FlightPath's tables in shape.

File

modules/system/system.module, line 2067

Code

function system_cron() {

  // Should we "trim" the watchdog table of old entries?
  $max_age_days = variable_get("max_watchdog_age", "548");
  if ($max_age_days != "never" && ($max_age_days * 1) > 0) {

    // Okay, let's trim the table.
    $max_timestamp = strtotime("$max_age_days DAYS AGO");

    $result = db_query("DELETE FROM watchdog WHERE `timestamp` < ? ", $max_timestamp);
    $rows = db_affected_rows($result);
    if ($rows > 0) {
      watchdog("system", t("@rows old rows (older than @max days) trimmed from watchdog table on system cron run.", array("@rows" => $rows, "@max" => $max_age_days)));
    }

  }



}