Piwik\Plugins\PrivacyManager\PrivacyManager::shouldPurgeData PHP Method

shouldPurgeData() private method

Returns true if one of the purge data tasks should run now, false if it shouldn't.
private shouldPurgeData ( $settings, $lastRanOption )
    private function shouldPurgeData($settings, $lastRanOption)
    {
        // Log deletion may not run until it is once rescheduled (initial run). This is the
        // only way to guarantee the calculated next scheduled deletion time.
        $initialDelete = Option::get(self::OPTION_LAST_DELETE_PIWIK_LOGS_INITIAL);
        if (empty($initialDelete)) {
            Option::set(self::OPTION_LAST_DELETE_PIWIK_LOGS_INITIAL, 1);
            return false;
        }
        // Make sure, log purging is allowed to run now
        $lastDelete = Option::get($lastRanOption);
        $deleteIntervalDays = $settings['delete_logs_schedule_lowest_interval'];
        $deleteIntervalSeconds = $this->getDeleteIntervalInSeconds($deleteIntervalDays);
        if ($lastDelete === false || $lastDelete !== false && (int) $lastDelete + $deleteIntervalSeconds <= time()) {
            return true;
        } else {
            return false;
        }
    }