First, please excuse the disagreement statement. That came off a bit snobby, which wasnt intentional (hence the "wink", but people don't seem to pay attention to winks anymore).
You wouldnt need a new html page generated for posts screens and the message index. Those are only needed while the user is replying and browsing, so those are always going to be created dynamically as it is... there's no reason to have a reply screen indexed. A message index, yes, possibly, but even if you wanted to make it as an html, it would take next to nothing. You dont need to write the whole file, even (which is what YaBB currently does). You can use some good ole seek and tell. The fact that YaBB doesnt do this already is a major factor keeping down the speed.
It actually DID do this at some time, but when I left the SP development team, no one had the knowledge or foresight to see that it really needed to be done. Here's an example:
Current Post.pl writing routine:
if($threadid eq '') {
$newthreadid = time;
$i=0;
if (-e "$datadir/$newthreadid.txt") {
while (-e "$datadir/$newthreadid$i.txt") { ++$i; }
$newthreadid="$newthreadid$i";
}
}
else { $newthreadid = ''; }
fopen(FILE, "$boardsdir/$currentboard.txt") || &fatal_error("209 $txt{'106'}: $txt{'23'} $boardsdir/$currentboard.txt");
@messages = <FILE>;
fclose(FILE);
if($newthreadid) {
# This is a new thread. Save it.
fopen(FILE, ">$boardsdir/$currentboard.txt", 1) || &fatal_error("210 $txt{'106'}: $txt{'23'} $currentboard.txt");
print FILE qq~$newthreadid|$subject|$name|$email|$date|0|$username|$icon|0\n~;
print FILE @messages;
fclose(FILE);
fopen(FILE, ">$datadir/$newthreadid.txt") || &fatal_error("$txt{'23'} $newthreadid.txt");
print FILE \n~;
fclose(FILE);
$mreplies = 0;
} else {
# This is an old thread. Save it.
($mnum, $msub, $mname, $memail, $mdate, $mreplies, $musername, $micon, $mstate) = split(/\|/,$yyThreadLine);
if( $mstate == 1 ) { &fatal_error($txt{'90'}); }
++$mreplies;
$messages[$yyThreadPosition] = '';
fopen(FILE, ">$boardsdir/$currentboard.txt", 1) || &fatal_error("211 $txt{'106'}: $txt{'23'} $currentboard.txt");
print FILE qq~$mnum|$msub|$mname|$memail|$date|$mreplies|$musername|$micon|$mstate\n~;
print FILE @messages;
fclose(FILE);
fopen(FILE, ">>$datadir/$threadid.txt") || &fatal_error("212 $txt{'106'}: $txt{'23'} $threadid.txt");
print FILE \n~;
fclose(FILE);
}
The problem with that is that the board files are opened each time someone posts, completely erased, and completely rewritten. If you've got 10,000 threads in a board, well, that has to get erased and rewritten every time. Not exactly a speedy feature.
Here's the new Post.pl routine that got excluded out of the SP after I stopped developing it because the other developers didnt know how the code worked (and for some reason wouldnt take the time to learn, but that's another story all together):
if($threadid eq '') {
$newthreadid = time;
$i=0;
if (-e "$datadir/$newthreadid.txt") {
while (-e "$datadir/$newthreadid$i.txt") { ++$i; }
$newthreadid="$newthreadid$i";
}
}
else { $newthreadid = ''; }
if($newthreadid) {
# This is a new thread. Save it.
fopen(FILE, "+<$boardsdir/$currentboard.txt") || &fatal_error("210 $txt{'106'}: $txt{'23'} $currentboard.txt");
seek FILE, 0, 0;
fopen(TEMP, "+>$boardsdir/$currentboard.txt.temp") || &fatal_error("209 $txt{'106'}: $txt{'23'} $boardsdir/$currentboard.txt.temp");
while( read(FILE,$buffer,1024) ) {
print TEMP $buffer;
}
seek TEMP, 0, 0;
truncate FILE, 0;
seek FILE, 0, 0;
print FILE qq~$newthreadid|$subject|$name|$email|$date|0|$username|$icon|0\n~;
while( read(TEMP,$buffer,1024) ) {
print FILE $buffer;
}
fclose(TEMP);
if (-e "$boardsdir/$currentboard.txt.temp") { unlink("$boardsdir/$currentboard.txt.temp"); }
fclose(FILE);
fopen(FILE, ">$datadir/$newthreadid.txt") || &fatal_error("$txt{'23'} $newthreadid.txt");
print FILE \n~;
fclose(FILE);
$mreplies = 0;
} else {
# This is an old thread. Save it.
($mnum, $msub, $mname, $memail, $mdate, $mreplies, $musername, $micon, $mstate) = split(/\|/,$yyThreadLine);
if( $mstate == 1 ) { &fatal_error($txt{'90'}); }
++$mreplies;
fopen(FILE, "+<$boardsdir/$currentboard.txt") || &fatal_error("211 $txt{'106'}: $txt{'23'} $currentboard.txt");
seek FILE, 0, 0;
fopen(TEMP, "+>$boardsdir/$currentboard.txt.temp") || &fatal_error("209 $txt{'106'}: $txt{'23'} $boardsdir/$currentboard.txt.temp");
seek TEMP, 0, 0;
while( read(FILE,$buffer,1024) ) {
print TEMP $buffer;
}
truncate FILE, 0;
seek FILE, 0, 0;
print FILE qq~$mnum|$msub|$mname|$memail|$date|$mreplies|$musername|$micon|$mstate\n~;
seek TEMP, 0, 0;
my $new_count = 0;
while( $line = <TEMP> ) {
unless($new_count == $yyThreadPosition) { print FILE $line; }
$new_count++;
}
fclose(TEMP);
if (-e "$boardsdir/$currentboard.txt.temp") { unlink("$boardsdir/$currentboard.txt.temp"); }
fclose(FILE);
fopen(FILE, ">>$datadir/$threadid.txt") || &fatal_error("212 $txt{'106'}: $txt{'23'} $threadid.txt");
print FILE \n~;
fclose(FILE);
}
What does this do, you ask? It frees up memory immensely by not reading 10,000 lines of the board file into one single array, and it writes only one line into the file from the form information inputted, then grabs all the other info back out of a temp file where it was stored to avoid clogging RAM. This fix was mainly because people were losing entire boards when the arrays would get dropped for being too big, but it also improved speed. What was REALLY nice was all the other files I had it in, but after I left I never bothered finishing them. ModifyMessage was especially cool, though one writing bug in it still has me puzzled, Maybe someday.....
But anywho, most pages except the actual messages themselves will be dynamically created... post screens, notifcation screens, modify messages... anything that's not an actual message. And you wouldnt need to write the entire html file over when you posted or modified... just need to write over the part that was changed, which can be done using the same commands and methods in the ocde posted above.
And I would do it for $100 if I still coded. If someone payed me $100 to put out file attaching, I gaurantee it'd be done by the end of the week.
Unfortunately, maintaining
www.wkrn.com has proved to be a full time job (literally). But hey, it pays way better than training at a restaurant, and I've scored about $400 worth of free hockey tickets since I've been working there. Perks are fun. =)
As far as why hasn't static html be done if it's such an improvement? Because the developers for YaBB took the easy way on stuff for a long time, and much of it was coded quite poorly after we went back and looked at it. Gold was a rough release, and looking through SP, I honestly don't see many big significant changes. Making YaBB into a PHP/MySQL version was a big improvement on speed and the like, too, but it took nearly a year to get people together to actually do it. And YaBB2, running on a Perl/MySQL backend... well, that's a huge improvement as far as write and reading and ease of change go, but yet again, still not done. Most of the devs left that project when Peter did. I havent seen the code for the new version being started. My only hope is that the modules for it are decent... the previous ones were pretty amazing, but they arent being used now.
As far as board systems that generate HTML pages, I know Discus does (a fairly popular PERL BB). Most PHP ones aren't going to, because the whole advantage of using php is the ease of SQL integration. A few of the other forums I've come across that generate html pages are ASP and CFM boards. You can always look around through the CGI Resource index to contrast and compare.
So hopefully that explains myself a little better. And don't think I'm dogging on YaBB, because I love. But having worked extensively on a rewrite of it, I know where some of the flaws are or where improvements can be made at some point, and I'm not timid to admit it. I've had my share of being yelled at for code bugs with the rest of 'em, that's for sure.
- Dave