Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsgiehl <stefan@piwik.org>2013-12-30 00:37:02 +0400
committersgiehl <stefan@piwik.org>2013-12-30 00:37:02 +0400
commitf07f80301414cb7e935f4aa0910cb20fe466739a (patch)
tree515a238f5cfecd82049d7b200e95abd9cd02384e /plugins/LanguagesManager/Commands
parent9dee18336942b9e2b1fc85a41be76005b68b7183 (diff)
always update core bundled plugins with core translations
Diffstat (limited to 'plugins/LanguagesManager/Commands')
-rw-r--r--plugins/LanguagesManager/Commands/CreatePull.php8
-rw-r--r--plugins/LanguagesManager/Commands/Update.php45
2 files changed, 52 insertions, 1 deletions
diff --git a/plugins/LanguagesManager/Commands/CreatePull.php b/plugins/LanguagesManager/Commands/CreatePull.php
index 05419666fd..37c5cf9d2e 100644
--- a/plugins/LanguagesManager/Commands/CreatePull.php
+++ b/plugins/LanguagesManager/Commands/CreatePull.php
@@ -13,10 +13,10 @@ namespace Piwik\Plugins\LanguagesManager\Commands;
use Piwik\Plugin\ConsoleCommand;
use Piwik\Plugins\LanguagesManager\API;
+use Piwik\Plugins\LanguagesManager\Commands\Update;
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;
/**
@@ -99,6 +99,12 @@ class CreatePull extends ConsoleCommand
shell_exec('git add lang/. > /dev/null 2>&1');
+ if (empty($plugin)) {
+ foreach (Update::getPluginsInCore() AS $pluginName) {
+ shell_exec(sprintf('git add plugins/%s/lang/. > /dev/null 2>&1', $pluginName));
+ }
+ }
+
$changes = shell_exec('git status --porcelain -uno');
if (empty($changes)) {
diff --git a/plugins/LanguagesManager/Commands/Update.php b/plugins/LanguagesManager/Commands/Update.php
index acc27f75de..a0d242c977 100644
--- a/plugins/LanguagesManager/Commands/Update.php
+++ b/plugins/LanguagesManager/Commands/Update.php
@@ -105,9 +105,54 @@ class Update extends ConsoleCommand
$inputObject = new ArrayInput($arguments);
$inputObject->setInteractive($input->isInteractive());
$command->run($inputObject, new NullOutput());
+
+ // update core modules that aren't in their own repo
+ if (empty($plugin)) {
+
+ foreach (self::getPluginsInCore() AS $pluginName) {
+
+ // update translation files
+ $command = $this->getApplication()->find('translations:set');
+ $arguments = array(
+ 'command' => 'translations:set',
+ '--code' => $code,
+ '--file' => $filename,
+ '--plugin' => $pluginName
+ );
+ $inputObject = new ArrayInput($arguments);
+ $inputObject->setInteractive($input->isInteractive());
+ $command->run($inputObject, new NullOutput());
+ }
+ }
}
$progress->finish();
$output->writeln("Finished.");
}
+
+ /**
+ * Returns all plugins having their own translations that are bundled in core
+ * @return array
+ */
+ public static function getPluginsInCore()
+ {
+ static $pluginsInCore;
+
+ if (!empty($pluginsInCore)) {
+ return $pluginsInCore;
+ }
+
+ $submodules = shell_exec('git submodule status');
+ preg_match_all('/plugins\/([a-zA-z]+) /', $submodules, $matches);
+ $submodulePlugins = $matches[1];
+
+ $pluginsWithTranslations = glob(sprintf('%s/plugins/*/lang/en.json', PIWIK_INCLUDE_PATH));
+ $pluginsWithTranslations = array_map(function($elem){
+ return str_replace(array(sprintf('%s/plugins/', PIWIK_INCLUDE_PATH), '/lang/en.json'), '', $elem);
+ }, $pluginsWithTranslations);
+
+ $pluginsInCore = array_diff($pluginsWithTranslations, $submodulePlugins);
+
+ return $pluginsInCore;
+ }
} \ No newline at end of file