cache to minimize SQL queries in modlog
This commit is contained in:
parent
9ff35f9bc5
commit
7110deb091
9
mod.php
9
mod.php
@ -296,6 +296,12 @@
|
||||
'<th>' . _('Action') . '</th>' .
|
||||
'</tr>';
|
||||
while($log = $query->fetch()) {
|
||||
$log_id = 'log_' . md5($log['text']);
|
||||
|
||||
if($_log = cache::get($log_id))
|
||||
$log['text'] = $_log;
|
||||
else {
|
||||
|
||||
$log['text'] = utf8tohtml($log['text']);
|
||||
$log['text'] = preg_replace('/(\d+\.\d+\.\d+\.\d+)/', '<a href="?/IP/$1">$1</a>', $log['text']);
|
||||
|
||||
@ -314,6 +320,9 @@
|
||||
sprintf($config['file_page'], $post['thread']) . '#' . $match[1]
|
||||
: sprintf($config['file_page'], $match[1])) .
|
||||
'">$0</a>', $log['text']);
|
||||
|
||||
cache::set($log_id, $log['text']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user