Piwik\Plugins\PrivacyManager\PrivacyManager::getAllMetricsToKeep PHP Method

getAllMetricsToKeep() public static method

Returns the names of metrics that should be kept when purging as they appear in archive tables.
public static getAllMetricsToKeep ( )
    public static function getAllMetricsToKeep()
    {
        $metricsToKeep = self::getMetricsToKeep();
        // convert goal metric names to correct archive names
        if (Common::isGoalPluginEnabled()) {
            $goalMetricsToKeep = self::getGoalMetricsToKeep();
            $maxGoalId = self::getMaxGoalId();
            // for each goal metric, there's a different name for each goal, including the overview,
            // the order report & cart report
            foreach ($goalMetricsToKeep as $metric) {
                for ($i = 1; $i <= $maxGoalId; ++$i) {
                    $metricsToKeep[] = Archiver::getRecordName($metric, $i);
                }
                $metricsToKeep[] = Archiver::getRecordName($metric);
                $metricsToKeep[] = Archiver::getRecordName($metric, GoalManager::IDGOAL_ORDER);
                $metricsToKeep[] = Archiver::getRecordName($metric, GoalManager::IDGOAL_CART);
            }
        }
        return $metricsToKeep;
    }

Usage Example

Example #1
0
 /**
  * Executes a data purge, deleting log data and report data using the current config
  * options. Echo's the result of getDatabaseSize after purging.
  */
 public function executeDataPurge()
 {
     $this->checkDataPurgeAdminSettingsIsEnabled();
     Piwik::checkUserHasSuperUserAccess();
     $this->checkTokenInUrl();
     // if the request isn't a POST, redirect to index
     if ($_SERVER["REQUEST_METHOD"] != "POST" && !Common::isPhpCliMode()) {
         $this->redirectToIndex('PrivacyManager', 'privacySettings');
         return;
     }
     $settings = PrivacyManager::getPurgeDataSettings();
     if ($settings['delete_logs_enable']) {
         /** @var LogDataPurger $logDataPurger */
         $logDataPurger = StaticContainer::get('Piwik\\Plugins\\PrivacyManager\\LogDataPurger');
         $logDataPurger->purgeData($settings['delete_logs_older_than']);
     }
     if ($settings['delete_reports_enable']) {
         $reportsPurger = ReportsPurger::make($settings, PrivacyManager::getAllMetricsToKeep());
         $reportsPurger->purgeData(true);
     }
 }
All Usage Examples Of Piwik\Plugins\PrivacyManager\PrivacyManager::getAllMetricsToKeep