Piwik\Plugins\PrivacyManager\Controller::getDeleteDataInfo PHP Метод

getDeleteDataInfo() защищенный Метод

protected getDeleteDataInfo ( )
    protected function getDeleteDataInfo()
    {
        Piwik::checkUserHasSuperUserAccess();
        $deleteDataInfos = array();
        $deleteDataInfos["config"] = PrivacyManager::getPurgeDataSettings();
        $deleteDataInfos["deleteTables"] = "<br/>" . implode(", ", LogDataPurger::getDeleteTableLogTables());
        /** @var Scheduler $scheduler */
        $scheduler = StaticContainer::getContainer()->get('Piwik\\Scheduler\\Scheduler');
        $scheduleTimetable = $scheduler->getScheduledTimeForMethod("PrivacyManager", "deleteLogTables");
        $optionTable = Option::get(self::OPTION_LAST_DELETE_PIWIK_LOGS);
        //If task was already rescheduled, read time from taskTimetable. Else, calculate next possible runtime.
        if (!empty($scheduleTimetable) && $scheduleTimetable - time() > 0) {
            $nextPossibleSchedule = (int) $scheduleTimetable;
        } else {
            $date = Date::factory("today");
            $nextPossibleSchedule = $date->addDay(1)->getTimestamp();
        }
        //deletion schedule did not run before
        if (empty($optionTable)) {
            $deleteDataInfos["lastRun"] = false;
            //next run ASAP (with next schedule run)
            $date = Date::factory("today");
            $deleteDataInfos["nextScheduleTime"] = $nextPossibleSchedule;
        } else {
            $deleteDataInfos["lastRun"] = $optionTable;
            $deleteDataInfos["lastRunPretty"] = Date::factory((int) $optionTable)->getLocalized(Date::DATE_FORMAT_SHORT);
            //Calculate next run based on last run + interval
            $nextScheduleRun = (int) ($deleteDataInfos["lastRun"] + $deleteDataInfos["config"]["delete_logs_schedule_lowest_interval"] * 24 * 60 * 60);
            //is the calculated next run in the past? (e.g. plugin was disabled in the meantime or something) -> run ASAP
            if ($nextScheduleRun - time() <= 0) {
                $deleteDataInfos["nextScheduleTime"] = $nextPossibleSchedule;
            } else {
                $deleteDataInfos["nextScheduleTime"] = $nextScheduleRun;
            }
        }
        $formatter = new Formatter();
        $deleteDataInfos["nextRunPretty"] = $formatter->getPrettyTimeFromSeconds($deleteDataInfos["nextScheduleTime"] - time());
        return $deleteDataInfos;
    }