From e96eab3c1b490c1265f6153404a25decd0f09354 Mon Sep 17 00:00:00 2001 From: SJ Date: Tue, 23 Oct 2012 19:11:49 +0200 Subject: [PATCH] added an option to syslog sphinx queries --- webui/config.php | 2 +- webui/index.php | 3 +++ webui/model/search/search.php | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/webui/config.php b/webui/config.php index 79b78970..54a26a7f 100644 --- a/webui/config.php +++ b/webui/config.php @@ -18,7 +18,7 @@ define('ENABLE_FOLDER_RESTRICTIONS', 0); define('ENABLE_GOOGLE_LOGIN', 0); define('SEARCH_RESULT_CHECKBOX_CHECKED', 1); define('HELPER_URL', ''); - +define('ENABLE_SYSLOG', 0); define('GOOGLE_CLIENT_ID', 'xxxxxxxxxxx'); define('GOOGLE_CLIENT_SECRET', 'xxxxxxxxxxxxx'); define('GOOGLE_DEVELOPER_KEY', 'xxxxxxxxxxxx'); diff --git a/webui/index.php b/webui/index.php index 68ac1ba1..6eb96213 100644 --- a/webui/index.php +++ b/webui/index.php @@ -32,6 +32,9 @@ $language = new Language(); Registry::set('language', $language); +if(ENABLE_SYSLOG == 1) { openlog("piler-webui", LOG_PID, LOG_MAIL); } + + /* check if user has authenticated himself. If not, we send him to login */ Registry::set('username', getAuthenticatedUsername()); diff --git a/webui/model/search/search.php b/webui/model/search/search.php index bba226d9..05b73197 100644 --- a/webui/model/search/search.php +++ b/webui/model/search/search.php @@ -303,7 +303,7 @@ class ModelSearchSearch extends Model { $query = $this->sphx->query("SELECT id FROM " . SPHINX_MAIN_INDEX . " WHERE $a $date $attachment $direction $size $folders MATCH('$match') $sortorder LIMIT 0," . MAX_SEARCH_HITS); } -//print $query->query; print "

" . $query->exec_time . "

\n"; + if(ENABLE_SYSLOG == 1) { syslog(LOG_INFO, sprintf("sphinx query: %s in %.2f s", $query->query, $query->exec_time)); } /*