giosh94mhz / geonamesbundle Goto Github PK
View Code? Open in Web Editor NEWSymfony2 bundle to import and use Geonames toponyms
License: MIT License
Symfony2 bundle to import and use Geonames toponyms
License: MIT License
Could you please make your bundle available for ~2.4?
There are no BC breaks between 2.3 and 2.4 so it should work fine (or at least with some very minor tweaking).
While issue #1 is breaking my dev it's difficult for me to test and make a PR.
PHP 5.3 is set as a minimum requirement in composer.json, but Giosh94mhz\GeonamesBundle\Import\ImportDirector::download()
uses $this
in closure that is not allowed before PHP 5.4.
Test cases on Windows:
PHPUnit 3.7.28 by Sebastian Bergmann.
Configuration read from C:\Escapee\src\Giosh94mhz\GeonamesBundle\phpunit.xml.dist
..............FSSF........
Time: 728 ms, Memory: 4.75Mb
There were 2 failures:
1) Giosh94mhz\GeonamesBundle\Tests\Utils\CurlDownloadTest::testDownload
Failed asserting that 0 is greater than 0.
C:\Escapee\src\Giosh94mhz\GeonamesBundle\Tests\Utils\CurlDownloadTest.php:77
2) Giosh94mhz\GeonamesBundle\Tests\Utils\CurlDownloadTest::testMultiDownload
Failed asserting that 0 is greater than 0.
C:\Escapee\src\Giosh94mhz\GeonamesBundle\Tests\Utils\CurlDownloadTest.php:145
FAILURES!
Tests: 24, Assertions: 130, Failures: 2, Skipped: 2.
Test cases on Linux:
PHPUnit 3.6.4 by Sebastian Bergmann.
Configuration read from /root/GeonamesBundle/phpunit.xml.dist
..........................
Time: 3 seconds, Memory: 3.25Mb
OK (26 tests, 135 assertions)
I've had a quick look through CurlDownload but I can't see what's doing it.
Got error " [LogicException] You can't regress the progress bar" when running geonames:import.
#0 vendor/giosh94mhz/geonames-bundle/Giosh94mhz/GeonamesBundle/Event/ImportOutputSubscriber.php(158): Symfony\Component\Console\Helper\ProgressHelper->setCurrent(-4)
#1 vendor/giosh94mhz/geonames-bundle/Giosh94mhz/GeonamesBundle/Event/ImportOutputSubscriber.php(94): Giosh94mhz\GeonamesBundle\Event\ImportOutputSubscriber->progress(-4, -4)
#2 [internal function]: Giosh94mhz\GeonamesBundle\Event\ImportOutputSubscriber->onDownloadProgress(Object(Giosh94mhz\GeonamesBundle\Event\OnProgressEvent), 'geonames.import...', Object(Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher))
#3 vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php(392): call_user_func(Array, Object(Giosh94mhz\GeonamesBundle\Event\OnProgressEvent), 'geonames.import...', Object(Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher))
#4 [internal function]: Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->Symfony\Component\HttpKernel\Debug\{closure}(Object(Giosh94mhz\GeonamesBundle\Event\OnProgressEvent), 'geonames.import...', Object(Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher))
#5 vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php(164): call_user_func(Object(Closure), Object(Giosh94mhz\GeonamesBundle\Event\OnProgressEvent), 'geonames.import...', Object(Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher))
#6 vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php(53): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'geonames.import...', Object(Giosh94mhz\GeonamesBundle\Event\OnProgressEvent))
#7 vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php(167): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('geonames.import...', Object(Giosh94mhz\GeonamesBundle\Event\OnProgressEvent))
#8 vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php(139): Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('geonames.import...', Object(Giosh94mhz\GeonamesBundle\Event\OnProgressEvent))
#9 vendor/giosh94mhz/geonames-bundle/Giosh94mhz/GeonamesBundle/Import/ImportDirector.php(144): Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->dispatch('geonames.import...', Object(Giosh94mhz\GeonamesBundle\Event\OnProgressEvent))
#10 [internal function]: Giosh94mhz\GeonamesBundle\Import\ImportDirector->Giosh94mhz\GeonamesBundle\Import\{closure}(-4, -4)
#11 vendor/giosh94mhz/geonames-bundle/Giosh94mhz/GeonamesBundle/Utils/CurlDownload.php(132): call_user_func(Object(Closure), -4, -4)
#12 [internal function]: Giosh94mhz\GeonamesBundle\Utils\CurlDownload->Giosh94mhz\GeonamesBundle\Utils\{closure}(0, 0)
#13 vendor/giosh94mhz/geonames-bundle/Giosh94mhz/GeonamesBundle/Utils/CurlDownload.php(146): call_user_func(Object(Closure), 0, 0)
#14 [internal function]: Giosh94mhz\GeonamesBundle\Utils\CurlDownload->Giosh94mhz\GeonamesBundle\Utils\{closure}(0, 0, 0, 0)
#15 vendor/giosh94mhz/geonames-bundle/Giosh94mhz/GeonamesBundle/Utils/CurlDownload.php(242): curl_multi_exec(Resource id #426, 4)
#16 vendor/giosh94mhz/geonames-bundle/Giosh94mhz/GeonamesBundle/Utils/CurlDownload.php(153): Giosh94mhz\GeonamesBundle\Utils\CurlDownload->curlMultiDownload(Array)
#17 vendor/giosh94mhz/geonames-bundle/Giosh94mhz/GeonamesBundle/Import/ImportDirector.php(148): Giosh94mhz\GeonamesBundle\Utils\CurlDownload->download()
#18 vendor/giosh94mhz/geonames-bundle/Giosh94mhz/GeonamesBundle/Import/ImportDirector.php(59): Giosh94mhz\GeonamesBundle\Import\ImportDirector->download()
#19 vendor/giosh94mhz/geonames-bundle/Giosh94mhz/GeonamesBundle/Command/AbstractImportCommand.php(50): Giosh94mhz\GeonamesBundle\Import\ImportDirector->import()
#20 vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php(241): Giosh94mhz\GeonamesBundle\Command\AbstractImportCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(888): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(191): Symfony\Component\Console\Application->doRunCommand(Object(Giosh94mhz\GeonamesBundle\Command\ImportCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(96): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(121): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 app/console(27): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
#26 {main}./console geonames:import
The cause is that curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD)
returns -1 when download size not known at line 105 in CurlDownload.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.