diff options
| author | czaks <marcin@6irc.net> | 2015-03-31 09:17:22 +0200 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2015-03-31 09:21:16 +0200 |
| commit | 6cbd51b83c46b103624690ebe14846c02f542d68 (patch) | |
| tree | a82cf17b22389841489c8163d058a1d2ac8a5da4 | |
| parent | d94143b6c67e1c48fee2f6ecb549fd3197a66378 (diff) | |
for fastcgi users: rearrange post.php, sort of, so that posts are created faster, and we can leave php to generate themes in the background
same for post deletion
| -rw-r--r-- | post.php | 51 |
1 files changed, 30 insertions, 21 deletions
@@ -92,18 +92,22 @@ if (isset($_POST['delete'])) { buildIndex(); - - rebuildThemes('post-delete', $board['uri']); - $is_mod = isset($_POST['mod']) && $_POST['mod']; $root = $is_mod ? $config['root'] . $config['file_mod'] . '?/' : $config['root']; - + if (!isset($_POST['json_response'])) { header('Location: ' . $root . $board['dir'] . $config['file_index'], true, $config['redirect_http']); } else { header('Content-Type: text/json'); echo json_encode(array('success' => true)); } + + // We are already done, let's continue our heavy-lifting work in the background (if we run off FastCGI) + if (function_exists('fastcgi_finish_request')) + @fastcgi_finish_request(); + + rebuildThemes('post-delete', $board['uri']); + } elseif (isset($_POST['report'])) { if (!isset($_POST['board'], $_POST['reason'])) error($config['error']['bot']); @@ -827,18 +831,6 @@ if (isset($_POST['delete'])) { bumpThread($post['thread']); } - buildThread($post['op'] ? $id : $post['thread']); - - if ($config['try_smarter'] && $post['op']) - $build_pages = range(1, $config['max_pages']); - - if ($post['op']) - clean(); - - event('post-after', $post); - - buildIndex(); - if (isset($_SERVER['HTTP_REFERER'])) { // Tell Javascript that we posted successfully if (isset($_COOKIE[$config['cookies']['js']])) @@ -875,6 +867,8 @@ if (isset($_POST['delete'])) { $redirect = $root . $board['dir'] . $config['file_index']; } + + buildThread($post['op'] ? $id : $post['thread']); if ($config['syslog']) _syslog(LOG_INFO, 'New post: /' . $board['dir'] . $config['dir']['res'] . @@ -882,11 +876,6 @@ if (isset($_POST['delete'])) { if (!$post['mod']) header('X-Associated-Content: "' . $redirect . '"'); - if ($post['op']) - rebuildThemes('post-thread', $board['uri']); - else - rebuildThemes('post', $board['uri']); - if (!isset($_POST['json_response'])) { header('Location: ' . $redirect, true, $config['redirect_http']); } else { @@ -897,6 +886,26 @@ if (isset($_POST['delete'])) { 'id' => $id )); } + + if ($config['try_smarter'] && $post['op']) + $build_pages = range(1, $config['max_pages']); + + if ($post['op']) + clean(); + + event('post-after', $post); + + buildIndex(); + + // We are already done, let's continue our heavy-lifting work in the background (if we run off FastCGI) + if (function_exists('fastcgi_finish_request')) + @fastcgi_finish_request(); + + if ($post['op']) + rebuildThemes('post-thread', $board['uri']); + else + rebuildThemes('post', $board['uri']); + } elseif (isset($_POST['appeal'])) { if (!isset($_POST['ban_id'])) error($config['error']['bot']); |
