Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-12-06 00:26:30 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-12-06 00:26:30 (GMT)
commit5910622a72a3804d6c69ebd236fa5222c46b051e (patch)
treefaa4066e113d1d28a980cc54ca21c33ec92b7fa7
parente5d56c2045d2c7070ce2f37c0c9a1e8474a7d5c6 (diff)
Move blacklist timeout to config.phpproxy
-rw-r--r--aslo/config.php17
-rwxr-xr-xaslo/cron/parse_logs14
-rw-r--r--bin/parse_logs/count_downloads.class.php2
3 files changed, 32 insertions, 1 deletions
diff --git a/aslo/config.php b/aslo/config.php
new file mode 100644
index 0000000..01fd95a
--- /dev/null
+++ b/aslo/config.php
@@ -0,0 +1,17 @@
+<?php
+
+/**
+ * DB_USER, DB_PASS, DB_NAME, DB_HOST, DB_PORT
+ * This database has read/write capabilities. Host and port default to localhost and 3306.
+ */
+define('DB_HOST', '127.0.0.1');
+define('DB_PORT', '3306');
+define('DB_USER', 'remora');
+define('DB_PASS', 'remora');
+define('DB_NAME', 'remora');
+
+/**
+ * Timeout which blacklists downloads from the same IP
+ */
+define('SITE_BLACKLIST_TIMEOUT', 5);
+?>
diff --git a/aslo/cron/parse_logs b/aslo/cron/parse_logs
new file mode 100755
index 0000000..b4b870e
--- /dev/null
+++ b/aslo/cron/parse_logs
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+root=$(dirname $(dirname $(dirname $(readlink --canonicalize-missing $0))))
+
+cd $root/bin
+
+for type in downloads updatepings; do
+ php -f parse_logs/parse_logs.php \
+ logs=$root/data/ \
+ temp=/tmp \
+ type=$type \
+ date=$(date --date=yesterday +%Y%m%d) \
+ geo=US v=v
+done
diff --git a/bin/parse_logs/count_downloads.class.php b/bin/parse_logs/count_downloads.class.php
index 9274654..e74fcf1 100644
--- a/bin/parse_logs/count_downloads.class.php
+++ b/bin/parse_logs/count_downloads.class.php
@@ -154,7 +154,7 @@ class Count_Downloads {
*/
function cleanIPs($currentTime) {
foreach ($this->countedIPs as $ip => $downloadTime) {
- if (($currentTime - $downloadTime) > 30)
+ if (($currentTime - $downloadTime) > SITE_BLACKLIST_TIMEOUT)
unset($this->countedIPs[$ip]);
}
}