From 0ccff15953c8ad0b2cd8689771cef4a27e432d0e Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Thu, 18 Dec 2014 10:10:58 +1300 Subject: [PATCH 1/3] Removed calls to deprecated Log::setLogLevel() + normalized usage of the logger/CLI output --- Commands/MigrateSite.php | 22 +++------------------- Migrator/ArchiveMigrator.php | 2 +- Migrator/Migrator.php | 16 ++++++++-------- 3 files changed, 12 insertions(+), 28 deletions(-) diff --git a/Commands/MigrateSite.php b/Commands/MigrateSite.php index 96e643a..3eaf4f5 100644 --- a/Commands/MigrateSite.php +++ b/Commands/MigrateSite.php @@ -74,12 +74,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $config = Db::getDatabaseConfig(); $startTime = microtime(true); - try { - $this->createTargetDatabaseConfig($input, $output, $config); - } catch (\InvalidArgumentException $e) { - $output->writeln('' . $e->getMessage() . ''); - return; - } + $this->createTargetDatabaseConfig($input, $output, $config); $tmpConfig = $config; $sourceDb = Db::get(); @@ -89,14 +84,6 @@ protected function execute(InputInterface $input, OutputInterface $output) throw new \RuntimeException('Unable to connect to the target database: ' . $e->getMessage(), 0, $e); } - if ($output->getVerbosity() == OutputInterface::VERBOSITY_VERBOSE) { - Log::getInstance()->setLogLevel(Log::INFO); - } - - if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE) { - Log::getInstance()->setLogLevel(Log::VERBOSE); - } - $sourceDbHelper = new DBHelper($sourceDb, Db::getDatabaseConfig()); $migratorFacade = new Migrator( @@ -111,11 +98,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $endTime = microtime(true); - $output->writeln(sprintf(PHP_EOL . 'Time taken: %01.2f sec', $endTime - $startTime)); - $output->writeln(sprintf( - 'Peak memory usage: %01.2f MB', - memory_get_peak_usage(true) / 1048576 - )); + Log::debug(sprintf('Time taken: %01.2f sec', $endTime - $startTime)); + Log::debug(sprintf('Peak memory usage: %01.2f MB', memory_get_peak_usage(true) / 1048576)); } diff --git a/Migrator/ArchiveMigrator.php b/Migrator/ArchiveMigrator.php index 80e9ee1..d1445c1 100644 --- a/Migrator/ArchiveMigrator.php +++ b/Migrator/ArchiveMigrator.php @@ -59,7 +59,7 @@ public function migrate($siteId, \DateTime $from = null, \DateTime $to = null) $archives = $this->archiveLister->getArchiveList($from, $to); foreach ($archives as $archiveDate) { - Log::info('Migrating archive ' . $archiveDate); + Log::debug('Migrating archive ' . $archiveDate); $this->migrateArchive($archiveDate, 'archive_numeric_' . $archiveDate, $siteId); diff --git a/Migrator/Migrator.php b/Migrator/Migrator.php index 89f244c..fea328a 100644 --- a/Migrator/Migrator.php +++ b/Migrator/Migrator.php @@ -123,19 +123,19 @@ public function migrate() private function startTransaction() { - Log::warning('Start transaction'); + Log::info('Start transaction'); $this->targetDbHelper->startTransaction(); } private function commitTransaction() { - Log::warning('Commit transaction'); + Log::info('Commit transaction'); $this->targetDbHelper->commitTransaction(); } private function migrateSiteConfig() { - Log::warning('Migrating site config'); + Log::info('Migrating site config'); $this->siteMigrator->migrate( $this->getBatchProvider( @@ -158,14 +158,14 @@ private function migrateSiteConfig() private function loadActions() { - Log::warning('Loading existing actions'); + Log::info('Loading existing actions'); $this->actionMigrator->loadExistingActions(); } private function migrateLogVisits() { - Log::warning('Migrating log data - visits'); + Log::info('Migrating log data - visits'); $query = 'SELECT * FROM ' . $this->sourceDbHelper->prefixTable('log_visit') . ' WHERE idsite = ' . $this->settings->idSite; @@ -184,7 +184,7 @@ private function migrateLogVisits() private function migrateLogVisitActions() { - Log::warning('Migrating log data - link visit action'); + Log::info('Migrating log data - link visit action'); $queries = $this->getLogVisitQueriesFor('log_link_visit_action'); @@ -195,7 +195,7 @@ private function migrateLogVisitActions() private function migrateLogVisitConversions() { - Log::warning('Migrating log data - conversions and conversion items'); + Log::info('Migrating log data - conversions and conversion items'); $queries = $this->getLogVisitQueriesFor('log_conversion'); $itemQueries = $this->getLogVisitQueriesFor('log_conversion_item'); @@ -208,7 +208,7 @@ private function migrateLogVisitConversions() private function migrateArchives() { - Log::warning('Migrating archive data'); + Log::info('Migrating archive data'); $this->archiveMigrator->migrate($this->settings->idSite, $this->settings->dateFrom, $this->settings->dateTo); } From 8f51bec8401d657da069ee9402e071dadc3a7b42 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Thu, 18 Dec 2014 10:30:49 +1300 Subject: [PATCH 2/3] Updating travis.yml..... --- .travis.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a0a2fcf..a5a2a94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,9 @@ php: - 5.3.3 # - hhvm +services: + - redis-server + # Separate different test suites env: global: @@ -79,6 +82,9 @@ before_script: phpenv config-rm xdebug.ini; fi + # add always_populate_raw_post_data=-1 to php.ini + - echo "always_populate_raw_post_data=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + - ./tests/travis/configure_git.sh # print out mysql information @@ -88,8 +94,6 @@ before_script: # configure mysql - mysql -e "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES'" # Travis default - # Uncomment to enable sql_mode STRICT_TRANS_TABLES (new default in Mysql 5.6) - - mysql -e "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION'" - mysql -e "SELECT @@sql_mode;" - mysql -e "SHOW GLOBAL VARIABLES;" From 14b70687c6945e06f0a4739f32ec0fa0ddd3c9ff Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Mon, 22 Dec 2014 11:01:30 +1300 Subject: [PATCH 3/3] Changelog for 1.0.7 --- README.md | 6 +++++- plugin.json | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f970eea..78135a6 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,11 @@ No, you must run the command from the source Piwik server (the server which cont ## Changelog -**v1.0.5** +**v1.0.7** + +- Updated the plugin for compatibility with Piwik 2.10. + +**v1.0.6** - [#6](https://github.com/PiwikPRO/plugin-SiteMigration/issues/6): fixed a PHP 5.3 incompatibility diff --git a/plugin.json b/plugin.json index 65ef5fc..47c3e92 100644 --- a/plugin.json +++ b/plugin.json @@ -1,6 +1,6 @@ { "name": "SiteMigration", - "version": "1.0.6", + "version": "1.0.7", "description": "Migrate site and site data between Piwik installations", "keywords": ["migration", "import", "export"], "homepage": "https://github.com/PiwikPRO/plugin-SiteMigration", @@ -9,7 +9,7 @@ "license_page": "http://www.gnu.org/licenses/gpl.html", "require": { "php": ">=5.3.0", - "piwik": ">=2.9.1" + "piwik": ">=2.10.0-b10" }, "authors": [ {