public function deleteLogData()
    {
        $settings = self::getPurgeDataSettings();

        // Make sure, data deletion is enabled
        if ($settings['delete_logs_enable'] == 0) {
            return false;
        }

        // make sure purging should run at this time
        if (!$this->shouldPurgeData($settings, self::OPTION_LAST_DELETE_PIWIK_LOGS, 'delete_logs_schedule_lowest_interval')) {
            return false;
        }

        /*
         * Tell the DB that log deletion has run BEFORE deletion is executed;
         * If deletion / table optimization exceeds execution time, other tasks maybe prevented of being executed
         * every time, when the schedule is triggered.
         */
        $lastDeleteDate = Date::factory("today")->getTimestamp();
        Option::set(self::OPTION_LAST_DELETE_PIWIK_LOGS, $lastDeleteDate);

        $shouldDeleteUnusedLogActions = $this->shouldPurgeData($settings, self::OPTION_LAST_DELETE_UNUSED_LOG_ACTIONS, 'delete_logs_unused_actions_schedule_lowest_interval');
        if ($shouldDeleteUnusedLogActions) {
            Option::set(self::OPTION_LAST_DELETE_UNUSED_LOG_ACTIONS, $lastDeleteDate);
        }

        // execute the purge
        /** @var LogDataPurger $logDataPurger */
        $logDataPurger = StaticContainer::get('Piwik\Plugins\PrivacyManager\LogDataPurger');
        $logDataPurger->purgeData($settings['delete_logs_older_than'], $shouldDeleteUnusedLogActions);

        return true;
    }
public function deleteLogData()
    {
        $settings = self::getPurgeDataSettings();

        // Make sure, data deletion is enabled
        if ($settings['delete_logs_enable'] == 0) {
            return false;
        }

        // make sure purging should run at this time
        if (!$this->shouldPurgeData($settings, self::OPTION_LAST_DELETE_PIWIK_LOGS, 'delete_logs_schedule_lowest_interval')) {
            return false;
        }

        /*
         * Tell the DB that log deletion has run BEFORE deletion is executed;
         * If deletion / table optimization exceeds execution time, other tasks maybe prevented of being executed
         * every time, when the schedule is triggered.
         */
        $lastDeleteDate = Date::factory("today")->getTimestamp();
        Option::set(self::OPTION_LAST_DELETE_PIWIK_LOGS, $lastDeleteDate);

        $shouldDeleteUnusedLogActions = $this->shouldPurgeData($settings, self::OPTION_LAST_DELETE_UNUSED_LOG_ACTIONS, 'delete_logs_unused_actions_schedule_lowest_interval');
        if ($shouldDeleteUnusedLogActions) {
            Option::set(self::OPTION_LAST_DELETE_UNUSED_LOG_ACTIONS, $lastDeleteDate);
        }

        // execute the purge
        /** @var LogDataPurger $logDataPurger */
        $logDataPurger = StaticContainer::get('Piwik\Plugins\PrivacyManager\LogDataPurger');
        $logDataPurger->purgeData($settings['delete_logs_older_than'], $shouldDeleteUnusedLogActions);

        return true;
    }
public function deleteLogData ( ) { $ settings = self :: getPurgeDataSettings ( ) ; // Make sure, data deletion is enabled if ( $ settings [ 'delete_logs_enable' ] == 0 ) { return false ; } // make sure purging should run at this time if ( ! $ this -> shouldPurgeData ( $ settings , self :: OPTION_LAST_DELETE_PIWIK_LOGS , 'delete_logs_schedule_lowest_interval' ) ) { return false ; } /*
         * Tell the DB that log deletion has run BEFORE deletion is executed;
         * If deletion / table optimization exceeds execution time, other tasks maybe prevented of being executed
         * every time, when the schedule is triggered.
         */ $ lastDeleteDate = Date :: factory ( "today" ) -> getTimestamp ( ) ; Option :: set ( self :: OPTION_LAST_DELETE_PIWIK_LOGS , $ lastDeleteDate ) ; $ shouldDeleteUnusedLogActions = $ this -> shouldPurgeData ( $ settings , self :: OPTION_LAST_DELETE_UNUSED_LOG_ACTIONS , 'delete_logs_unused_actions_schedule_lowest_interval' ) ; if ( $ shouldDeleteUnusedLogActions ) { Option :: set ( self :: OPTION_LAST_DELETE_UNUSED_LOG_ACTIONS , $ lastDeleteDate ) ; } // execute the purge /** @var LogDataPurger $logDataPurger */ $ logDataPurger = StaticContainer :: get ( 'Piwik\Plugins\PrivacyManager\LogDataPurger' ) ; $ logDataPurger -> purgeData ( $ settings [ 'delete_logs_older_than' ] , $ shouldDeleteUnusedLogActions ) ; return true ; }
Deletes old raw data based on the options set in the Deletelogs config
section. This is a scheduled task and will only execute every N days. The number
of days is determined by the delete_logs_schedule_lowest_interval config option.

If delete_logs_enable is set to 1, old data in the log_visit, log_conversion,
log_conversion_item and log_link_visit_action tables is deleted. The following
options can tweak this behavior:
- delete_logs_older_than: The number of days after which raw data is considered old.

@ToDo: return number of Rows deleted in last run; Display age of "oldest" row to help the user setting
the day offset;
Deletes old raw data based on the options set in the Deletelogs config section . This is a scheduled task and will only execute every N days . The number of days is determined by the delete_logs_schedule_lowest_interval config option .