def run(self): try: sql.initialize(config.MYSQL_CREDENTIALS) sql.update_site_ts_created(config.ID_SITE, config.CONFIG_START) google2piwik.export_period(config.CONFIG_START, config.CONFIG_END) except Exception as e: print "Error: ", e print "Please check the configuration you provided."
sql.check_site(config.ID_SITE) print "[OK]" except: print "[FAILED], site with idsite = %s wasn't found" % config.ID_SITE else: config.read_config(options.config_file) if not (options.start_date or config.CONFIG_START): print "Start date parameter is required. For more info type ./google2piwik.py -h" exit() start_date = read_date(options.start_date or config.CONFIG_START) end_date = None if not (options.end_date or config.CONFIG_END) else read_date(options.end_date or config.CONFIG_END) sql.initialize(config.MYSQL_CREDENTIALS) CURRENT_VERSION = sql.get_version(config.MYSQL_CREDENTIALS["table_prefix"]) if StrictVersion(CURRENT_VERSION) < StrictVersion('1.9'): CURRENT_VERSION = 1.8 else: CURRENT_VERSION = 1.9 if options.update_visit_actions: sql.update_total_visit_actions() exit() sql.update_site_ts_created(config.ID_SITE, start_date) export_period(start_date, end_date) sql.clear_archives() sql.close() print "Please go to your Piwik installation folder and run misc/cron/archive.sh script."