diff options
author | sgiehl <stefan@piwik.org> | 2016-05-16 17:02:08 +0300 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2016-05-16 17:02:08 +0300 |
commit | 6c1e669e2649d3e0863264c144aa4a8f736783fe (patch) | |
tree | 51a44510a64815fd3b557a42827f72cd0eda54aa /plugins/LanguagesManager | |
parent | 9fbdbde0ca4fa74df2c629a148575828c3fcc36d (diff) |
update translation command to use ProgressBar instead of deprecated ProgressHelper
Diffstat (limited to 'plugins/LanguagesManager')
-rw-r--r-- | plugins/LanguagesManager/Commands/FetchTranslations.php | 11 | ||||
-rw-r--r-- | plugins/LanguagesManager/Commands/Update.php | 11 |
2 files changed, 14 insertions, 8 deletions
diff --git a/plugins/LanguagesManager/Commands/FetchTranslations.php b/plugins/LanguagesManager/Commands/FetchTranslations.php index 79f83da36d..ce24dc3a97 100644 --- a/plugins/LanguagesManager/Commands/FetchTranslations.php +++ b/plugins/LanguagesManager/Commands/FetchTranslations.php @@ -13,7 +13,7 @@ use Piwik\Container\StaticContainer; use Piwik\Exception\AuthenticationFailedException; use Piwik\Plugins\LanguagesManager\API as LanguagesManagerApi; use Piwik\Translation\Transifex\API; -use Symfony\Component\Console\Helper\ProgressHelper; +use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -38,6 +38,8 @@ class FetchTranslations extends TranslationBase protected function execute(InputInterface $input, OutputInterface $output) { + $output->setDecorated(true); + $username = $input->getOption('username'); $password = $input->getOption('password'); $plugin = $input->getOption('plugin'); @@ -81,10 +83,10 @@ class FetchTranslations extends TranslationBase $languages = $languageCodes; } - /** @var ProgressHelper $progress */ - $progress = $this->getHelperSet()->get('progress'); + /** @var ProgressBar $progress */ + $progress = new ProgressBar($output, count($languages)); - $progress->start($output, count($languages)); + $progress->start(); $statistics = $transifexApi->getStatistics($resource); @@ -108,6 +110,7 @@ class FetchTranslations extends TranslationBase } $progress->finish(); + $output->writeln(''); } public static function getDownloadPath() diff --git a/plugins/LanguagesManager/Commands/Update.php b/plugins/LanguagesManager/Commands/Update.php index d28b979046..375614c5db 100644 --- a/plugins/LanguagesManager/Commands/Update.php +++ b/plugins/LanguagesManager/Commands/Update.php @@ -11,12 +11,12 @@ namespace Piwik\Plugins\LanguagesManager\Commands; use Piwik\Plugins\LanguagesManager\API; use Symfony\Component\Console\Helper\DialogHelper; -use Symfony\Component\Console\Helper\ProgressHelper; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\NullOutput; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Helper\ProgressBar; /** */ @@ -34,6 +34,8 @@ class Update extends TranslationBase protected function execute(InputInterface $input, OutputInterface $output) { + $output->setDecorated(true); + $start = microtime(true); /** @var DialogHelper $dialog */ @@ -76,10 +78,10 @@ class Update extends TranslationBase $output->writeln("Starting to import new language files"); - /** @var ProgressHelper $progress */ - $progress = $this->getHelperSet()->get('progress'); + /** @var ProgressBar $progress */ + $progress = new ProgressBar($output, count($files)); - $progress->start($output, count($files)); + $progress->start(); foreach ($files as $filename) { @@ -119,6 +121,7 @@ class Update extends TranslationBase } $progress->finish(); + $output->writeln(''); } $output->writeln("Finished in " . round(microtime(true)-$start, 3) . "s"); |