Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-07-25 14:29:54 +0200
committerErich Eckner <git@eckner.net>2019-07-25 14:29:54 +0200
commitbe0e7c8498c3f065c9dbdc1300b84d41b2aa6739 (patch)
treea322ef48b2e22c24b3c6ec57c26dfbc1213ff17c
parent161d73af81750c5cd27bee032ae54174ca895609 (diff)
lib/mysql.php: abort_iff_webspider() new - for now only logging the user agent
-rw-r--r--buildmaster/build-list-links.php2
-rw-r--r--buildmaster/build-list.php2
-rw-r--r--buildmaster/build-log.php2
-rw-r--r--buildmaster/build-slaves.php2
-rw-r--r--buildmaster/deletion-links.php2
-rw-r--r--buildmaster/dependencies.php2
-rw-r--r--buildmaster/execution-times.php2
-rw-r--r--buildmaster/log.php1
-rw-r--r--buildmaster/mysql-issues.php2
-rw-r--r--buildmaster/statistics.php2
-rw-r--r--buildmaster/status.php2
-rw-r--r--buildmaster/to-delete.php2
-rw-r--r--lib/mysql.php12
-rw-r--r--packages/differences.php2
14 files changed, 37 insertions, 0 deletions
diff --git a/buildmaster/build-list-links.php b/buildmaster/build-list-links.php
index e707ba4..10304e4 100644
--- a/buildmaster/build-list-links.php
+++ b/buildmaster/build-list-links.php
@@ -2,6 +2,8 @@
require_once "../init.php";
require_once BASE . "/lib/mysql.php";
+abort_iff_webspider();
+
$edges = "";
$knots = "";
$filter = "1";
diff --git a/buildmaster/build-list.php b/buildmaster/build-list.php
index 2eaf08a..9da07bd 100644
--- a/buildmaster/build-list.php
+++ b/buildmaster/build-list.php
@@ -5,6 +5,8 @@ require_once BASE . "/lib/helper.php";
require_once BASE . "/lib/mysql.php";
require_once BASE . "/lib/style.php";
+abort_iff_webspider();
+
$filter = " WHERE ";
if (array_key_exists("invq", $_GET))
diff --git a/buildmaster/build-log.php b/buildmaster/build-log.php
index e3fdaef..89655e4 100644
--- a/buildmaster/build-log.php
+++ b/buildmaster/build-log.php
@@ -5,6 +5,8 @@ require_once BASE . "/lib/http.php";
require_once BASE . "/lib/helper.php";
require_once BASE . "/lib/mysql.php";
+abort_iff_webspider();
+
$extra_joins = '';
$filter = 'WHERE 1';
diff --git a/buildmaster/build-slaves.php b/buildmaster/build-slaves.php
index 7a8a9f2..1285fb8 100644
--- a/buildmaster/build-slaves.php
+++ b/buildmaster/build-slaves.php
@@ -3,6 +3,8 @@ require_once "../init.php";
require_once BASE . "/lib/style.php";
require_once BASE . "/lib/mysql.php";
+abort_iff_webspider();
+
$columns = array(
"name" => array(
"label" => "name",
diff --git a/buildmaster/deletion-links.php b/buildmaster/deletion-links.php
index 3a82c4e..f2e1644 100644
--- a/buildmaster/deletion-links.php
+++ b/buildmaster/deletion-links.php
@@ -3,6 +3,8 @@ require_once "../init.php";
require_once BASE . "/lib/helper.php";
require_once BASE . "/lib/mysql.php";
+abort_iff_webspider();
+
$edges = "";
$knots = "";
diff --git a/buildmaster/dependencies.php b/buildmaster/dependencies.php
index c513f2d..336a26f 100644
--- a/buildmaster/dependencies.php
+++ b/buildmaster/dependencies.php
@@ -2,6 +2,8 @@
require_once "../init.php";
require_once BASE . "/lib/mysql.php";
+abort_iff_webspider();
+
$match = "";
function dependency_arch_join($name) {
diff --git a/buildmaster/execution-times.php b/buildmaster/execution-times.php
index 3ef4f2a..cbe1cd5 100644
--- a/buildmaster/execution-times.php
+++ b/buildmaster/execution-times.php
@@ -3,6 +3,8 @@
require_once '../init.php';
require_once BASE . '/lib/mysql.php';
+abort_iff_webspider();
+
$result = mysql_run_query(
'SELECT' .
' UNIX_TIMESTAMP(`ssh_log`.`date`) AS `date`,' .
diff --git a/buildmaster/log.php b/buildmaster/log.php
index 6235b06..0653632 100644
--- a/buildmaster/log.php
+++ b/buildmaster/log.php
@@ -2,6 +2,7 @@
require_once "../init.php";
require_once BASE . "/lib/mysql.php";
+abort_iff_webspider();
$filter = "";
if (array_key_exists("show", $_GET) &&
diff --git a/buildmaster/mysql-issues.php b/buildmaster/mysql-issues.php
index f84d9f5..f41ab8a 100644
--- a/buildmaster/mysql-issues.php
+++ b/buildmaster/mysql-issues.php
@@ -2,6 +2,8 @@
require_once "../init.php";
require_once BASE . "/lib/mysql.php";
+abort_iff_webspider();
+
$ignore = "";
if (array_key_exists("ignore-haskell", $_GET))
diff --git a/buildmaster/statistics.php b/buildmaster/statistics.php
index f867973..d16263b 100644
--- a/buildmaster/statistics.php
+++ b/buildmaster/statistics.php
@@ -2,6 +2,8 @@
require_once '../init.php';
require_once BASE . '/lib/mysql.php';
+abort_iff_webspider();
+
if (array_key_exists('from', $_GET))
$min_time = 'from_base64("' . base64_encode('-' . $_GET['from']) . '")';
else
diff --git a/buildmaster/status.php b/buildmaster/status.php
index 05a4455..7dfbc48 100644
--- a/buildmaster/status.php
+++ b/buildmaster/status.php
@@ -4,6 +4,8 @@ include BASE . "/lib/mysql.php";
include BASE . "/lib/style.php";
include BASE . "/lib/helper.php";
+abort_iff_webspider();
+
$result = mysql_run_query(
"SELECT MAX(`package_sources`.`commit_time`) AS `last_commit`" .
" FROM `package_sources`"
diff --git a/buildmaster/to-delete.php b/buildmaster/to-delete.php
index 8458c74..f287ce5 100644
--- a/buildmaster/to-delete.php
+++ b/buildmaster/to-delete.php
@@ -3,6 +3,8 @@ require_once "../init.php";
require_once BASE . "/lib/helper.php";
require_once BASE . "/lib/mysql.php";
+abort_iff_webspider();
+
$result = mysql_run_query(
"SELECT " .
"`repositories`.`name` AS `repo`," .
diff --git a/lib/mysql.php b/lib/mysql.php
index ca683d8..7564a3d 100644
--- a/lib/mysql.php
+++ b/lib/mysql.php
@@ -98,3 +98,15 @@ function arch_filter_query($table) {
$arch_filter .= ")";
return $arch_filter;
}
+
+function abort_iff_webspider() {
+ if (($fp = fopen(BASE . '/user-agent-log', 'a')) !== false) {
+ flock($fp, LOCK_EX);
+ fwrite($fp,
+ date('Y-m-d H:i:s') . " " .
+ $_SERVER['HTTP_USER_AGENT'] . "\n"
+ );
+ flock($fp, LOCK_UN);
+ fclose($fp);
+ }
+}
diff --git a/packages/differences.php b/packages/differences.php
index 0673715..9dbb51c 100644
--- a/packages/differences.php
+++ b/packages/differences.php
@@ -6,6 +6,8 @@ require_once BASE . "/lib/helper.php";
require_once BASE . "/lib/style.php";
require_once BASE . "/lib/mysql.php";
+abort_iff_webspider();
+
$uri_parts = explode('?', $_SERVER['REQUEST_URI'], 2);
if (count($uri_parts) > 1)
$options = $uri_parts[1];