Skip to content

Commit

Permalink
Fix BC break on undefined array index for maxmind-db path introduce…
Browse files Browse the repository at this point in the history
…d by mente#6
  • Loading branch information
rvanlaak authored Feb 23, 2017
1 parent 0ab29e0 commit b8925ab
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Composer/ScriptHandler.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
<?php
/**
* User: avasilenko
* Date: 29.08.14
* Time: 13:03
*/

namespace Insomnia\MaxMindGeoIpBundle\Composer;


use Composer\Script\Event;
use Insomnia\MaxMindGeoIpBundle\Command\LoadDatabaseCommand;
use Symfony\Component\Console\Input\StringInput;
Expand All @@ -27,7 +21,12 @@ public static function downloadMaxMindDB(Event $cmd)
$parameters = new ParameterBag(array('insomnia_max_mind_db_path' => $options['maxmind-db-path']));
$command->setContainer(new Container($parameters));

$input = new StringInput($options['maxmind-db']);
// Allow to provide custom `maxmind-db` database link via `composer.json` extra section
$maxmindDatabaseLink = isset($options['maxmind-db'])
? $options['maxmind-db']
: 'http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz'
;
$input = new StringInput($maxmindDatabaseLink);
$command->run($input, new ConsoleOutput());
}
}

0 comments on commit b8925ab

Please sign in to comment.