(Pawtucket 1.7.15) Ok, while waiting for an expert with a more elegant and functional solution, I’m sharing the solution I found, although I honestly don’t know how good it is.
STEP 1 : In Providence, I created a new user with only public access, and in the ca_user
table, it was assigned user_id
5 (this is my case, but everyone should check theirs).
STEP 2 : Then, I modified the log($pa_entry)
function in the file /pawtucket/app/lib/Logging/SearchLog.php
, ensuring that if user_id
is null, it is set to 5 (the user_id
of the user created for this purpose).
The original function is:
public function log($pa_entry) {
if (is_array($pa_entry)) {
$this->o_db->query("
INSERT INTO ca_search_log
(log_datetime, user_id, table_num, search_expression, num_hits, form_id, ip_addr, details, execution_time, search_source)
VALUES
(unix_timestamp(), ?, ?, ?, ?, ?, ?, ?, ?, ?)
", $pa_entry['user_id'], $pa_entry['table_num'], substr($pa_entry['search_expression'], 0, 255), $pa_entry['num_hits'], $pa_entry['form_id'], $pa_entry['ip_addr'], $pa_entry['details'], $pa_entry['execution_time'], $pa_entry['search_source']);
return true;
}
return false;
}
While the modified one is:
public function log($pa_entry) {
if (is_array($pa_entry)) {
// if user_id is nullo or do not exist, assign value 5
if (empty($pa_entry['user_id'])) {
$pa_entry['user_id'] = 5;
}
$this->o_db->query("
INSERT INTO ca_search_log
(log_datetime, user_id, table_num, search_expression, num_hits, form_id, ip_addr, details, execution_time, search_source)
VALUES
(unix_timestamp(), ?, ?, ?, ?, ?, ?, ?, ?, ?)
", $pa_entry['user_id'], $pa_entry['table_num'], substr($pa_entry['search_expression'], 0, 255), $pa_entry['num_hits'], $pa_entry['form_id'], $pa_entry['ip_addr'], $pa_entry['details'], $pa_entry['execution_time'], $pa_entry['search_source']);
return true;
}
return false;
}
Personally, I don’t know how secure this procedure is, but for now, I’ll settle for it. Use it at your own risk.