protected function updateDaily()
{
if (!$this->daily_data) {
$this->daily_data = $this->getData($this->daily_file);
}
$day_month_year = date(self::DAILY_FORMAT);
// get the daily access count
if (array_key_exists($day_month_year, $this->daily_data)) {
$this->daily_data[$day_month_year] = intval($this->daily_data[$day_month_year]) + 1;
} else {
$this->daily_data[$day_month_year] = 1;
}
// keep correct number as set by history
$count = intval($this->config->get('plugins.admin.popularity.history.daily', 30));
$total = count($this->daily_data);
if ($total > $count) {
$this->daily_data = array_slice($this->daily_data, -$count, $count, true);
}
file_put_contents($this->daily_file, json_encode($this->daily_data));
}