... (cache)
This commit is contained in:
parent
4aa1d387f8
commit
7623de9e2f
@ -2479,16 +2479,25 @@ function link_for($post, $page50 = false, $foreignlink = false, $thread = false)
|
|||||||
$slug = false;
|
$slug = false;
|
||||||
|
|
||||||
if ($config['slugify'] && isset($post['thread']) && $post['thread']) {
|
if ($config['slugify'] && isset($post['thread']) && $post['thread']) {
|
||||||
|
$cvar = "slug_".$b['uri']."_".$id;
|
||||||
if (!$thread) {
|
if (!$thread) {
|
||||||
// Oh fuck, we'd better optimize it ASAP
|
$slug = Cache::get($cvar);
|
||||||
|
|
||||||
$query = prepare(sprintf("SELECT `slug` FROM ``posts_%s`` WHERE `id` = :id", $b['uri']));
|
if ($slug === false) {
|
||||||
$query->bindValue(':id', $id, PDO::PARAM_INT);
|
$query = prepare(sprintf("SELECT `slug` FROM ``posts_%s`` WHERE `id` = :id", $b['uri']));
|
||||||
$query->execute() or error(db_error($query));
|
$query->bindValue(':id', $id, PDO::PARAM_INT);
|
||||||
|
$query->execute() or error(db_error($query));
|
||||||
|
|
||||||
$thread = $query->fetch(PDO::FETCH_ASSOC);
|
$thread = $query->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
$slug = $thread['slug'];
|
||||||
|
|
||||||
|
Cache::set($cvar, $slug);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$slug = $thread['slug'];
|
||||||
}
|
}
|
||||||
$slug = $thread['slug'];
|
|
||||||
}
|
}
|
||||||
elseif ($config['slugify']) {
|
elseif ($config['slugify']) {
|
||||||
$slug = $post['slug'];
|
$slug = $post['slug'];
|
||||||
|
Loading…
Reference in New Issue
Block a user