hazelorb New Member
 member is offline
![[avatar] [avatar]](http://bunnie.net/files/avatar.gif)
![[aim] [aim]](http://images.proboards.com/aim.gif)
![[homepage] [homepage]](http://images.proboards.com/buttons/www_sm.gif) Joined: Dec 2006 Gender: Female  Posts: 30 Karma: 1 |  | 5000 entries and D&R « Thread Started on Mar 15, 2010, 9:32pm » | |
Okay, so I'm at 4,913 entries at this point. Anyways was that 5000 D&R entries bug ever fixed? If so I'm going to port the code into my GM asap. If not I'm going to fix it and post the code here. Not sure how much of a fix is needed, if it should just get the current number of entries and loop less than that or if there was a reason for 5000? Anyways keep me posted...
| |
|
stryker New Member
 member is offline
Joined: Jun 2007 Gender: Male  Posts: 34 Karma: 2 |  | Re: 5000 entries and D&R « Reply #1 on May 3, 2010, 5:12am » | |
Wow - that's a huge pile of entries you have there. I had not heard of that bug before reading your post.
| |
|
hazelorb New Member
 member is offline
![[avatar] [avatar]](http://bunnie.net/files/avatar.gif)
![[aim] [aim]](http://images.proboards.com/aim.gif)
![[homepage] [homepage]](http://images.proboards.com/buttons/www_sm.gif) Joined: Dec 2006 Gender: Female  Posts: 30 Karma: 1 |  | Re: 5000 entries and D&R « Reply #2 on Jun 7, 2010, 4:52pm » | |
Okay, here is it, as I am currently at 4997 and this needed to be done.
I still use GM1.21b. In GM.cgi, replace
Code:$oldentrynumbercount = $newentrynumber; $countentriesfromhere = 5000; $foundtopentry = "no";
do { $countentriesfromherepadded = sprintf ("%8d", $countentriesfromhere); $countentriesfromherepadded =~ tr/ /0/; if (-e "$EntriesPath/$countentriesfromherepadded.cgi") { $newentrynumber = $countentriesfromhere; $foundtopentry = "yes"; } $countentriesfromhere--; if ($countentriesfromhere eq "0") { $newentrynumber = 0; $foundtopentry = "yes"; } } until $foundtopentry eq "yes"; |
|
with this:
Code:#-----------------------------D&R 5000 (5k) bug fix------------------------- # Lesley Hogan; bunnie[@]bunnie.net; June 6 2010 #-----------------------------------Notes----------------------------------- #-- Bug originally made GM overwrite entries >5000 #-- Legacy code left in with tweak for variable consistency in later code #-- Deleted ridiculous do-while -e loop; replaced with sort grep #-- New limit of 99999999 via regular expressions #---------------------------------------------------------------------------
#legacy code $oldentrynumbercount = $newentrynumber; $countentriesfromhere = 9999; #minor tweak... $foundtopentry = "no";
#new code opendir (DRFIVEK, "$EntriesPath") || die ("$EntriesPath cannot be opened.");#dangermouse? @grep5k = grep /^[0-9]{8}\.cgi$/, readdir DRFIVEK; closedir DRFIVEK;
$foundtopentry = "yes"; if (scalar(@grep5k) == 0) { $countentriesfromhere = 0; $countentriesfromherepadded = "00000000"; #elusive 00000000.cgi } else { $drfivekfile = (sort {$b <=> $a} @grep5k)[0]; ($countentriesfromherepadded) = $drfivekfile =~ /([0-9]{8})/; #new limit: 99999999 = 0*[1-9][0-9]* ($countentriesfromhere) = $countentriesfromherepadded =~ /^0*([1-9][0-9]*)$/; #potential pitfalls: missing entries } $newentrynumber = $countentriesfromhere; #end legacy and new code |
|
I have nothing kind to say about the old code....... Noah Grey was clearly just learning Perl when he wrote this software, and it really shows there! use strict anyone?
The original code might also be a modified do-until loop if you added the 00000000.cgi fix implemented a few years ago which was showing up when D&R was run with no entries if I remember correctly.
I tested this with Perl 5.8.8 on my site with 4997 entries and D&R ran perfectly.
I question some of my consistency with Noah Grey, ie dangermouse vs die. Possible pitfalls include the 00000000.cgi thing as well as any missing entries (this version opts for the latest [0-9]{8}.cgi instead of just scalar(grep...) in case a 00000000.cgi exists (entrynumber would be smaller than scalar, 1 less in fact, so it would then overwrite your most recent entry) or missing entries (in which case the entrynumber would be bigger than scalar).
Finally, I found no other places where 5000 appeared in gm.cgi, gm-library.cgi, gm-comments.cgi, or gm-upload.cgi fwiw.
| |
|
hazelorb New Member
 member is offline
![[avatar] [avatar]](http://bunnie.net/files/avatar.gif)
![[aim] [aim]](http://images.proboards.com/aim.gif)
![[homepage] [homepage]](http://images.proboards.com/buttons/www_sm.gif) Joined: Dec 2006 Gender: Female  Posts: 30 Karma: 1 |  | Re: 5000 entries and D&R « Reply #3 on Jun 7, 2010, 4:56pm » | |
Also that might be a bug if your only entry is 00000000.cgi but you have some issues if that is true
| |
|