diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-04-20 02:44:23 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-04-20 02:44:23 +0300 |
commit | 2dd1a7b9ab1b0060065e13f32c2ef22c851f75da (patch) | |
tree | f1571c38be9d1e015a29299920456053d73a26b2 | |
parent | 060fe92c83ae9631cab08186b50c25ede88ecb4c (diff) |
#7674 The spammers list is now in a separate repository
-rw-r--r-- | composer.json | 3 | ||||
-rw-r--r-- | composer.lock | 26 | ||||
-rw-r--r-- | core/Tracker/Visit/SpamFilter.php | 20 |
3 files changed, 34 insertions, 15 deletions
diff --git a/composer.json b/composer.json index 7acbf4508f..f452c42abc 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,8 @@ "symfony/monolog-bridge": "~2.6", "symfony/event-dispatcher": "~2.6", "pear/pear_exception": "~1.0.0", - "pear/pear-core-minimal": "~1.9.5" + "pear/pear-core-minimal": "~1.9.5", + "piwik/referrer-spam-blacklist": "~1.0" }, "require-dev": { "aws/aws-sdk-php": "2.7.1", diff --git a/composer.lock b/composer.lock index 48e17c8f11..442f059680 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "f0c9c70091696d6197a4c438b9c12860", + "hash": "5033f5c1e5d1d67add5f5e75bbe59aaf", "packages": [ { "name": "container-interop/container-interop", @@ -926,6 +926,28 @@ "time": "2014-10-23 03:30:23" }, { + "name": "piwik/referrer-spam-blacklist", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/piwik/referrer-spam-blacklist.git", + "reference": "4508617435cd8b93c0fbd0fd430dc24d2a898cdb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/piwik/referrer-spam-blacklist/zipball/4508617435cd8b93c0fbd0fd430dc24d2a898cdb", + "reference": "4508617435cd8b93c0fbd0fd430dc24d2a898cdb", + "shasum": "" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Public Domain" + ], + "description": "Community-contributed list of referrer spammers", + "time": "2015-04-19 23:20:51" + }, + { "name": "psr/log", "version": "1.0.0", "source": { @@ -1384,7 +1406,7 @@ "performance", "profiling" ], - "time": "2015-02-26 14:37:51" + "time": "2014-08-28 17:34:52" }, { "name": "guzzle/guzzle", diff --git a/core/Tracker/Visit/SpamFilter.php b/core/Tracker/Visit/SpamFilter.php index 5ec458014d..58af8c31fe 100644 --- a/core/Tracker/Visit/SpamFilter.php +++ b/core/Tracker/Visit/SpamFilter.php @@ -44,19 +44,15 @@ class SpamFilter return $this->spammerList; } - $userFile = StaticContainer::get('path.tmp') . '/spammers.txt'; - if (file_exists($userFile)) { - $this->spammerList = file($userFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + $file = StaticContainer::get('path.tmp') . '/spammers.txt'; + if (!file_exists($file)) { + $file = PIWIK_INCLUDE_PATH . '/vendor/piwik/referrer-spam-blacklist/spammers.txt'; + } - if (!is_array($this->spammerList)) { - throw new \Exception(sprintf('The file %s does not contain a JSON array', $userFile)); - } - } else { - // TODO - $this->spammerList = array( - '4webmasters.org', - '7makemoneyonline.com', - ); + $this->spammerList = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + + if (!is_array($this->spammerList)) { + throw new \Exception(sprintf('The file %s does not contain a JSON array', $file)); } return $this->spammerList; |