Conditions | 3 |
Paths | 6 |
Total Lines | 25 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Tests | 17 |
CRAP Score | 3.0303 |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
17 | 1 | public static function postInstall() |
|
18 | { |
||
19 | 1 | echo "\n"; |
|
20 | 1 | $cityUpdateError = false; |
|
21 | 1 | $updater = new Updater(); |
|
22 | $updater |
||
23 | 1 | ->getFileManager() |
|
24 | 1 | ->getDownloader() |
|
25 | 1 | ->setAdapter(Downloader::ADAPTER_CURL) |
|
26 | 1 | ->displayProgress(true); |
|
27 | 1 | self::output('Update maxmind databases started'); |
|
28 | try { |
||
29 | 1 | self::output('Updating city'); |
|
30 | 1 | $updater->setAdapter(Updater::ADAPTER_CITY)->update(); |
|
31 | } catch (\Exception $e) { |
||
32 | $cityUpdateError = true; |
||
33 | self::output('Download from maxmind failed : ' . $e->getMessage()); |
||
34 | } |
||
35 | 1 | if (!$cityUpdateError) { |
|
36 | 1 | self::output('Updating country'); |
|
37 | 1 | $updater->setAdapter(Updater::ADAPTER_COUNTRY)->update(); |
|
38 | 1 | self::output('Updating asn'); |
|
39 | 1 | $updater->setAdapter(Updater::ADAPTER_ASN)->update(); |
|
40 | } |
||
41 | 1 | self::output('Update maxmind databases finished'); |
|
42 | } |
||
56 |