public function invalidateArchivedReports($idSites, $dates, $period = false, $segment = false, $cascadeDown = false)
    {
        $idSites = Site::getIdSitesFromIdSitesString($idSites);
        if (empty($idSites)) {
            throw new Exception("Specify a value for &idSites= as a comma separated list of website IDs, for which your token_auth has 'admin' permission");
        }

        Piwik::checkUserHasAdminAccess($idSites);

        if (!empty($segment)) {
            $segment = new Segment($segment, $idSites);
        } else {
            $segment = null;
        }

        list($dateObjects, $invalidDates) = $this->getDatesToInvalidateFromString($dates);

        $invalidationResult = $this->invalidator->markArchivesAsInvalidated($idSites, $dateObjects, $period, $segment, (bool)$cascadeDown);

        $output = $invalidationResult->makeOutputLogs();
        if ($invalidDates) {
            $output[] = 'Warning: some of the Dates to invalidate were invalid: ' .
                implode(", ", $invalidDates) . ". Matomo simply ignored those and proceeded with the others.";
        }

        Site::clearCache(); // TODO: is this needed? it shouldn't be needed...

        return $invalidationResult->makeOutputLogs();
    }