diff --git a/board-search.php b/board-search.php index b573edd1..5d51134b 100644 --- a/board-search.php +++ b/board-search.php @@ -200,16 +200,14 @@ array_multisort( ); if (php_sapi_name() == 'cli') { - $boardLimit = $search['index'] ? 50 : 100; - - $response['omitted'] = count( $response['boards'] ) - $boardLimit; - $response['omitted'] = $response['omitted'] < 0 ? 0 : $response['omitted']; - $response['boards'] = array_splice( $response['boards'], $search['page'], $boardLimit ); -} -else { - $response['omitted'] = 0; + $response['boardsFull'] = $response['boards']; } +$boardLimit = $search['index'] ? 50 : 100; + +$response['omitted'] = count( $response['boards'] ) - $boardLimit; +$response['omitted'] = $response['omitted'] < 0 ? 0 : $response['omitted']; +$response['boards'] = array_splice( $response['boards'], $search['page'], $boardLimit ); $response['order'] = array_keys( $response['boards'] ); diff --git a/boards.php b/boards.php index 0c1f33a8..4f1f16fa 100644 --- a/boards.php +++ b/boards.php @@ -94,9 +94,9 @@ $pageHTML = Element("page.html", array( // We only want to cache if this is not a dynamic form request. // Otherwise, our information will be skewed by the search criteria. -if (count($_GET) == 0) { +if (php_sapi_name() == 'cli') { // Preserves the JSON output format of [{board},{board}]. - $nonAssociativeBoardList = array_values($boards); + $nonAssociativeBoardList = array_values($response['boardsFull']); file_write("boards.html", $pageHTML); file_write("boards.json", json_encode($nonAssociativeBoardList)); @@ -109,6 +109,9 @@ if (count($_GET) == 0) { } file_write("boards-top20.json", json_encode(array_splice($topbar, 0, 48))); + + echo "The board directories have regenerated."; + exit; } echo $pageHTML; diff --git a/inc/functions.php b/inc/functions.php index 1d5f8216..4c16f065 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -875,13 +875,6 @@ function fetchBoardActivity( array $uris = array(), $forTime = false, $detailed foreach ($bsResult as $bsRow) { // Do we need to define the arrays for this URI? if (!isset($boardActivity['active'][$bsRow['stat_uri']])) { - if ($bsRow['stat_hour'] == $forHour) { - $boardActivity['active'][$bsRow['stat_uri']] = unserialize( $bsRow['author_ip_array'] ); - } - else { - $boardActivity['active'][$bsRow['stat_uri']] = array(); - } - if ($bsRow['stat_hour'] <= $forHour && $bsRow['stat_hour'] >= $yesterHour) { $boardActivity['today'][$bsRow['stat_uri']] = $bsRow['post_count']; } @@ -889,17 +882,15 @@ function fetchBoardActivity( array $uris = array(), $forTime = false, $detailed $boardActivity['today'][$bsRow['stat_uri']] = 0; } + $boardActivity['active'][$bsRow['stat_uri']] = unserialize( $bsRow['author_ip_array'] ); $boardActivity['average'][$bsRow['stat_uri']] = $bsRow['post_count']; } else { - if ($bsRow['stat_hour'] == $forHour) { - $boardActivity['active'][$bsRow['stat_uri']] = array_merge( $boardActivity['active'][$bsRow['stat_uri']], unserialize( $bsRow['author_ip_array'] ) ); - } - if ($bsRow['stat_hour'] <= $forHour && $bsRow['stat_hour'] >= $yesterHour) { $boardActivity['today'][$bsRow['stat_uri']] += $bsRow['post_count']; } + $boardActivity['active'][$bsRow['stat_uri']] = array_merge( $boardActivity['active'][$bsRow['stat_uri']], unserialize( $bsRow['author_ip_array'] ) ); $boardActivity['average'][$bsRow['stat_uri']] += $bsRow['post_count']; } }