PHP Class Piwik\Plugins\PrivacyManager\PrivacyManager

Inheritance: extends Piwik\Plugin
Show file Open project: piwik/piwik Class Usage Examples

Public Properties

Property Type Description
$purgeDataOptions options for data purging feature array[configName => configSection]

Public Methods

Method Description
__construct ( ) Constructor.
deleteLogData ( ) Deletes old log 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.
deleteReportData ( ) Deletes old archived data (reports & metrics).
getAllMetricsToKeep ( ) Returns the names of metrics that should be kept when purging as they appear in archive tables.
getClientSideTranslationKeys ( &$translationKeys )
getDeleteIntervalInSeconds ( $deleteInterval )
getJsFiles ( &$jsFiles )
getPurgeDataSettings ( ) : array Returns the settings for the data purging feature.
getPurgeEstimate ( array $settings = null ) : array Returns an array describing what data would be purged if both log data & report purging is invoked.
hasReportBeenPurged ( Piwik\DataTable\DataTableInterface $dataTable ) : boolean Returns true if it is likely that the data for this report has been purged and if the user should be told about that.
installationFormInit ( Piwik\Plugins\Installation\FormDefaultSettings $form ) Customize the Installation "default settings" form.
installationFormSubmit ( Piwik\Plugins\Installation\FormDefaultSettings $form ) Process the submit on the Installation "default settings" form.
registerEvents ( )
savePurgeDataSettings ( array $settings ) Saves the supplied data purging settings.
setTrackerCacheGeneral ( &$cacheContent )
shouldReportBePurged ( integer $reportDateYear, integer $reportDateMonth, integer | Date $reportsOlderThan = null ) : boolean Returns true if a report with the given year & month should be purged or not.

Private Methods

Method Description
getGoalMetricsToKeep ( ) Returns the goal metrics to keep when the 'delete_reports_keep_basic_metrics' config is set to 1.
getMaxGoalId ( )
getMetricsToKeep ( ) Returns the general metrics to keep when the 'delete_reports_keep_basic_metrics' config is set to 1.
shouldPurgeData ( $settings, $lastRanOption ) Returns true if one of the purge data tasks should run now, false if it shouldn't.

Method Details

__construct() public method

Constructor.
public __construct ( )

deleteLogData() public method

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 log data is considered old.
public deleteLogData ( )

deleteReportData() public method

Archive tables are not optimized after, as that is handled by a separate scheduled task in CoreAdminHome. 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_reports_enable is set to 1, old archive data is deleted. The following config options can tweak this behavior: - delete_reports_older_than: The number of months after which archive data is considered old. The current month is not considered when applying this value. - delete_reports_keep_basic_metrics: If set to 1, keeps certain metric data. Right now, all metric data is kept. - delete_reports_keep_day_reports: If set to 1, keeps old daily reports. - delete_reports_keep_week_reports: If set to 1, keeps old weekly reports. - delete_reports_keep_month_reports: If set to 1, keeps old monthly reports. - delete_reports_keep_year_reports: If set to 1, keeps old yearly reports.
public deleteReportData ( )

getAllMetricsToKeep() public static method

Returns the names of metrics that should be kept when purging as they appear in archive tables.
public static getAllMetricsToKeep ( )

getClientSideTranslationKeys() public method

public getClientSideTranslationKeys ( &$translationKeys )

getDeleteIntervalInSeconds() public method

public getDeleteIntervalInSeconds ( $deleteInterval )

getJsFiles() public method

public getJsFiles ( &$jsFiles )

getPurgeDataSettings() public static method

Returns the settings for the data purging feature.
public static getPurgeDataSettings ( ) : array
return array

getPurgeEstimate() public static method

The returned array maps table names with the number of rows that will be deleted. If the table name is mapped with -1, the table will be dropped.
public static getPurgeEstimate ( array $settings = null ) : array
$settings array The config options to use in the estimate. If null, the real options are used.
return array

hasReportBeenPurged() public static method

In order for this function to return true, the following must also be true: - The data table for this report must either be empty or not have been fetched. - The period of this report is not a multiple period. - The date of this report must be older than the delete_reports_older_than config option.
public static hasReportBeenPurged ( Piwik\DataTable\DataTableInterface $dataTable ) : boolean
$dataTable Piwik\DataTable\DataTableInterface
return boolean

installationFormInit() public method

Customize the Installation "default settings" form.
public installationFormInit ( Piwik\Plugins\Installation\FormDefaultSettings $form )
$form Piwik\Plugins\Installation\FormDefaultSettings

installationFormSubmit() public method

Process the submit on the Installation "default settings" form.
public installationFormSubmit ( Piwik\Plugins\Installation\FormDefaultSettings $form )
$form Piwik\Plugins\Installation\FormDefaultSettings

registerEvents() public method

See also: Piwik\Plugin::registerEvents
public registerEvents ( )

savePurgeDataSettings() public static method

Saves the supplied data purging settings.
public static savePurgeDataSettings ( array $settings )
$settings array The settings to save.

setTrackerCacheGeneral() public method

public setTrackerCacheGeneral ( &$cacheContent )

shouldReportBePurged() public static method

If reportsOlderThan is set to null or not supplied, this function will check if a report should be purged, based on existing configuration. In this case, if delete_reports_enable is set to 0, this function will return false.
public static shouldReportBePurged ( integer $reportDateYear, integer $reportDateMonth, integer | Date $reportsOlderThan = null ) : boolean
$reportDateYear integer The year of the report in question.
$reportDateMonth integer The month of the report in question.
$reportsOlderThan integer | Piwik\Date If an int, the number of months a report must be older than in order to be purged. If a date, the date a report must be older than in order to be purged.
return boolean

Property Details

$purgeDataOptions public static property

options for data purging feature array[configName => configSection]
public static $purgeDataOptions