Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
LUM_UserDiscussionWatch size issues
As much as i hate my first post here to be a moan, since im loving vanilla from the features/functionality side. Basically, is it just me, or is having a record per person, per thread in the database causing ridiculously huge tables?
We run an xbox forum with about 2500 members and 4500 topics (not exactly huge by forum standards) and this leads to a table with 12,000,000 records in the database, pushing the database as a whole to over half a gig in size.
basically, i was just wondering whether, a) this is actually an issue, and im not being an idiot, and b) there's a fix in the works
i'm more than happy to rip the forum to pieces and redo the read posts functionality myself, but if there's a plan to do it in the official release i'd obviously rather use that
cheers,
0
This discussion has been closed.
Comments
One thing you can do easily is purge the table from records older than a some arbitrary date:
DELETE FROM LUM_UserDiscussionWatch WHERE LastViewed < '2005-01-01'
I haven't tested this, so buyer beware.
I have a mark all read extension in the planning stages that stores a date in the user table. After that date, all threads show as read, before it, the UserDiscussionWatch table shows read/unread status. Never really been motivated to complete it.
<?php /* Extension Name: Thread Read Extension Url: http://edacio.us/ Description: Adds a 'Mark all discussions read' link to the panel. Version: 0.1 Beta Author: WallPhone Author Url: http://edacio.us/ */ $Context->Dictionary['ThreadRead_Group'] = 'Mark as read:'; $Context->Dictionary['ThreadRead_All'] = 'Mark all discussions read'; $Context->Dictionary['ThreadRead_Category'] = 'Current category'; $Context->Dictionary['ThreadRead_Thread'] = 'Mark as read'; $Context->Dictionary['ThreadRead_UAll'] = 'Undo mark all read'; $Context->Dictionary['ThreadRead_UCat'] = 'Undo mark category read'; $Context->Dictionary['ThreadRead_UThread'] = 'Mark as unread'; //$Context->Dictionary['ThreadRead_'] = ''; // Attach to the required Vanilla objects $SB = &$DiscussionManager->DelegateParameters['SqlBuilder']; $Context->AddToDelegate('Discussion', 'GetStatus', 'ThreadRead_Discussion_SetAsRead'); // add the mark all read link to the panel if (($Context->SelfUrl == "account.php") | ($Context->SelfUrl == "index.php") && ($Context->Session->UserID > 0)) { // if (no new threads) { // $PanelString = '<h1><a href="extensions/MarkAllRead/default.php?r=' . $Context->Session->UserID . '">' . $Context->Dictionary['MarkAllRead_Undo'] . '</a></h1>'; // } else ( $PanelString = '<h1><a href="extensions/ThreadRead/default.php?u=' . $Context->Session->UserID . '">' . $Context->Dictionary['ThreadRead_All'] . '</a></h1>'; // ) $Panel->AddListItem($Context->Dictionary['Options'],$Context->Dictionary['ThreadRead_All'],"?PostBackAction=MarkCategoryRead&CategoryID=".$CategoryID,"","id=\"MarkCategoryRead\""); $Panel->AddListItem($Context->Dictionary['Options'],$Context->GetDefinition('MarkAllRead'),"?PostBackAction=MarkAllRead","","id=\"MarkAllRead\""); // $Panel->AddString ($PanelString, 2); } // Update the database, and 302 back to the referring page. //header("HTTP/1.0 302 Found") //header("Location: http://www.example.com/") // Add the mark all read datetime column to the users table // TODO: Lookup the table prefix // $s = $this->Context->ObjectFactory->NewContextObject($this->Context, 'SqlBuilder'); // $PlanB = 'ALTER TABLE `LUM_User` ADD `MarkedAllRead` DATETIME DEFAULT NULL ;'; // Change the status string to show read posts after the last 'Mark All Read' click function ThreadRead_Discussion_SetAsRead(&$Discussion) { // Get the current status string $StatusString = &$Discussion->DelegateParameters['StatusString']; $SB = $this->Context->ObjectFactory->NewContextObject($this->Context, 'SqlBuilder'); $SB->SetMainTable('User', 'u'); // Get the date the mark was called $SB->AddSelect('MarkedAllRead', 'u'); $SB->AddWhere('u', 'UserID', '', $Context->Session->UserID, '='); $Context->Database->Select($SB, 'ThreadRead', 'ThreadRead_Discussion_SetAsRead', 'An error occurred while retrieving discussions.'); // @$DataSet['MarkedAllRead'] // $sql = 'SELECT MarkDate FROM '. $Context->Configuration['DATABASE_TABLE_PREFIX'] .'_USER // WHERE uid = '. $Context->Session->UserID ; // Oddly this doesn't get the configuration setting, nor the UID. (scope issue?) // mysql_query($sql) or die('Query "'. $sql .' Failed: '. mysql_error()); if ( $this->LastViewed > $LastViewedDate ) { $StatusString = str_replace("NewComments", "NoNewComments", $StatusString); $StatusString = str_replace("Unread", "Read", $StatusString); } $StatusString .= " Testing..."; } ?>