From 79d261260b17b1ab559311944ccefbca08c56630 Mon Sep 17 00:00:00 2001 From: Jasper van Wanrooy Date: Sun, 11 Jan 2015 15:28:29 +0100 Subject: [PATCH 1/8] Update dependencies. --- composer.lock | 91 +++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 47 deletions(-) diff --git a/composer.lock b/composer.lock index 5ccbf27..20dc1ca 100644 --- a/composer.lock +++ b/composer.lock @@ -1,38 +1,43 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" ], "hash": "d8679fd23fa2cda936d7a2c6ee453fcd", "packages": [ { "name": "symfony/console", - "version": "v2.4.3", + "version": "v2.6.3", "target-dir": "Symfony/Component/Console", "source": { "type": "git", "url": "https://github.com/symfony/Console.git", - "reference": "ef20f1f58d7f693ee888353962bd2db336e3bbcb" + "reference": "6ac6491ff60c0e5a941db3ccdc75a07adbb61476" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/ef20f1f58d7f693ee888353962bd2db336e3bbcb", - "reference": "ef20f1f58d7f693ee888353962bd2db336e3bbcb", + "url": "https://api.github.com/repos/symfony/Console/zipball/6ac6491ff60c0e5a941db3ccdc75a07adbb61476", + "reference": "6ac6491ff60c0e5a941db3ccdc75a07adbb61476", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "symfony/event-dispatcher": "~2.1" + "psr/log": "~1.0", + "symfony/event-dispatcher": "~2.1", + "symfony/process": "~2.1" }, "suggest": { - "symfony/event-dispatcher": "" + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -45,34 +50,32 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Console Component", "homepage": "http://symfony.com", - "time": "2014-03-01 17:35:04" + "time": "2015-01-06 17:50:02" }, { "name": "symfony/yaml", - "version": "v2.4.3", + "version": "v2.6.3", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "77a41c2835ab7cfe8bf6d15e25d3af8f3eb3bacd" + "reference": "82462a90848a52c2533aa6b598b107d68076b018" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/77a41c2835ab7cfe8bf6d15e25d3af8f3eb3bacd", - "reference": "77a41c2835ab7cfe8bf6d15e25d3af8f3eb3bacd", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/82462a90848a52c2533aa6b598b107d68076b018", + "reference": "82462a90848a52c2533aa6b598b107d68076b018", "shasum": "" }, "require": { @@ -81,7 +84,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -94,20 +97,18 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2014-03-12 18:29:58" + "time": "2015-01-03 15:33:07" } ], "packages-dev": [ @@ -149,23 +150,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "1.2.17", + "version": "1.2.18", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "6ef2bf3a1c47eca07ea95f0d8a902a6340390b34" + "reference": "fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6ef2bf3a1c47eca07ea95f0d8a902a6340390b34", - "reference": "6ef2bf3a1c47eca07ea95f0d8a902a6340390b34", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b", + "reference": "fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b", "shasum": "" }, "require": { "php": ">=5.3.3", "phpunit/php-file-iterator": ">=1.3.0@stable", "phpunit/php-text-template": ">=1.2.0@stable", - "phpunit/php-token-stream": ">=1.1.3@stable" + "phpunit/php-token-stream": ">=1.1.3,<1.3.0" }, "require-dev": { "phpunit/phpunit": "3.7.*@dev" @@ -206,7 +207,7 @@ "testing", "xunit" ], - "time": "2014-03-28 10:53:45" + "time": "2014-09-02 10:13:14" }, { "name": "phpunit/php-file-iterator", @@ -393,20 +394,22 @@ }, { "name": "phpunit/phpunit", - "version": "3.7.34", + "version": "3.7.38", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "248d6ce95e6ca7f0e3135252c0b984bbe1f52f19" + "reference": "38709dc22d519a3d1be46849868aa2ddf822bcf6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/248d6ce95e6ca7f0e3135252c0b984bbe1f52f19", - "reference": "248d6ce95e6ca7f0e3135252c0b984bbe1f52f19", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/38709dc22d519a3d1be46849868aa2ddf822bcf6", + "reference": "38709dc22d519a3d1be46849868aa2ddf822bcf6", "shasum": "" }, "require": { + "ext-ctype": "*", "ext-dom": "*", + "ext-json": "*", "ext-pcre": "*", "ext-reflection": "*", "ext-spl": "*", @@ -422,9 +425,6 @@ "pear-pear.php.net/pear": "1.9.4" }, "suggest": { - "ext-json": "*", - "ext-simplexml": "*", - "ext-tokenizer": "*", "phpunit/php-invoker": "~1.1" }, "bin": [ @@ -463,7 +463,7 @@ "testing", "xunit" ], - "time": "2014-03-28 11:04:36" + "time": "2014-10-17 09:04:17" }, { "name": "phpunit/phpunit-mock-objects", @@ -515,17 +515,14 @@ "time": "2013-01-13 10:24:48" } ], - "aliases": [ - - ], + "aliases": [], "minimum-stability": "stable", "stability-flags": { "ecomdev/mage-ci": 20 }, + "prefer-stable": false, "platform": { "php": ">=5.3.0" }, - "platform-dev": [ - - ] + "platform-dev": [] } From da56d977eeed17765075d727bb87cb5699f5bbf3 Mon Sep 17 00:00:00 2001 From: Jasper van Wanrooy Date: Sun, 11 Jan 2015 16:05:15 +0100 Subject: [PATCH 2/8] Separate nulls from empty strings while diffing. --- src/MageConfigSync/Command/DiffCommand.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/MageConfigSync/Command/DiffCommand.php b/src/MageConfigSync/Command/DiffCommand.php index c1438a2..a673b8d 100644 --- a/src/MageConfigSync/Command/DiffCommand.php +++ b/src/MageConfigSync/Command/DiffCommand.php @@ -75,11 +75,11 @@ protected function execute(InputInterface $input, OutputInterface $output) foreach ($scope_data as $key => $value) { $diff_count++; $diff_message = sprintf( - "%s/%s is different (File: '%s', DB: '%s')", + "%s/%s is different (File: %s, DB: %s)", $scope, $key, - $file_data[$scope][$key], - $db_data[$scope][$key] + $this->decorateValue($file_data[$scope][$key]), + $this->decorateValue($db_data[$scope][$key]) ); $output->writeln($diff_message); } @@ -91,4 +91,13 @@ protected function execute(InputInterface $input, OutputInterface $output) } } } + + protected function decorateValue($value) + { + if (is_null($value)) { + return 'null'; + } else { + return "'{$value}'"; + } + } } From 4cfee2ae2ccd5413247f7a30eafcfa154b864b3e Mon Sep 17 00:00:00 2001 From: Jasper van Wanrooy Date: Sun, 11 Jan 2015 17:05:32 +0100 Subject: [PATCH 3/8] Optimize console display for unset key. --- src/MageConfigSync/Command/LoadCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MageConfigSync/Command/LoadCommand.php b/src/MageConfigSync/Command/LoadCommand.php index 8e0cf5d..9ec6084 100644 --- a/src/MageConfigSync/Command/LoadCommand.php +++ b/src/MageConfigSync/Command/LoadCommand.php @@ -74,7 +74,7 @@ protected function execute(InputInterface $input, OutputInterface $output) "[%s] %s -> %s", $scope_key, $path, - $value + $value ?: 'null' ); if (method_exists($output, 'getErrorOutput')) { From f2c8f71eb069659f77efd132d860203921ac467e Mon Sep 17 00:00:00 2001 From: Jasper van Wanrooy Date: Sun, 11 Jan 2015 17:15:45 +0100 Subject: [PATCH 4/8] Enhance documentation with regards to absence of config keys. --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b9ff453..900652d 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,14 @@ For example: dev/debug/template_hints: 1 stores-1: currency/options/base: GBP + dev/restrict/allow_ips: null -The above will disable template hints on product, enable template hints on the development environment and set the currency to Pounds Sterling in the store scope for the store with ID #1. +The above will: + +* disable template hints on product; +* enable template hints on the development environment; +* set the currency to Pounds Sterling in the store scope for the store with ID #1; +* ensure the allowed development ip's are inherited from the website for store #1. Valid scope keys are: From 78f4366f6ed09146d8aee74a68c958330372213d Mon Sep 17 00:00:00 2001 From: Nick Jones Date: Mon, 12 Jan 2015 09:27:04 +0000 Subject: [PATCH 5/8] Add travis ci support --- .travis.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..2d35c73 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,28 @@ +language: php +php: + - 5.3 + - 5.4 + - 5.5 + - 5.6 + - hhvm +env: + - MAGENTO_VERSION=1.7.0.2 + - MAGENTO_VERSION=1.8.1.0 + - MAGENTO_VERSION=1.9.0.1 +matrix: + allow_failures: + - php: 5.6 + - php: hhvm +before_script: + - mysql -uroot -e "CREATE USER 'mageconfigsync'@'localhost' IDENTIFIED BY 'mageconfigsync';" + - mysql -uroot -e "GRANT ALL ON mageconfigsync.* TO 'mageconfigsync'@'localhost';" + - mysql -uroot -e "GRANT ALL ON mageconfigsync_test.* TO 'mageconfigsync'@'localhost';" + - mysql -uroot -e "FLUSH PRIVILEGES;" + - composer selfupdate + - composer install --dev --no-interaction + - wget http://www.phing.info/get/phing-latest.phar + - mv phing-latest.phar phing.phar + - chmod +x phing.phar + +script: + - php phing.phar -Ddb.pass='mageconfigsync' -Ddb.user='mageconfigsync' -Ddb.name='mageconfigsync' -Dmagento.version=$MAGENTO_VERSION test From cb52e0a6a43903632e50c38f7befe5bfe05ea3a7 Mon Sep 17 00:00:00 2001 From: Nick Jones Date: Tue, 17 Feb 2015 14:13:15 +0000 Subject: [PATCH 6/8] Fix typo --- src/MageConfigSync/Tests/MagentoTest/a/b/app/Mage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MageConfigSync/Tests/MagentoTest/a/b/app/Mage.php b/src/MageConfigSync/Tests/MagentoTest/a/b/app/Mage.php index bafdcb6..bee8a1a 100644 --- a/src/MageConfigSync/Tests/MagentoTest/a/b/app/Mage.php +++ b/src/MageConfigSync/Tests/MagentoTest/a/b/app/Mage.php @@ -1 +1 @@ - Date: Fri, 18 Sep 2015 12:04:32 +0100 Subject: [PATCH 7/8] Implement deleting entries with load Magento treats NULL entries in configuration as existing values and does not fall back to using configuration from a higher scope. In most cases, this is not the intended behaviour. Therefore, if a value is null, delete it from configuration instead of saving a null. This still allows saving empty configuration values by passing in an empty string. Signed-off-by: Nick Jones --- src/MageConfigSync/Command/LoadCommand.php | 6 +++++- .../Magento/ConfigurationAdapter.php | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/MageConfigSync/Command/LoadCommand.php b/src/MageConfigSync/Command/LoadCommand.php index 9ec6084..2475e6e 100644 --- a/src/MageConfigSync/Command/LoadCommand.php +++ b/src/MageConfigSync/Command/LoadCommand.php @@ -67,7 +67,11 @@ protected function execute(InputInterface $input, OutputInterface $output) foreach ($scope_data as $path => $value) { $scope_data = ConfigYaml::extractFromScopeKey($scope_key); - $affected_rows = $config_adapter->setValue($path, $value, $scope_data['scope'], $scope_data['scope_id']); + if ($value !== null) { + $affected_rows = $config_adapter->setValue($path, $value, $scope_data['scope'], $scope_data['scope_id']); + } else { + $affected_rows = $config_adapter->deleteValue($path, $scope_data['scope'], $scope_data['scope_id']); + } if ($affected_rows > 0) { $line = sprintf( diff --git a/src/MageConfigSync/Magento/ConfigurationAdapter.php b/src/MageConfigSync/Magento/ConfigurationAdapter.php index 01072bb..0ca1430 100644 --- a/src/MageConfigSync/Magento/ConfigurationAdapter.php +++ b/src/MageConfigSync/Magento/ConfigurationAdapter.php @@ -43,6 +43,26 @@ public function setValue($path, $value, $scope, $scope_id) ); } + /** + * @param $path + * @param $scope + * @param $scope_id + * + * @return int Number of affected rows + */ + public function deleteValue($path, $scope, $scope_id) + { + $write = $this->_magento->getDatabaseWriteConnection(); + return $write->delete( + $this->_table_name, + array( + 'scope = ?' => $scope, + 'scope_id = ?' => $scope_id, + 'path = ?' => $path + ) + ); + } + /** * @param $path * @return array From 0295add8dbe5d55594ee8829486d1c833c686c7b Mon Sep 17 00:00:00 2001 From: Nick Jones Date: Tue, 22 Sep 2015 12:05:41 +0100 Subject: [PATCH 8/8] Bump version number to 0.4.0 --- src/MageConfigSync/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MageConfigSync/Application.php b/src/MageConfigSync/Application.php index 10d69c6..79d69e7 100644 --- a/src/MageConfigSync/Application.php +++ b/src/MageConfigSync/Application.php @@ -10,7 +10,7 @@ class Application extends \Symfony\Component\Console\Application { public function __construct() { - parent::__construct("mageconfigsync", "0.3.1"); + parent::__construct("mageconfigsync", "0.4.0"); $this->add(new DumpCommand()); $this->add(new DiffCommand());