Skip to content
This repository has been archived by the owner on Jun 13, 2020. It is now read-only.

Unifies all posts on a single table #171

Open
wants to merge 35 commits into
base: master
Choose a base branch
from

Conversation

fourfivesix
Copy link
Contributor

Thanks @czaks and @ctrlcctrlv for all the help.

I think this is done. Unfortunately I have taken too long to do this so I think it diverges a little bit from the current code. I'll do a merge and review the conflicts.

fourfivesix added 28 commits September 25, 2014 08:57
Makes the post function write to the posts table
instead of the posts_%s table.
index(), thread_find_page() and getPages()
May Allah (peace be upon him) have mercy on my soul.
@fourfivesix
Copy link
Contributor Author

@ctrlcctrlv, I'm afraid that the new install.php might take too long and timeout. What can be done about it?

@@ -1766,7 +1796,7 @@ function markup(&$body, $track_cites = false) {
}
$search_cites = array_unique($search_cites);

$query = query(sprintf('SELECT `thread`, `id` FROM ``posts_%s`` WHERE ' .
$query = query(sprintf('SELECT `thread`, `id` FROM ``posts`` WHERE `board` = "%s" ' .
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sprintf -> prepare

@fourfivesix
Copy link
Contributor Author

Thanks for the comments, @czaks! I was a bit cautious when changing sprintfs that weren't used just for posts_%s. I'll make those changes.

fourfivesix added 2 commits October 14, 2014 21:28
@fourfivesix
Copy link
Contributor Author

@czaks, I've made most of the changes you've requested.

I'm not sure about how to do the remaining changes in templates/themes/recent/theme.php, any help? 😞

In ukko, I've made a change to how the threads are selected. Instead of:

SELECT * FROM ``posts`` WHERE ( `board` = 'a' OR `board` = 'b' ...potentially 3000 more comparisons... )

I've decided that this may be more efficient:

SELECT * FROM ``posts`` WHERE ( `board` != 'secret' OR `board` != 'secret2' ...potentially less comparisons... )

Also, is it okay to do a SELECT here without a limit? This table is going to be huge.

@fourfivesix
Copy link
Contributor Author

@czaks, two points that I've discussed with @Lineark:

  1. About the posts count in templates/themes/recent/theme.php. I couldn't find a better way to calculate it. Because we don't have a global id counting every single post, I think we'll have to add up each board like we're doing now.

  2. About the unique IPs count in templates/themes/recent/theme.php. We could just do:

SELECT COUNT(DISTINCT(`ip`)) FROM ``posts``

We would be including the secret boards in this count, but it would be fast.
If we want to remove the secret boards, we would have to do the same as I did on ukko:

SELECT COUNT(DISTINCT(`ip`)) FROM ``posts`` WHERE (`board` != 'secret' OR `board` != 'secret2' ...)

What do you prefer?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants