Compare commits

..

No commits in common. "bbc093b4973e9958dc30d87617481035dfd78718" and "6ae06b47650d2ae9eaed243810e0fc30720134e7" have entirely different histories.

5 changed files with 4 additions and 54 deletions

View file

@ -12,8 +12,7 @@
"search",
"templates",
"css",
"database",
"analytics"
"database"
]
}
}

View file

@ -8,7 +8,7 @@ interface AnalyticsInterface {
public function log_path_access(
$path,
$agent,
$referrer, $runtime, $status = 200);
$referrer, $runtime);
public function log_path_errcode(
$path,

View file

@ -72,7 +72,7 @@ class MySQLAnalyticsHandler
$path,
$agent,
$referrer,
$time, $status = 200) {
$time) {
if(strlen($path) == 0) {
$path = '/';
@ -83,7 +83,6 @@ class MySQLAnalyticsHandler
'path' => $path,
'agent' => $agent,
'referrer' => $referrer,
'status' => $status
], 'access_sum');
$this->increment_counter([

View file

@ -107,8 +107,6 @@ if($REQUEST_PATH == '/search/') {
$post = $adapter->get_post($REQUEST_PATH);
if(!isset($post)) {
$analytics_return_status = 404;
$error_page = $SITE_CONFIG['site_defaults'];
$error_page['path'] = '/404';
$error_page['title'] = '404 oh no';

View file

@ -5,25 +5,6 @@ $data_time_start = microtime(true);
$analytics_enable_tail = false;
$analytics_post = null;
$analytics_return_status = 200;
$analytics_known_bogus_requests = [
'/\.(git|env|aws|xmlrpc|well-known|svn)/',
'/^\/wp-/',
'/^\/ID3/',
'/^\/config/',
'/^\/web\.config/',
'/^\/storage/',
'/^\/web\/config\.php/',
'/^\/phpinfo\.php/',
'/^\/swagger\.json/',
'/^\/package\.json/',
'/^\/info\.php/',
'/^\/db\.ini/',
'/^\/administrator/'
];
$analytics_request_is_bogus = null;
function deduce_user_agent() {
$real_agent=$_SERVER['HTTP_USER_AGENT'];
@ -38,27 +19,6 @@ function deduce_user_agent() {
}
}
function analytics_is_bogus_request() {
global $analytics_request_is_bogus;
global $analytics_known_bogus_requests;
global $REQUEST_PATH;
if(isset($analytics_request_is_bogus)) {
return $analytics_request_is_bogus;
}
foreach($analytics_known_bogus_requests AS $bogus_check) {
if(preg_match($bogus_check, $REQUEST_PATH)) {
$analytics_request_is_bogus = true;
return true;
}
}
$analytics_request_is_bogus = false;
return false;
}
function analytics_is_user() {
return preg_match('/^user/', deduce_user_agent());
}
@ -74,8 +34,6 @@ register_shutdown_function(function() {
global $analytics_enable_tail;
global $analytics_return_status;
$data_time_end = microtime(true);
$http_referer = 'magic';
@ -87,14 +45,10 @@ register_shutdown_function(function() {
$compute_time = $data_time_end - $data_time_start;
if(analytics_is_bogus_request()) {
$analytics_return_status = 'bogus';
}
$analytics_adapter->log_path_access($REQUEST_PATH,
deduce_user_agent(),
$referrer,
$compute_time, $analytics_return_status);
$compute_time);
if($analytics_enable_tail) {
echo "<!-- Total page time was: " . $compute_time . " -->";