diff --git a/.travis.yml b/.travis.yml index 301539f..9f4a7c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,6 @@ script: - ../scripts/run_tests.sh after_script: - - php composer.phar update satooshi/php-coveralls --dev - php bin/coveralls -v notifications: diff --git a/Symfony/app/SymfonyRequirements.php b/Symfony/app/SymfonyRequirements.php index 0f89996..dd7c278 100644 --- a/Symfony/app/SymfonyRequirements.php +++ b/Symfony/app/SymfonyRequirements.php @@ -77,7 +77,7 @@ public function getTestMessage() } /** - * Returns the help text for resolving the problem + * Returns the help text for resolving the problem. * * @return string The help text */ @@ -119,14 +119,14 @@ class PhpIniRequirement extends Requirement * * @param string $cfgName The configuration name used for ini_get() * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false, - or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement - * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. - This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. - Example: You require a config to be true but PHP later removes this config and defaults it to true internally. - * @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived) - * @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived) - * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) - * @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement + * or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement + * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + * This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. + * Example: You require a config to be true but PHP later removes this config and defaults it to true internally. + * @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived) + * @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement */ public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false) { @@ -221,13 +221,13 @@ public function addRecommendation($fulfilled, $testMessage, $helpHtml, $helpText * * @param string $cfgName The configuration name used for ini_get() * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false, - or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement - * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. - This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. - Example: You require a config to be true but PHP later removes this config and defaults it to true internally. - * @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived) - * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived) - * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement + * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + * This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. + * Example: You require a config to be true but PHP later removes this config and defaults it to true internally. + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived) + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) */ public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null) { @@ -239,13 +239,13 @@ public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = * * @param string $cfgName The configuration name used for ini_get() * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false, - or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement - * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. - This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. - Example: You require a config to be true but PHP later removes this config and defaults it to true internally. - * @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived) - * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived) - * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement + * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + * This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. + * Example: You require a config to be true but PHP later removes this config and defaults it to true internally. + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived) + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) */ public function addPhpIniRecommendation($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null) { @@ -530,11 +530,22 @@ function_exists('simplexml_import_dom'), /* optional recommendations follow */ - $this->addRecommendation( - file_get_contents(__FILE__) === file_get_contents(__DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'), - 'Requirements file should be up-to-date', - 'Your requirements file is outdated. Run composer install and re-check your configuration.' - ); + if (file_exists(__DIR__.'/../vendor/composer')) { + require_once __DIR__.'/../vendor/autoload.php'; + + try { + $r = new \ReflectionClass('Sensio\Bundle\DistributionBundle\SensioDistributionBundle'); + + $contents = file_get_contents(dirname($r->getFileName()).'/Resources/skeleton/app/SymfonyRequirements.php'); + } catch (\ReflectionException $e) { + $contents = ''; + } + $this->addRecommendation( + file_get_contents(__FILE__) === $contents, + 'Requirements file should be up-to-date', + 'Your requirements file is outdated. Run composer install and re-check your configuration.' + ); + } $this->addRecommendation( version_compare($installedPhpVersion, '5.3.4', '>='), @@ -614,15 +625,15 @@ class_exists('Locale'), 'Install and enable the intl extension (used for validators).' ); - if (class_exists('Collator')) { + if (extension_loaded('intl')) { + // in some WAMP server installations, new Collator() returns null $this->addRecommendation( null !== new Collator('fr_FR'), 'intl extension should be correctly configured', 'The intl extension does not behave properly. This problem is typical on PHP 5.3.X x64 WIN builds.' ); - } - if (class_exists('Locale')) { + // check for compatible ICU versions (only done when you have the intl extension) if (defined('INTL_ICU_VERSION')) { $version = INTL_ICU_VERSION; } else { @@ -641,6 +652,14 @@ class_exists('Locale'), 'intl ICU version should be at least 4+', 'Upgrade your intl extension with a newer ICU version (4+).' ); + + $this->addPhpIniRecommendation( + 'intl.error_level', + create_function('$cfgValue', 'return (int) $cfgValue === 0;'), + true, + 'intl.error_level should be 0 in php.ini', + 'Set "intl.error_level" to "0" in php.ini* to inhibit the messages when an error occurs in ICU functions.' + ); } $accelerator = diff --git a/Symfony/composer.json b/Symfony/composer.json index ac51451..5ad4e9c 100644 --- a/Symfony/composer.json +++ b/Symfony/composer.json @@ -20,14 +20,14 @@ "sensio/generator-bundle": "2.3.*", "incenteev/composer-parameter-handler": "~2.0" }, - "require-dev": { - "phpunit/phpunit": "3.7.*", - "satooshi/php-coveralls": "dev-master", - "squizlabs/php_codesniffer": "1.*", - "sebastian/phpcpd": "*", - "phpmd/phpmd": "2.0.*" - }, - "scripts": { + "require-dev": { + "phpunit/phpunit": "3.7.*", + "satooshi/php-coveralls": "dev-master", + "squizlabs/php_codesniffer": "1.*", + "sebastian/phpcpd": "*", + "phpmd/phpmd" : "2.0.*" + }, + "scripts": { "post-install-cmd": [ "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", diff --git a/Symfony/composer.lock b/Symfony/composer.lock index 02d882c..a784a0a 100644 --- a/Symfony/composer.lock +++ b/Symfony/composer.lock @@ -1,23 +1,23 @@ { "_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 https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "b11ca2a2df0d63d663c78df83a019a5d", + "hash": "b60c0102b220782d537b7cfa865902d7", "packages": [ { "name": "doctrine/annotations", - "version": "v1.2.3", + "version": "v1.2.6", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "eeda578cbe24a170331a1cfdf78be723412df7a4" + "reference": "f4a91702ca3cd2e568c3736aa031ed00c3752af4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/eeda578cbe24a170331a1cfdf78be723412df7a4", - "reference": "eeda578cbe24a170331a1cfdf78be723412df7a4", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/f4a91702ca3cd2e568c3736aa031ed00c3752af4", + "reference": "f4a91702ca3cd2e568c3736aa031ed00c3752af4", "shasum": "" }, "require": { @@ -72,20 +72,20 @@ "docblock", "parser" ], - "time": "2014-12-20 20:49:38" + "time": "2015-06-17 12:21:22" }, { "name": "doctrine/cache", - "version": "v1.4.0", + "version": "v1.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "2346085d2b027b233ae1d5de59b07440b9f288c8" + "reference": "c9eadeb743ac6199f7eec423cb9426bc518b7b03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/2346085d2b027b233ae1d5de59b07440b9f288c8", - "reference": "2346085d2b027b233ae1d5de59b07440b9f288c8", + "url": "https://api.github.com/repos/doctrine/cache/zipball/c9eadeb743ac6199f7eec423cb9426bc518b7b03", + "reference": "c9eadeb743ac6199f7eec423cb9426bc518b7b03", "shasum": "" }, "require": { @@ -96,13 +96,13 @@ }, "require-dev": { "phpunit/phpunit": ">=3.7", - "predis/predis": "~0.8", + "predis/predis": "~1.0", "satooshi/php-coveralls": "~0.6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "1.5.x-dev" } }, "autoload": { @@ -142,25 +142,28 @@ "cache", "caching" ], - "time": "2015-01-15 20:38:55" + "time": "2015-04-15 00:11:59" }, { "name": "doctrine/collections", - "version": "v1.2", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/collections.git", - "reference": "b99c5c46c87126201899afe88ec490a25eedd6a2" + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/b99c5c46c87126201899afe88ec490a25eedd6a2", - "reference": "b99c5c46c87126201899afe88ec490a25eedd6a2", + "url": "https://api.github.com/repos/doctrine/collections/zipball/6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a", "shasum": "" }, "require": { "php": ">=5.3.2" }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, "type": "library", "extra": { "branch-alias": { @@ -177,17 +180,6 @@ "MIT" ], "authors": [ - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/", - "role": "Creator" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com", - "homepage": "http://www.instaclick.com" - }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -196,11 +188,17 @@ "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, { "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", - "role": "Developer of wrapped JMSSerializerBundle" + "email": "schmittjoh@gmail.com" } ], "description": "Collections Abstraction library", @@ -210,7 +208,7 @@ "collections", "iterator" ], - "time": "2014-02-03 23:07:43" + "time": "2015-04-14 22:21:58" }, { "name": "doctrine/common", @@ -362,7 +360,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/v1.2.0", + "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/765b0d87fcc3e839c74817b7211258cbef3a4fb9", "reference": "v1.2.0", "shasum": "" }, @@ -615,17 +613,16 @@ }, { "name": "incenteev/composer-parameter-handler", - "version": "v2.1.0", - "target-dir": "Incenteev/ParameterHandler", + "version": "v2.1.1", "source": { "type": "git", "url": "https://github.com/Incenteev/ParameterHandler.git", - "reference": "143272a0a09c62616a3c8011fc165a10c6b35241" + "reference": "84a205fe80a46101607bafbc423019527893ddd0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/143272a0a09c62616a3c8011fc165a10c6b35241", - "reference": "143272a0a09c62616a3c8011fc165a10c6b35241", + "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/84a205fe80a46101607bafbc423019527893ddd0", + "reference": "84a205fe80a46101607bafbc423019527893ddd0", "shasum": "" }, "require": { @@ -644,8 +641,8 @@ } }, "autoload": { - "psr-0": { - "Incenteev\\ParameterHandler": "" + "psr-4": { + "Incenteev\\ParameterHandler\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -663,7 +660,7 @@ "keywords": [ "parameters management" ], - "time": "2013-12-07 10:10:39" + "time": "2015-06-03 08:27:03" }, { "name": "jdorn/sql-formatter", @@ -788,16 +785,16 @@ }, { "name": "monolog/monolog", - "version": "1.12.0", + "version": "1.15.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "1fbe8c2641f2b163addf49cc5e18f144bec6b19f" + "reference": "dc5150cc608f2334c72c3b6a553ec9668a4156b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1fbe8c2641f2b163addf49cc5e18f144bec6b19f", - "reference": "1fbe8c2641f2b163addf49cc5e18f144bec6b19f", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/dc5150cc608f2334c72c3b6a553ec9668a4156b0", + "reference": "dc5150cc608f2334c72c3b6a553ec9668a4156b0", "shasum": "" }, "require": { @@ -808,12 +805,15 @@ "psr/log-implementation": "1.0.0" }, "require-dev": { - "aws/aws-sdk-php": "~2.4, >2.4.8", + "aws/aws-sdk-php": "^2.4.9", "doctrine/couchdb": "~1.0@dev", "graylog2/gelf-php": "~1.0", - "phpunit/phpunit": "~4.0", - "raven/raven": "~0.5", - "ruflin/elastica": "0.90.*", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "raven/raven": "~0.8", + "ruflin/elastica": ">=0.90 <3.0", + "swiftmailer/swiftmailer": "~5.3", "videlalvaro/php-amqplib": "~2.4" }, "suggest": { @@ -822,6 +822,7 @@ "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", "ext-mongo": "Allow sending log messages to a MongoDB server", "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "php-console/php-console": "Allow sending log messages to Google Chrome", "raven/raven": "Allow sending log messages to a Sentry server", "rollbar/rollbar": "Allow sending log messages to Rollbar", "ruflin/elastica": "Allow sending log messages to an Elastic Search server", @@ -830,7 +831,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12.x-dev" + "dev-master": "1.15.x-dev" } }, "autoload": { @@ -856,19 +857,19 @@ "logging", "psr-3" ], - "time": "2014-12-29 21:29:35" + "time": "2015-07-12 13:54:09" }, { "name": "psr/log", "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/php-fig/log", + "url": "https://github.com/php-fig/log.git", "reference": "1.0.0" }, "dist": { "type": "zip", - "url": "https://github.com/php-fig/log/archive/1.0.0.zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", "reference": "1.0.0", "shasum": "" }, @@ -898,17 +899,17 @@ }, { "name": "sensio/distribution-bundle", - "version": "v2.3.8", + "version": "v2.3.22", "target-dir": "Sensio/Bundle/DistributionBundle", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioDistributionBundle.git", - "reference": "9a72f821957141ee3d9703da3fa8266d59ef4b1c" + "reference": "98bdda791e7c2dfb5fd55781e69a4b00e4f751a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/9a72f821957141ee3d9703da3fa8266d59ef4b1c", - "reference": "9a72f821957141ee3d9703da3fa8266d59ef4b1c", + "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/98bdda791e7c2dfb5fd55781e69a4b00e4f751a6", + "reference": "98bdda791e7c2dfb5fd55781e69a4b00e4f751a6", "shasum": "" }, "require": { @@ -940,7 +941,7 @@ "configuration", "distribution" ], - "time": "2015-01-07 07:11:03" + "time": "2015-06-05 22:32:08" }, { "name": "sensio/framework-extra-bundle", @@ -1043,28 +1044,28 @@ }, { "name": "swiftmailer/swiftmailer", - "version": "v5.3.1", + "version": "v5.4.1", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "c5f963e7f9d6f6438fda4f22d5cc2db296ec621a" + "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/c5f963e7f9d6f6438fda4f22d5cc2db296ec621a", - "reference": "c5f963e7f9d6f6438fda4f22d5cc2db296ec621a", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/0697e6aa65c83edf97bb0f23d8763f94e3f11421", + "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "mockery/mockery": "~0.9.1" + "mockery/mockery": "~0.9.1,<0.9.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.3-dev" + "dev-master": "5.4-dev" } }, "autoload": { @@ -1088,10 +1089,11 @@ "description": "Swiftmailer, free feature-rich PHP mailer", "homepage": "http://swiftmailer.org", "keywords": [ + "email", "mail", "mailer" ], - "time": "2014-12-05 14:17:14" + "time": "2015-06-06 14:19:39" }, { "name": "symfony/assetic-bundle", @@ -1167,7 +1169,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/MonologBundle/zipball/v2.3.0", + "url": "https://api.github.com/repos/symfony/MonologBundle/zipball/03ed73bc11367b3156cc21f22ac37c7f70fcd10a", "reference": "v2.3.0", "shasum": "" }, @@ -1273,16 +1275,16 @@ }, { "name": "symfony/symfony", - "version": "v2.3.24", + "version": "v2.3.31", "source": { "type": "git", "url": "https://github.com/symfony/symfony.git", - "reference": "5b2c33be25fdb94233e2c2625ee2d69289f24300" + "reference": "bd506a5e84fdce41966ef4986255fff1e31fc056" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/symfony/zipball/5b2c33be25fdb94233e2c2625ee2d69289f24300", - "reference": "5b2c33be25fdb94233e2c2625ee2d69289f24300", + "url": "https://api.github.com/repos/symfony/symfony/zipball/bd506a5e84fdce41966ef4986255fff1e31fc056", + "reference": "bd506a5e84fdce41966ef4986255fff1e31fc056", "shasum": "" }, "require": { @@ -1337,7 +1339,8 @@ "ircmaxell/password-compat": "~1.0", "monolog/monolog": "~1.3", "ocramius/proxy-manager": "~0.3.1", - "propel/propel1": "~1.6" + "propel/propel1": "~1.6", + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { @@ -1362,21 +1365,21 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "The Symfony PHP framework", - "homepage": "http://symfony.com", + "homepage": "https://symfony.com", "keywords": [ "framework" ], - "time": "2015-01-07 10:32:09" + "time": "2015-07-13 09:12:26" }, { "name": "twig/extensions", @@ -1427,25 +1430,25 @@ }, { "name": "twig/twig", - "version": "v1.17.0", + "version": "v1.18.2", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "2493970fa4d587eca73f77e6d8bd48a8bdd4c608" + "reference": "e8e6575abf6102af53ec283f7f14b89e304fa602" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/2493970fa4d587eca73f77e6d8bd48a8bdd4c608", - "reference": "2493970fa4d587eca73f77e6d8bd48a8bdd4c608", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/e8e6575abf6102af53ec283f7f14b89e304fa602", + "reference": "e8e6575abf6102af53ec283f7f14b89e304fa602", "shasum": "" }, "require": { - "php": ">=5.2.4" + "php": ">=5.2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-master": "1.18-dev" } }, "autoload": { @@ -1480,22 +1483,22 @@ "keywords": [ "templating" ], - "time": "2015-01-14 10:15:49" + "time": "2015-06-06 23:31:24" } ], "packages-dev": [ { "name": "guzzle/guzzle", - "version": "v3.9.2", + "version": "v3.9.3", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle3.git", - "reference": "54991459675c1a2924122afbb0e5609ade581155" + "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/54991459675c1a2924122afbb0e5609ade581155", - "reference": "54991459675c1a2924122afbb0e5609ade581155", + "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/0645b70d953bc1c067bbc8d5bc53194706b628d9", + "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9", "shasum": "" }, "require": { @@ -1536,6 +1539,9 @@ "zendframework/zend-cache": "2.*,<2.3", "zendframework/zend-log": "2.*,<2.3" }, + "suggest": { + "guzzlehttp/guzzle": "Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated." + }, "type": "library", "extra": { "branch-alias": { @@ -1563,7 +1569,7 @@ "homepage": "https://github.com/guzzle/guzzle/contributors" } ], - "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", + "description": "PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle", "homepage": "http://guzzlephp.org/", "keywords": [ "client", @@ -1574,7 +1580,7 @@ "rest", "web service" ], - "time": "2014-08-11 04:32:36" + "time": "2015-03-18 18:23:50" }, { "name": "pdepend/pdepend", @@ -1720,31 +1726,33 @@ }, { "name": "phpunit/php-file-iterator", - "version": "1.3.4", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" + "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb", + "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb", "shasum": "" }, "require": { "php": ">=5.3.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, "autoload": { "classmap": [ - "File/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -1761,20 +1769,20 @@ "filesystem", "iterator" ], - "time": "2013-10-10 15:34:57" + "time": "2015-04-02 05:19:05" }, { "name": "phpunit/php-text-template", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a" + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", "shasum": "" }, "require": { @@ -1783,20 +1791,17 @@ "type": "library", "autoload": { "classmap": [ - "Text/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1805,20 +1810,20 @@ "keywords": [ "template" ], - "time": "2014-01-30 17:20:04" + "time": "2015-06-21 13:50:34" }, { "name": "phpunit/php-timer", - "version": "1.0.5", + "version": "1.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" + "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/83fe1bdc5d47658b727595c14da140da92b3d66d", + "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d", "shasum": "" }, "require": { @@ -1827,13 +1832,10 @@ "type": "library", "autoload": { "classmap": [ - "PHP/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -1849,7 +1851,7 @@ "keywords": [ "timer" ], - "time": "2013-08-02 07:42:54" + "time": "2015-06-13 07:35:30" }, { "name": "phpunit/php-token-stream", @@ -2100,21 +2102,21 @@ }, { "name": "sebastian/finder-facade", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/finder-facade.git", - "reference": "1e396fda3449fce9df032749fa4fa2619e0347e0" + "reference": "a520dcc3dd39160eea480daa3426f4fd419a327b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/finder-facade/zipball/1e396fda3449fce9df032749fa4fa2619e0347e0", - "reference": "1e396fda3449fce9df032749fa4fa2619e0347e0", + "url": "https://api.github.com/repos/sebastianbergmann/finder-facade/zipball/a520dcc3dd39160eea480daa3426f4fd419a327b", + "reference": "a520dcc3dd39160eea480daa3426f4fd419a327b", "shasum": "" }, "require": { - "symfony/finder": ">=2.2.0", - "theseer/fdomdocument": ">=1.3.1" + "symfony/finder": "~2.3", + "theseer/fdomdocument": "~1.3" }, "type": "library", "autoload": { @@ -2135,28 +2137,28 @@ ], "description": "FinderFacade is a convenience wrapper for Symfony's Finder component.", "homepage": "https://github.com/sebastianbergmann/finder-facade", - "time": "2013-05-28 06:10:03" + "time": "2015-06-04 08:11:58" }, { "name": "sebastian/phpcpd", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpcpd.git", - "reference": "a9462153f2dd90466a010179901d31fbff598365" + "reference": "d3ad100fdf15805495f6ff19f473f4314c99390c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpcpd/zipball/a9462153f2dd90466a010179901d31fbff598365", - "reference": "a9462153f2dd90466a010179901d31fbff598365", + "url": "https://api.github.com/repos/sebastianbergmann/phpcpd/zipball/d3ad100fdf15805495f6ff19f473f4314c99390c", + "reference": "d3ad100fdf15805495f6ff19f473f4314c99390c", "shasum": "" }, "require": { "php": ">=5.3.3", - "phpunit/php-timer": ">=1.0.4", - "sebastian/finder-facade": ">=1.1.0", - "sebastian/version": ">=1.0.3", - "symfony/console": ">=2.2.0", + "phpunit/php-timer": "~1.0", + "sebastian/finder-facade": "~1.1", + "sebastian/version": "~1.0", + "symfony/console": "~2.2", "theseer/fdomdocument": "~1.4" }, "bin": [ @@ -2186,20 +2188,20 @@ ], "description": "Copy/Paste Detector (CPD) for PHP code.", "homepage": "https://github.com/sebastianbergmann/phpcpd", - "time": "2014-03-31 09:25:30" + "time": "2015-03-26 14:47:38" }, { "name": "sebastian/version", - "version": "1.0.4", + "version": "1.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "a77d9123f8e809db3fbdea15038c27a95da4058b" + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/a77d9123f8e809db3fbdea15038c27a95da4058b", - "reference": "a77d9123f8e809db3fbdea15038c27a95da4058b", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", "shasum": "" }, "type": "library", @@ -2221,7 +2223,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2014-12-15 14:25:24" + "time": "2015-06-21 13:59:46" }, { "name": "squizlabs/php_codesniffer", @@ -2300,16 +2302,16 @@ }, { "name": "theseer/fdomdocument", - "version": "1.6.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/theseer/fDOMDocument.git", - "reference": "d08cf070350f884c63fc9078d27893c2ab6c7cef" + "reference": "d9ad139d6c2e8edf5e313ffbe37ff13344cf0684" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/fDOMDocument/zipball/d08cf070350f884c63fc9078d27893c2ab6c7cef", - "reference": "d08cf070350f884c63fc9078d27893c2ab6c7cef", + "url": "https://api.github.com/repos/theseer/fDOMDocument/zipball/d9ad139d6c2e8edf5e313ffbe37ff13344cf0684", + "reference": "d9ad139d6c2e8edf5e313ffbe37ff13344cf0684", "shasum": "" }, "require": { @@ -2336,7 +2338,7 @@ ], "description": "The classes contained within this repository extend the standard DOM to use exceptions at all occasions of errors instead of PHP warnings or notices. They also add various custom methods and shortcuts for convenience and to simplify the usage of DOM.", "homepage": "https://github.com/theseer/fDOMDocument", - "time": "2014-09-13 10:57:19" + "time": "2015-05-27 22:58:02" } ], "aliases": [], diff --git a/Symfony/src/Codebender/CompilerBundle/Controller/DefaultController.php b/Symfony/src/Codebender/CompilerBundle/Controller/DefaultController.php index 26a8d7f..9980c72 100644 --- a/Symfony/src/Codebender/CompilerBundle/Controller/DefaultController.php +++ b/Symfony/src/Codebender/CompilerBundle/Controller/DefaultController.php @@ -15,6 +15,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Response; use Codebender\CompilerBundle\Handler\CompilerHandler; +use Codebender\CompilerBundle\Handler\DeletionHandler; class DefaultController extends Controller { @@ -70,113 +71,79 @@ public function indexAction($authorizationKey, $version) } } - public function deleteAllObjectsAction($authorizationKey, $version) - { - if ($this->container->getParameter('authorizationKey') != $authorizationKey) - return new Response(json_encode(array("success" => false, "step" => 0, "message" => "Invalid authorization key."))); - - if ($version != "v1") - return new Response(json_encode(array("success" => false, "step" => 0, "message" => "Invalid API version."))); - - $tempDir = $this->container->getParameter('temp_dir'); - $objectFilesDir = $this->container->getParameter('objdir'); - $fileCount = 0; - $undeletedFiles = ""; - $deletionStats = array("success_dot_a" => 0, - "failure_dot_a" => 0, - "success_dot_o" => 0, - "failure_dot_o" => 0, - "success_dot_d" => 0, - "failure_dot_d" => 0, - "success_dot_LOCK" => 0, - "failure_dot_LOCK" => 0); - - if ($handle = opendir("$tempDir/$objectFilesDir")) - { - - while (false !== ($entry = readdir($handle))) - { - if ($entry != "." && $entry != ".." && $entry != ".DS_Store") - { - $fileCount++; - $extension = pathinfo($entry, PATHINFO_EXTENSION); - - if (!in_array($extension, array("a", "o", "d", "LOCK"))) - continue; - - if (@unlink("$tempDir/$objectFilesDir/$entry") === false) - { - $deletionStats["failure_dot_$extension"]++; - $undeletedFiles .= $entry . "\n"; - } - else - $deletionStats["success_dot_$extension"]++; - } - } - closedir($handle); - }else - return new Response(json_encode(array("success" => false, "step" => 0, "message" => "Failed to access object files directory."))); - - return new Response(json_encode(array_merge(array("success" => true, - "message" => "Object files deletion complete. Found $fileCount files."), - $deletionStats, - array("Files not deleted" => $undeletedFiles)))); - } - - public function deleteSpecificObjectsAction($authorizationKey, $version, $option, $to_delete) - { - if ($this->container->getParameter('authorizationKey') != $authorizationKey) - return new Response(json_encode(array("success" => false, "step" => 0, "message" => "Invalid authorization key."))); - - if ($version != "v1") - return new Response(json_encode(array("success" => false, "step" => 0, "message" => "Invalid API version."))); - - $tempDir = $this->container->getParameter('temp_dir'); - $objectFilesDir = $this->container->getParameter('objdir'); - - if ($option == "core") - $to_delete = str_replace(":", "_", $to_delete); - - $response = array(); - $response["deleted_files"] = ""; - $response["undeleted_files"] = ""; - - if ($handle = opendir("$tempDir/$objectFilesDir")) - { - while (false !== ($entry = readdir($handle))) - { - if ($entry == "." || $entry == ".." || $entry == ".DS_Store") - continue; - - if ($option == "library" && strpos($entry, "______" . $to_delete . "_______") === false) - continue; - - if ($option == "core" && strpos($entry, "_" . $to_delete . "_") === false) - continue; - - - if (@unlink("$tempDir/$objectFilesDir/$entry") === false) - $response["undeleted_files"] .= $entry . "\n"; - else - $response["deleted_files"] .= $entry . "\n"; - - } - closedir($handle); + public function deleteAllObjectsAction($authorizationKey, $version) + { + if ($this->container->getParameter('authorizationKey') != $authorizationKey) { + return new Response(json_encode( + array('success' => false, 'step' => 0, 'message' => 'Invalid authorization key.') + )); + } + + if ($version != 'v1') { + return new Response(json_encode( + array('success' => false, 'step' => 0, 'message' => 'Invalid API version.') + )); } - else - { - return new Response(json_encode(array("success" => false, "step" => 0, "message" => "Failed to access object files directory."))); + + //Get the compiler service + /** @var DeletionHandler $deleter */ + $deleter = $this->get('deletion_handler'); + + $response = $deleter->deleteAllObjects(); + + if ($response['success'] === false) { + return new Response(json_encode( + array('success' => false, 'step' => 0, 'message' => 'Failed to access object files directory.') + )); + } + + return new Response(json_encode( + array_merge( + array( + 'success' => true, + 'message' => 'Object files deletion complete. Found ' . $response['fileCount'] . ' files.' + ), + $response['deletionStats'], + array("Files not deleted" => $response['notDeletedFiles']) + ))); + } + + public function deleteSpecificObjectsAction($authorizationKey, $version, $option, $cachedObjectToDelete) + { + if ($this->container->getParameter('authorizationKey') != $authorizationKey) { + return new Response(json_encode( + array('success' => false, 'step' => 0, 'message' => 'Invalid authorization key.') + )); } - if ($response["undeleted_files"] != "") - { - $message = ($option == "library") ? "Failed to delete one or more of the specified library object files.": "Failed to delete one or more of the specified core object files."; - return new Response(json_encode(array_merge(array("success" => false, "step" => 0, "message" => $message), $response))); + if ($version != 'v1') { + return new Response(json_encode( + array('success' => false, 'step' => 0, 'message' => 'Invalid API version.') + )); } - $message = ($option == "library") ? "Library deleted successfully.": "Core object files deleted successfully."; - return new Response(json_encode(array_merge(array("success" => true, "message" => $message), $response))); - } + //Get the compiler service + /** @var DeletionHandler $deleter */ + $deleter = $this->get('deletion_handler'); + + $response = $deleter->deleteSpecificObjects($option, $cachedObjectToDelete); + + if ($response['success'] === false) { + return new Response(json_encode( + array('success' => false, 'step' => 0, 'message' => 'Failed to access object files directory.') + )); + } + + if ($response["notDeletedFiles"] != '') { + $message = ($option == 'library') ? 'Failed to delete one or more of the specified library object files.' : 'Failed to delete one or more of the specified core object files.'; + return new Response(json_encode( + array_merge(array('success' => false, 'step' => 0, 'message' => $message), $response) + )); + } + + $message = ($option == 'library') ? 'Library deleted successfully.' : 'Core object files deleted successfully.'; + return new Response(json_encode(array_merge(array('success' => true, 'message' => $message), $response))); + } /** * \brief Creates a list of the configuration parameters to be used in the compilation process. diff --git a/Symfony/src/Codebender/CompilerBundle/Handler/DeletionHandler.php b/Symfony/src/Codebender/CompilerBundle/Handler/DeletionHandler.php new file mode 100644 index 0000000..83cfd0c --- /dev/null +++ b/Symfony/src/Codebender/CompilerBundle/Handler/DeletionHandler.php @@ -0,0 +1,116 @@ +$objectCacheDirectory = $objectFilesDirectory; + } + + function deleteAllObjects() + { + $fileCount = 0; + $notDeletedFiles = ''; + $deletionStats = array('success_dot_a' => 0, + 'failure_dot_a' => 0, + 'success_dot_o' => 0, + 'failure_dot_o' => 0, + 'success_dot_d' => 0, + 'failure_dot_d' => 0, + 'success_dot_LOCK' => 0, + 'failure_dot_LOCK' => 0); + + if ($handle = @opendir($this->$objectCacheDirectory)) { + + while (false !== ($entry = readdir($handle))) { + if ($entry == '.' || $entry == '..' || $entry != '.DS_Store') { + continue; + } + $fileCount++; + $extension = pathinfo($entry, PATHINFO_EXTENSION); + + if (!in_array($extension, array('a', 'o', 'd', 'LOCK'))) { + continue; + } + + if (@unlink($this->$objectCacheDirectory . '/' . $entry) === false) { + $deletionStats['failure_dot_$extension']++; + $notDeletedFiles .= $entry . "\n"; + continue; + } + + $deletionStats['success_dot_' . $extension]++; + } + closedir($handle); + + return array( + 'success' => true, + 'fileCount' => $fileCount, + 'notDeletedFiles' => $notDeletedFiles, + 'deletionStats' => $deletionStats + ); + } + + return array('success' => false); + } + + function deleteSpecificObjects($option, $cachedObjectToDelete) + { + if ($option == 'core') { + $cachedObjectToDelete = str_replace(':', '_', $cachedObjectToDelete); + } + + $deletedFiles = ''; + $notDeletedFiles = ''; + + if ($handle = @opendir($this->$objectCacheDirectory)) { + + while (false !== ($entry = readdir($handle))) { + + if ($entry == '.' || $entry == '..' || $entry == '.DS_Store') { + continue; + } + + if ($option == 'library' && strpos($entry, '______' . $cachedObjectToDelete . '_______') === false) { + continue; + } + + if ($option == 'core' && strpos($entry, '_' . $cachedObjectToDelete . '_') === false) { + continue; + } + + + if (@unlink($this->$objectCacheDirectory . '/' . $entry) === false) { + $notDeletedFiles .= $entry."\n"; + continue; + } + + $deletedFiles .= $entry . "\n"; + + } + closedir($handle); + + return array('success' => true, 'deletedFiles' => $deletedFiles, 'notDeletedFiles' => $notDeletedFiles); + } + + return array('success' => false); + } +} diff --git a/Symfony/src/Codebender/CompilerBundle/Handler/PreprocessingHandler.php b/Symfony/src/Codebender/CompilerBundle/Handler/PreprocessingHandler.php index 1dac789..5d72597 100644 --- a/Symfony/src/Codebender/CompilerBundle/Handler/PreprocessingHandler.php +++ b/Symfony/src/Codebender/CompilerBundle/Handler/PreprocessingHandler.php @@ -249,7 +249,7 @@ function buildCode($code, $function_prototypes, $position) return $return_code; } - function convertInoToCpp($code, $filename = NULL) + function convertInoToCpp($code, $filename = null) { // Remove comments, preprocessor directives, single- and double- quotes $no_comms_code = $this->removeCommentsDirectivesQuotes($code); @@ -263,12 +263,12 @@ function convertInoToCpp($code, $filename = NULL) // before any function declaration) $insertion_position = $this->insertionPosition($code); - $new_code = ""; + $new_code = "#line 1\n"; // Add a preprocessor directive for line numbering. - if ($filename) - $new_code .= "#line 1 \"$filename\"\n"; - else - $new_code .= "#line 1\n"; + if ($filename) { + $new_code .= "#line 1 \"$filename\"\n"; + } + // Build the new code for the cpp file that will eventually be compiled $new_code .= $this->buildCode($code, $function_prototypes, $insertion_position); @@ -281,15 +281,15 @@ function convertInoToCpp($code, $filename = NULL) * \brief Decodes and performs validation checks on input data. * * \param string $request The JSON-encoded compile request. - * \return The value encoded in JSON in appropriate PHP type or NULL. + * \return The value encoded in JSON in appropriate PHP type or null. */ function validateInput($request) { $request = json_decode($request, true); // Request must be successfully decoded. - if ($request === NULL) - return NULL; + if ($request === null) + return null; // Request must contain certain entities. if (!(array_key_exists("format", $request) && array_key_exists("version", $request) @@ -302,23 +302,26 @@ function validateInput($request) && array_key_exists("core", $request["build"]) && is_array($request["files"])) ) - return NULL; + return null; // Leonardo-specific flags. if (array_key_exists("variant", $request["build"]) && $request["build"]["variant"] == "leonardo") if (!(array_key_exists("vid", $request["build"]) && array_key_exists("pid", $request["build"])) ) - return NULL; + return null; // Values used as command-line arguments may not contain any special // characters. This is a serious security risk. $values = array("version", "mcu", "f_cpu", "core", "vid", "pid"); - if (array_key_exists("variant", $request["build"])) - $values[] = "variant"; - foreach ($values as $i) - if (isset($request["build"][$i]) && escapeshellcmd($request["build"][$i]) != $request["build"][$i]) - return NULL; + if (array_key_exists("variant", $request["build"])) { + $values[] = "variant"; + } + foreach ($values as $i) { + if (isset($request["build"][$i]) && escapeshellcmd($request["build"][$i]) != $request["build"][$i]) { + return null; + } + } // Request is valid. return $request; diff --git a/Symfony/src/Codebender/CompilerBundle/Handler/UtilityHandler.php b/Symfony/src/Codebender/CompilerBundle/Handler/UtilityHandler.php index 33ba5ed..f674b6e 100644 --- a/Symfony/src/Codebender/CompilerBundle/Handler/UtilityHandler.php +++ b/Symfony/src/Codebender/CompilerBundle/Handler/UtilityHandler.php @@ -36,17 +36,17 @@ function extractFiles($directory, $request_files, $lib_extraction) // separated by "|" to be used in regular expressions. They are also // used as keys in an array that will contain the paths of all the // extracted files. - $EXTENSIONS = array("c", "cpp", "h", "inc", "ino", "o", "S"); + $allowedExtensions = array("c", "cpp", "h", "inc", "ino", "o", "S"); $files = array(); - foreach ($EXTENSIONS as $ext) + foreach ($allowedExtensions as $ext) $files[$ext] = array(); - $EXTENSIONS = implode("|", $EXTENSIONS); + $allowedExtensions = implode("|", $allowedExtensions); // Matches filename that end with an appropriate extension. The name // without the extension is stored in registerd 1, the extension itself // in register 2. // // Examples: foo.c bar.cpp - $REGEX = "/(.*)\.($EXTENSIONS)$/"; + $extensionsRegex = "/(.*)\.($allowedExtensions)$/"; if (!file_exists($directory)) mkdir($directory, 0777, true); @@ -57,7 +57,7 @@ function extractFiles($directory, $request_files, $lib_extraction) $content = $file["content"]; $ignore = false; - $failure_response = array( + $failureResponse = array( "success" => false, "step" => 1, "message" => "Failed to extract file '$filename'."); @@ -66,7 +66,7 @@ function extractFiles($directory, $request_files, $lib_extraction) // serious security risk. $directories = explode("/", "$directory/$filename"); if (in_array("..", $directories)) - return $failure_response; + return $failureResponse; if (strpos($filename, DIRECTORY_SEPARATOR)) { @@ -84,12 +84,12 @@ function extractFiles($directory, $request_files, $lib_extraction) } if (file_put_contents("$directory/$filename", $content) === false) - return $failure_response; + return $failureResponse; if ($ignore) continue; - if (preg_match($REGEX, $filename, $matches)) + if (preg_match($extensionsRegex, $filename, $matches)) $files[$matches[2]][] = "$directory/$matches[1]"; else error_log(__FUNCTION__."(): Unhandled file extension '$filename'"); diff --git a/Symfony/src/Codebender/CompilerBundle/Resources/config/routing.yml b/Symfony/src/Codebender/CompilerBundle/Resources/config/routing.yml index 14e9520..bb0f875 100644 --- a/Symfony/src/Codebender/CompilerBundle/Resources/config/routing.yml +++ b/Symfony/src/Codebender/CompilerBundle/Resources/config/routing.yml @@ -15,7 +15,7 @@ codebender_compiler_delete_all: defaults: { _controller: CodebenderCompilerBundle:Default:deleteAllObjects } codebender_compiler_delete_specific: - pattern: /{authorizationKey}/{version}/delete/{option}/{to_delete} + pattern: /{authorizationKey}/{version}/delete/{option}/{cachedObjectToDelete} defaults: { _controller: CodebenderCompilerBundle:Default:deleteSpecificObjects } # redirecting the root diff --git a/Symfony/src/Codebender/CompilerBundle/Resources/config/services.yml b/Symfony/src/Codebender/CompilerBundle/Resources/config/services.yml index a529420..675bd9e 100644 --- a/Symfony/src/Codebender/CompilerBundle/Resources/config/services.yml +++ b/Symfony/src/Codebender/CompilerBundle/Resources/config/services.yml @@ -4,6 +4,7 @@ parameters: utility_handler.class: Codebender\CompilerBundle\Handler\UtilityHandler preprocessing_handler.class: Codebender\CompilerBundle\Handler\PreprocessingHandler postprocessing_handler.class: Codebender\CompilerBundle\Handler\PostprocessingHandler + deletion_handler.class: Codebender\CompilerBundle\Handler\DeletionHandler services: # codebender_compiler.example: @@ -18,6 +19,9 @@ services: class: "%preprocessing_handler.class%" postprocessing_handler: class: "%postprocessing_handler.class%" + deletion_handler: + class: "%deletion_handler.class%" + arguments: ["@compiler_logger", "%temp_dir%/%objdir%"] compiler_logger: class: Symfony\Bridge\Monolog\Logger arguments: [cmplr_log] diff --git a/scripts/install_dependencies.sh b/scripts/install_dependencies.sh index 4486d0e..db15079 100755 --- a/scripts/install_dependencies.sh +++ b/scripts/install_dependencies.sh @@ -2,10 +2,10 @@ sudo apt-get install -y unzip cd ~ wget https://github.com/codebendercc/arduino-core-files/archive/master.zip -unzip master.zip +unzip -q master.zip sudo cp -r arduino-core-files-master /opt/codebender/codebender-arduino-core-files rm master.zip wget https://github.com/codebendercc/external_cores/archive/master.zip -unzip master.zip +unzip -q master.zip sudo cp -r external_cores-master /opt/codebender/external-core-files cd - \ No newline at end of file