Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #6785, #7180 add log delete command and make log deletion delete only based on time and not idvisit. #7887

Merged
merged 37 commits into from Jun 16, 2015

Conversation

diosmosis
Copy link
Member

This PR fixes #6785 and #7180. It introduces a new logs:delete command and makes all visit deletion (including the log data purger used by PrivacyManager) visit based on required criteria instead of the max idvisit.

List of changes:

  • New LogDeleter service that is used by logs:delete and LogDataPurger in PrivacyManager.
  • New method in RawLogDao that iterates over log tables based on a set of criteria. The criteria is an array describing a list of SQL conditions. I think this should be replaced eventually by a segment string, since they do the same thing, but that would require more platform infrastructure than Piwik currently has.
  • The new method in RawLogDao is used by the usercountry:attribute command. The looping logic was also moved to VisitorGeolocator, a late finishing touch for the command.
  • Removed the testing hack from LogDataPurger. Originally, to test a concurrency issue, two events were fired in LogDataPurger. Now, we use DI.
  • I added the ability to override DI config in IntegrationTestCase descendants.
  • I moved log inserting test code from VisitorGeolocatorTest to a new LogHelper class (in Piwik\Tests\Framework) and re-used for testing LogDeleter.
  • Moved the unused log action deletion methods to RawLogDao.

TODO:

@diosmosis diosmosis added the Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. label May 12, 2015
@diosmosis diosmosis self-assigned this May 12, 2015
@diosmosis diosmosis added this to the 2.14.0 milestone May 12, 2015
@diosmosis diosmosis added Needs Review PRs that need a code review and removed Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. labels May 15, 2015
@mattab
Copy link
Member

mattab commented May 27, 2015

@diosmosis Sorry for the delay in getting to review this. This Pull request is high value and fixes a major bug that can lead to data loss 👍

Can you rebase it (I think work done in #7964 is relevant to this PR). After rebase let me know I will review and possibly merge. thanks

@diosmosis
Copy link
Member Author

@mattab The rebase was very complicated, tests may not pass (will have to check tomorrow). Please do a thorough review.

diosmosis added 21 commits June 10, 2015 23:42
…rator, and add options to delete:logs command.
…e in usercountry:attribute command. usercountry:attribute tests pass.
…n will cascade. Implement LogPurger service using different strategy from LogDataPurger (which can result in error).
…ony issue w/ using mock interactive input streams. If the posix_isatty function exists, the interactive flag set by ApplicationTester will be overridden by Application::configureIO.
…er plugin, Rename LogPurger to LogDeleter, add test for VisitorGeolocator::reattributeVisits and add empty tests for LogDeleter service.
…tion step size to constructor so it can potentially be conifgured via DI, remove some unneeded TODOs.
…LogHelper and add quick class docs to LogHelper.
@mattab mattab assigned mattab and unassigned diosmosis Jun 11, 2015
@@ -86,6 +88,15 @@ public function setUp()
self::restoreDbTables(self::$tableData);
}

$extraDefinitions = $this->provideContainerConfig();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change expected to be in this pull request (it seems unrelated). Either way, if the code is correct, it's fine to have it here, just double checking

@mattab
Copy link
Member

mattab commented Jun 16, 2015

Looks good to me: cleaning up some tech debt, adding useful new command and fixing possibly major bug all at once. Took me long time to review it and test it but my tests worked 👍

mattab pushed a commit that referenced this pull request Jun 16, 2015
Fixes #6785, #7180 add log delete command and make log deletion delete only based on time and not idvisit.
@mattab mattab merged commit 36529f5 into master Jun 16, 2015
diosmosis pushed a commit that referenced this pull request Jun 16, 2015
@diosmosis diosmosis deleted the 6785_log_delete_command branch June 16, 2015 07:51
@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Jun 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants