Revert "Revert "smart_build: buildThread" (for a moment, something b0rks)"
This reverts commit b246daa191
.
This commit is contained in:
parent
99706835c2
commit
67db118f1e
@ -2068,6 +2068,7 @@ function buildThread($id, $return = false, $mod = false) {
|
|||||||
cache::delete("thread_{$board['uri']}_{$id}");
|
cache::delete("thread_{$board['uri']}_{$id}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$config['smart_build'] || $return || $mod) {
|
||||||
$query = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE (`thread` IS NULL AND `id` = :id) OR `thread` = :id ORDER BY `thread`,`id`", $board['uri']));
|
$query = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE (`thread` IS NULL AND `id` = :id) OR `thread` = :id ORDER BY `thread`,`id`", $board['uri']));
|
||||||
$query->bindValue(':id', $id, PDO::PARAM_INT);
|
$query->bindValue(':id', $id, PDO::PARAM_INT);
|
||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
@ -2111,8 +2112,18 @@ function buildThread($id, $return = false, $mod = false) {
|
|||||||
$jsonFilename = $board['dir'] . $config['dir']['res'] . $id . '.json';
|
$jsonFilename = $board['dir'] . $config['dir']['res'] . $id . '.json';
|
||||||
file_write($jsonFilename, $json);
|
file_write($jsonFilename, $json);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$jsonFilename = $board['dir'] . $config['dir']['res'] . $id . '.json';
|
||||||
|
file_unlink($jsonFilename);
|
||||||
|
}
|
||||||
|
|
||||||
if ($return) {
|
if ($config['smart_build'] && !$return && !$mod) {
|
||||||
|
$noko50fn = $board['dir'] . $config['dir']['res'] . link_for(array('id' => $id), true);
|
||||||
|
file_unlink($noko50fn);
|
||||||
|
|
||||||
|
file_unlink($board['dir'] . $config['dir']['res'] . link_for(array('id' => $id)));
|
||||||
|
} else if ($return) {
|
||||||
return $body;
|
return $body;
|
||||||
} else {
|
} else {
|
||||||
$noko50fn = $board['dir'] . $config['dir']['res'] . link_for($thread, true);
|
$noko50fn = $board['dir'] . $config['dir']['res'] . link_for($thread, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user