diff options
author | diosmosis <benaka@piwik.pro> | 2015-03-11 14:44:44 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-03-11 14:44:44 +0300 |
commit | e477518993e1c59dc36f0c05d22dcf85942d4e07 (patch) | |
tree | 7a97e96fcbcdd1d81f4de1e4f1431141d11dc510 /plugins | |
parent | a1388b84ba44fb67b21b735ffe3b38060c0e94f9 (diff) |
Merge RawLogFetcher and RawLogUpdater to RawLogDao.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/UserCountry/Commands/AttributeHistoricalDataWithLocations.php | 25 | ||||
-rw-r--r-- | plugins/UserCountry/tests/System/AttributeHistoricalDataWithLocationsTest.php | 3 |
2 files changed, 9 insertions, 19 deletions
diff --git a/plugins/UserCountry/Commands/AttributeHistoricalDataWithLocations.php b/plugins/UserCountry/Commands/AttributeHistoricalDataWithLocations.php index dc2221573f..fa703e85bc 100644 --- a/plugins/UserCountry/Commands/AttributeHistoricalDataWithLocations.php +++ b/plugins/UserCountry/Commands/AttributeHistoricalDataWithLocations.php @@ -8,12 +8,11 @@ */ namespace Piwik\Plugins\UserCountry\Commands; -use Piwik\DataAccess\RawLogUpdater; use Piwik\Network\IPUtils; use Piwik\Plugin\ConsoleCommand; use Piwik\Plugins\UserCountry\VisitorGeolocator; use Piwik\Plugins\UserCountry\LocationProvider; -use Piwik\DataAccess\RawLogFetcher; +use Piwik\DataAccess\RawLogDao; use Piwik\Timer; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -41,14 +40,9 @@ class AttributeHistoricalDataWithLocations extends ConsoleCommand ); /** - * @var RawLogFetcher + * @var RawLogDao */ - protected $fetcher; - - /** - * @var RawLogUpdater - */ - protected $updater; + protected $dao; /** * @var VisitorGeolocator @@ -80,12 +74,11 @@ class AttributeHistoricalDataWithLocations extends ConsoleCommand */ private $processedPercent = 0; - public function __construct(RawLogFetcher $fetcher = null, RawLogUpdater $updater = null) + public function __construct(RawLogDao $dao = null) { parent::__construct(); - $this->fetcher = $fetcher ?: new RawLogFetcher(); - $this->updater = $updater ?: new RawLogUpdater(); + $this->dao = $dao ?: new RawLogDao(); } protected function configure() @@ -113,7 +106,7 @@ class AttributeHistoricalDataWithLocations extends ConsoleCommand $this->visitorGeolocator = $this->createGeolocator($input); $this->percentStep = $this->getPercentStep($input); - $this->amountOfVisits = $this->fetcher->countVisitsWithDatesLimit($from, $to); + $this->amountOfVisits = $this->dao->countVisitsWithDatesLimit($from, $to); $output->writeln( sprintf('Re-attribution for date range: %s to %s. %d visits to process with provider "%s".', @@ -135,7 +128,7 @@ class AttributeHistoricalDataWithLocations extends ConsoleCommand $lastId = 0; do { - $logs = $this->fetcher->getVisitsWithDatesLimit($from, $to, $visitFieldsToSelect, $lastId, $segmentLimit); + $logs = $this->dao->getVisitsWithDatesLimit($from, $to, $visitFieldsToSelect, $lastId, $segmentLimit); if (!empty($logs)) { $lastId = $logs[count($logs) - 1]['idvisit']; @@ -163,8 +156,8 @@ class AttributeHistoricalDataWithLocations extends ConsoleCommand } else { $this->writeIfVerbose($output, 'Updating visit with idvisit = ' . $idVisit . '.'); - $this->updater->updateVisits($valuesToUpdate, $idVisit); - $this->updater->updateConversions($valuesToUpdate, $idVisit); + $this->dao->updateVisits($valuesToUpdate, $idVisit); + $this->dao->updateConversions($valuesToUpdate, $idVisit); } } } diff --git a/plugins/UserCountry/tests/System/AttributeHistoricalDataWithLocationsTest.php b/plugins/UserCountry/tests/System/AttributeHistoricalDataWithLocationsTest.php index ec35e4657c..622f40d9c6 100644 --- a/plugins/UserCountry/tests/System/AttributeHistoricalDataWithLocationsTest.php +++ b/plugins/UserCountry/tests/System/AttributeHistoricalDataWithLocationsTest.php @@ -10,12 +10,9 @@ namespace Piwik\Plugins\UserCountry\Test\Integration; use Piwik\Common; use Piwik\Db; -use Piwik\Network\IPUtils; -use Piwik\Piwik; use Piwik\Plugins\UserCountry\Commands\AttributeHistoricalDataWithLocations; use Piwik\Tests\Fixtures\ManyVisitsWithGeoIP; use Piwik\Tests\Framework\TestCase\IntegrationTestCase; -use Piwik\Translate; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; |