1 | <?php |
||
14 | class GeoIp2Database implements GeoIpDatabaseInterface |
||
15 | { |
||
16 | /** |
||
17 | * Database alias |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | public $databaseAlias = '@app/runtime'; |
||
22 | |||
23 | /** |
||
24 | * GeoLite database download URL |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | public $databaseDownloadUrl = 'http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz'; |
||
29 | |||
30 | /** |
||
31 | * Database alias |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | public $databaseFilename = 'GeoLite2-City.mmdb'; |
||
36 | |||
37 | /** |
||
38 | * Database full file name |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | private $databaseFullFilename; |
||
43 | |||
44 | /** |
||
45 | * Checks if DB-file exists and it is actual. Ff not then it starts file update |
||
46 | * |
||
47 | * @return bool |
||
48 | */ |
||
49 | public function hasDbFile(): bool |
||
68 | |||
69 | /** |
||
70 | * Downloads and unpacks fresh IP database file in the background process |
||
71 | */ |
||
72 | public function updateDbFile() |
||
89 | |||
90 | /** |
||
91 | * Gets local database's file name |
||
92 | * |
||
93 | * @return string |
||
94 | */ |
||
95 | public function getFileName() |
||
103 | } |
||
104 |