Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
smart_ip
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
smart_ip
Commits
129a173c
Commit
129a173c
authored
4 years ago
by
Travis Musika
Committed by
arpeggio
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3192476
by tmusika: Made Maxmind GeoLite2 DB updated weekly
parent
3a3ce43e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/smart_ip_maxmind_geoip2_bin_db/src/EventSubscriber/SmartIpEventSubscriber.php
+6
-14
6 additions, 14 deletions
...ip2_bin_db/src/EventSubscriber/SmartIpEventSubscriber.php
with
6 additions
and
14 deletions
modules/smart_ip_maxmind_geoip2_bin_db/src/EventSubscriber/SmartIpEventSubscriber.php
+
6
−
14
View file @
129a173c
...
...
@@ -235,11 +235,9 @@ class SmartIpEventSubscriber extends SmartIpEventSubscriberBase {
'#title'
=>
$autoDbUpdateLabel
,
'#description'
=>
t
(
'MaxMind GeoIP2 binary database will be automatically updated via
cron.php every Wednesday (for licensed version) and every first
Wednesday of the month (for lite or free version). MaxMind GeoIP2
updates their database every Tuesday for licensed version and every
first Tuesday of the month for lite or free version. @cron must be
enabled for this to work.'
,
[
cron.php every Wednesday (for licensed and lite/free versions).
MaxMind GeoIP2 updates their database every Tuesday for licensed
and free versions. @cron must be enabled for this to work.'
,
[
'@cron'
=>
Link
::
fromTextAndUrl
(
t
(
'Cron'
),
Url
::
fromRoute
(
'system.cron_settings'
))
->
toString
(),
]
),
...
...
@@ -382,9 +380,8 @@ class SmartIpEventSubscriber extends SmartIpEventSubscriberBase {
}
/**
* MaxMind GeoIP2 updates the binary database every Tuesday, and we download
* every Wednesday for licensed version. Every first Tuesday of the month for
* lite or free version, and we download every first Wednesday of the month.
* MaxMind GeoIP2 updates the binary database every Tuesday (both lite and
* licensed versions), and we download every Wednesday.
* That means that we only want to download if the current database was
* downloaded prior to the most recently available version.
*/
...
...
@@ -395,12 +392,7 @@ class SmartIpEventSubscriber extends SmartIpEventSubscriberBase {
$autoUpdate
=
$config
->
get
(
'db_auto_update'
);
$version
=
$config
->
get
(
'version'
);
$lastUpdateTime
=
\Drupal
::
state
()
->
get
(
'smart_ip_maxmind_geoip2_bin_db.last_update_time'
)
?:
0
;
if
(
$version
==
MaxmindGeoip2BinDb
::
LINCENSED_VERSION
)
{
$frequency
=
DatabaseFileUtility
::
DOWNLOAD_WEEKLY
;
}
elseif
(
$version
==
MaxmindGeoip2BinDb
::
LITE_VERSION
)
{
$frequency
=
DatabaseFileUtility
::
DOWNLOAD_MONTHLY
;
}
$frequency
=
DatabaseFileUtility
::
DOWNLOAD_WEEKLY
;
if
(
DatabaseFileUtility
::
needsUpdate
(
$lastUpdateTime
,
$autoUpdate
,
$frequency
))
{
DatabaseFileUtility
::
downloadDatabaseFile
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment