File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 1616 "illuminate/console" : " ~5.0" ,
1717 "illuminate/config" : " ~5.0" ,
1818 "monolog/monolog" : " ~1.11" ,
19- "geoip2/geoip2" : " ~2.1" ,
20- "guzzlehttp/guzzle" : " ^6.0"
19+ "geoip2/geoip2" : " ~2.1"
2120 },
2221 "require-dev" : {
2322 "phpunit/phpunit" : " ~4.0" ,
Original file line number Diff line number Diff line change @@ -47,11 +47,15 @@ protected function updateMaxMindDatabase()
4747 $ maxMindDatabaseUrl = $ this ->config ->get ('geoip.maxmind.update_url ' );
4848 $ databasePath = $ this ->config ->get ('geoip.maxmind.database_path ' );
4949
50- $ client = new Client ();
51- $ response = $ client -> get ( $ maxMindDatabaseUrl );
52- $ file = $ response -> getBody ( );
50+ // Download zipped database to a system temp file
51+ $ tmpFile = tempnam ( sys_get_temp_dir (), ' maxmind ' );
52+ file_put_contents ( $ tmpFile , fopen ( $ maxMindDatabaseUrl , ' r ' ) );
5353
54- @file_put_contents ($ databasePath , gzdecode ($ file ));
54+ // Unzip and save database
55+ file_put_contents ($ databasePath , gzopen ($ tmpFile , 'r ' ));
56+
57+ // Remove temp file
58+ @unlink ($ tmpFile );
5559
5660 return $ databasePath ;
5761 }
You can’t perform that action at this time.
0 commit comments