Page Index Toggle Pages: 1 [2] 3  Send TopicPrint
Very Hot Topic (More than 25 Replies) Rebuild Messageindex - Plus (Read 14711 times)
aerow90
Senior Member
****
Offline



Posts: 253
Joined: Mar 18th, 2006
Re: Rebuild Messageindex - Plus
Reply #15 - Mar 10th, 2007 at 4:59pm
Print Post  
Hi, I got an error in step two. I have this code in my admin.pl

Code
Select All
sub RebuildMessageIndex {
	opendir(CTB, $datadir);
	@threadlist = grep { /\.ctb$/ } readdir(CTB);
	closedir(CTB);
	$i = 0;
	foreach my $thread (@threadlist) {
		chomp $thread;
		$thread =~ s/\.ctb$//g;
		if (!-e "$datadir/$thread.txt") {
			unlink("$datadir/$thread.ctb");
			next;
		}
		fopen(FILECTB, "$datadir/$thread.ctb");
		@boarddata = <FILECTB>;
		fclose(FILECTB);
		$theboard = $boarddata[0];
		chomp $theboard;
		$thestatus = $boarddata[5];
		chomp $thestatus;
		fopen(FILETXT, "$datadir/$thread.txt");
		@threaddata = <FILETXT>;
		fclose(FILETXT);
		(@firstinfo) = split(/\|/, $threaddata[0]);
		(@lastinfo)  = split(/\|/, $threaddata[$#threaddata]);
		$thelastinfo = sprintf("%010d", $lastinfo[3]);
		$threadinfo[$i] = qq~$theboard|$thelastinfo|$thread|$firstinfo[0]|$firstinfo[1]|$firstinfo[2]|$lastinfo[3]|$#threaddata|$firstinfo[4]|$firstinfo[5]|$thestatus\n~;
		$i++;
	}
	@SortBoards = sort { lc($b) cmp lc($a) } (@threadinfo);
	$openfile = "";
	(@firsthread) = split(/\|/, $SortBoards[0]);
	$closefile = $firsthread[0];
	for ($i = 0; $i < @SortBoards; $i++) {
		@thisthread = ();
		(@thisthread) = split(/\|/, $SortBoards[$i]);
		my $thisboard = $thisthread[0];
		if ($thisthread[10] =~ /(a|s)/) {&Sticky_Add_Del("add",$thisboard,$thisthread[2]);} ### Sticky Shimmy Shuffle mod ###
		if ($thisboard ne $closefile) {
			fclose(REBUILDMESSAGE);
			$closefile = $thisboard;
		}
		if ($thisboard ne $openfile) {
			fopen(REBUILDMESSAGE, ">$boardsdir/$thisboard.txt");
			$openfile = $thisboard;
		}
		print REBUILDMESSAGE qq~$thisthread[2]|$thisthread[3]|$thisthread[4]|$thisthread[5]|$thisthread[6]|$thisthread[7]|$thisthread[8]|$thisthread[9]|$thisthread[10]~;
	}
	fclose(REBUILDMESSAGE);
	$yymain .= qq~<b>$admin_txt{'507'}</b>~;
	$yytitle     = $admin_txt{'506'};
	$action_area = "rebuildmesindex";
	&AdminTemplate;
	exit;
}

sub case_insensitive {
	uc($::a) cmp uc($::b);
}

sub DeleteOldMessages {
	&is_admin_or_gmod;
	fopen(DELETEOLDMESSAGE, "$vardir/oldestmes.txt");
	$maxdays = <DELETEOLDMESSAGE>;
	fclose(DELETEOLDMESSAGE);
	$yytitle = "$aduptxt{'04'}";
	$yymain .= qq~
<form action="$adminurl?action=removeoldthreads" method="POST">
 <div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;">
   <table width="100%" cellspacing="1" cellpadding="4">
     <tr valign="middle">
	 <td align="left" class="titlebg">
<img src="$imagesdir/ban.gif" alt="" border="0" /> <b>$aduptxt{'04'}</b>
	   </td>
     </tr>
     <tr valign="middle">
	 <td align="left" class="windowbg2"><br />
		 $aduptxt{'05'}<br /><br />
	   </td>
     </tr>
     <tr valign="middle">
	 <td align="left" class="windowbg2"><br />
		 $admin_txt{'4'}: <input type="checkbox" name="keep_them" value="1" /><br />
		 $admin_txt{'124'} <input type=text name="maxdays" size="2" value="$maxdays" /> $admin_txt{'579'} $admin_txt{'2'}:<br /><br />
		 <div align="left" style="margin-left: 25px; margin-right: auto;">
~;

	unless ($mloaded == 1) { require "$boardsdir/forum.master"; }

	foreach $catid (@categoryorder) {
		$boardlist = $cat{$catid};
		(@bdlist) = split(/\,/, $boardlist);
		($catname, $catperms) = split(/\|/, $catinfo{"$catid"});

		foreach $curboard (@bdlist) {
			($boardname, $boardperms, $boardview) = split(/\|/, $board{"$curboard"});

			$selectname = $curboard . 'check';
			$yymain .= qq~
		   <input type="checkbox" name="$selectname" value="1" />&nbsp;$boardname<br />
~;
		}
	}
	$yymain .= qq~
		 </div><br />
	   </td>
     </tr>
     <tr valign="middle">
	 <td align="center" class="catbg">
		 <input type=submit value="$admin_txt{'31'}" />
	   </td>
     </tr>
   </table>
 </div>
</form>
~;
	$action_area = "deleteoldthreads";
	&AdminTemplate;
	exit;
} 



But if I change by hand, my admin Center  shows an error, can you help me?
« Last Edit: Mar 11th, 2007 at 10:22am by aerow90 »  
Back to top
WWW  
IP Logged
 
Jeff
God Member
*****
Offline


There are no bugs there
are only features

Posts: 2552
Joined: Jan 14th, 2005
Gender: Male
Re: Rebuild Messageindex - Plus
Reply #16 - Mar 11th, 2007 at 10:26am
Print Post  
Hi
try this in search for Step 2  Wink

Code
Select All
sub RebuildMessageIndex {
	opendir(CTB, $datadir);
	@threadlist = grep { /\.ctb$/ } readdir(CTB);
	closedir(CTB);
	$i = 0;
	foreach my $thread (@threadlist) {
		chomp $thread;
		$thread =~ s/\.ctb$//g;
		if (!-e "$datadir/$thread.txt") {
			unlink("$datadir/$thread.ctb");
			next;
		}
		fopen(FILECTB, "$datadir/$thread.ctb");
		@boarddata = <FILECTB>;
		fclose(FILECTB);
		$theboard = $boarddata[0];
		chomp $theboard;
		$thestatus = $boarddata[5];
		chomp $thestatus;
		fopen(FILETXT, "$datadir/$thread.txt");
		@threaddata = <FILETXT>;
		fclose(FILETXT);
		(@firstinfo) = split(/\|/, $threaddata[0]);
		(@lastinfo)  = split(/\|/, $threaddata[$#threaddata]);
		$thelastinfo = sprintf("%010d", $lastinfo[3]);
		$threadinfo[$i] = qq~$theboard|$thelastinfo|$thread|$firstinfo[0]|$firstinfo[1]|$firstinfo[2]|$lastinfo[3]|$#threaddata|$firstinfo[4]|$firstinfo[5]|$thestatus\n~;
		$i++;
	}
	@SortBoards = sort { lc($b) cmp lc($a) } (@threadinfo);
	$openfile = "";
	(@firsthread) = split(/\|/, $SortBoards[0]);
	$closefile = $firsthread[0];
	for ($i = 0; $i < @SortBoards; $i++) {
		@thisthread = ();
		(@thisthread) = split(/\|/, $SortBoards[$i]);
		my $thisboard = $thisthread[0];
		if ($thisthread[10] =~ /(a|s)/) {&Sticky_Add_Del("add",$thisboard,$thisthread[2]);} ### Sticky Shimmy Shuffle mod ###
		if ($thisboard ne $closefile) {
			fclose(REBUILDMESSAGE);
			$closefile = $thisboard;
		}
		if ($thisboard ne $openfile) {
			fopen(REBUILDMESSAGE, ">$boardsdir/$thisboard.txt");
			$openfile = $thisboard;
		}
		print REBUILDMESSAGE qq~$thisthread[2]|$thisthread[3]|$thisthread[4]|$thisthread[5]|$thisthread[6]|$thisthread[7]|$thisthread[8]|$thisthread[9]|$thisthread[10]~;
	}
	fclose(REBUILDMESSAGE);
	$yymain .= qq~<b>$admin_txt{'507'}</b>~;
	$yytitle     = $admin_txt{'506'};
	$action_area = "rebuildmesindex";
	&AdminTemplate;
	exit;
} 

  

greetings
Jeff
Back to top
WWW  
IP Logged
 
aerow90
Senior Member
****
Offline



Posts: 253
Joined: Mar 18th, 2006
Re: Rebuild Messageindex - Plus
Reply #17 - Mar 11th, 2007 at 10:55am
Print Post  
Hi, thanks for answer, but it does not work, same error
  
Back to top
WWW  
IP Logged
 
Jeff
God Member
*****
Offline


There are no bugs there
are only features

Posts: 2552
Joined: Jan 14th, 2005
Gender: Male
Re: Rebuild Messageindex - Plus
Reply #18 - Mar 11th, 2007 at 11:00am
Print Post  
then please attach your Admin.pl and I post right search code  Wink
  

greetings
Jeff
Back to top
WWW  
IP Logged
 
aerow90
Senior Member
****
Offline



Posts: 253
Joined: Mar 18th, 2006
Re: Rebuild Messageindex - Plus
Reply #19 - Mar 11th, 2007 at 11:11am
Print Post  
Thats nice,  my admin.pl is attached
  

Admin-aerow.zip ( 14 KB | Downloads )
Back to top
WWW  
IP Logged
 
Jeff
God Member
*****
Offline


There are no bugs there
are only features

Posts: 2552
Joined: Jan 14th, 2005
Gender: Male
Re: Rebuild Messageindex - Plus
Reply #20 - Mar 11th, 2007 at 11:14am
Print Post  
your search code is

Code
Select All
sub RebuildMessageIndex {
	opendir(CTB, $datadir);
	@threadlist = grep { /\.ctb$/ } readdir(CTB);
	closedir(CTB);
	$i = 0;
	foreach my $thread (@threadlist) {
		chomp $thread;
		$thread =~ s/\.ctb$//g;
		if (!-e "$datadir/$thread.txt") {
			unlink("$datadir/$thread.ctb");
			next;
		}
		fopen(FILECTB, "$datadir/$thread.ctb");
		@boarddata = <FILECTB>;
		fclose(FILECTB);
		$theboard = $boarddata[0];
		chomp $theboard;
		$thestatus = $boarddata[5];
		chomp $thestatus;
		fopen(FILETXT, "$datadir/$thread.txt");
		@threaddata = <FILETXT>;
		fclose(FILETXT);
		(@firstinfo) = split(/\|/, $threaddata[0]);
		(@lastinfo)  = split(/\|/, $threaddata[$#threaddata]);
		$thelastinfo = sprintf("%010d", $lastinfo[3]);
		$threadinfo[$i] = qq~$theboard|$thelastinfo|$thread|$firstinfo[0]|$firstinfo[1]|$firstinfo[2]|$lastinfo[3]|$#threaddata|$firstinfo[4]|$firstinfo[5]|$thestatus\n~;
		$i++;
	}
	@SortBoards = sort { lc($b) cmp lc($a) } (@threadinfo);
	$openfile = "";
	(@firsthread) = split(/\|/, $SortBoards[0]);
	$closefile = $firsthread[0];
	for ($i = 0; $i < @SortBoards; $i++) {
		@thisthread = ();
		(@thisthread) = split(/\|/, $SortBoards[$i]);
		my $thisboard = $thisthread[0];
		if ($thisthread[10] =~ /(a|s)/) {&Sticky_Add_Del("add",$thisboard,$thisthread[2]);} ### Sticky Shimmy Shuffle mod ###
		if ($thisboard ne $closefile) {
			fclose(REBUILDMESSAGE);
			$closefile = $thisboard;
		}
		if ($thisboard ne $openfile) {
			fopen(REBUILDMESSAGE, ">$boardsdir/$thisboard.txt");
			$openfile = $thisboard;
		}
		print REBUILDMESSAGE qq~$thisthread[2]|$thisthread[3]|$thisthread[4]|$thisthread[5]|$thisthread[6]|$thisthread[7]|$thisthread[8]|$thisthread[9]|$thisthread[10]~;
	}
	fclose(REBUILDMESSAGE);
	$yymain .= qq~<b>$admin_txt{'507'}</b>~;
	$yytitle     = $admin_txt{'506'};
	$action_area = "rebuildmesindex";
	&AdminTemplate;
	exit;
} 

  

greetings
Jeff
Back to top
WWW  
IP Logged
 
aerow90
Senior Member
****
Offline



Posts: 253
Joined: Mar 18th, 2006
Re: Rebuild Messageindex - Plus
Reply #21 - Mar 11th, 2007 at 11:20am
Print Post  
Hi,

this does not work, same error. I am not sure if the search code is the problem, because if I edit by hand I got an error on the first site of my admin center.
  
Back to top
WWW  
IP Logged
 
Jeff
God Member
*****
Offline


There are no bugs there
are only features

Posts: 2552
Joined: Jan 14th, 2005
Gender: Male
Re: Rebuild Messageindex - Plus
Reply #22 - Mar 11th, 2007 at 11:23am
Print Post  
Shocked what error in Admin Center? Please post more Information.
  

greetings
Jeff
Back to top
WWW  
IP Logged
 
aerow90
Senior Member
****
Offline



Posts: 253
Joined: Mar 18th, 2006
Re: Rebuild Messageindex - Plus
Reply #23 - Mar 11th, 2007 at 11:23am
Print Post  
I will edit by hand, and post a screentshot, give me a minute
  
Back to top
WWW  
IP Logged
 
aerow90
Senior Member
****
Offline



Posts: 253
Joined: Mar 18th, 2006
Re: Rebuild Messageindex - Plus
Reply #24 - Mar 11th, 2007 at 11:28am
Print Post  
If I edit by hand I got this in my admin center, its really strange

  

error-aerow.PNG ( 33 KB | Downloads )
error-aerow.PNG
Back to top
WWW  
IP Logged
 
Jeff
God Member
*****
Offline


There are no bugs there
are only features

Posts: 2552
Joined: Jan 14th, 2005
Gender: Male
Re: Rebuild Messageindex - Plus
Reply #25 - Mar 11th, 2007 at 11:33am
Print Post  
ok, I attach your Admin.pl for you.

delete your Step 2 in modfile.  Wink and replace Admin.pl with your old Admin.pl
  

Admin_pl_aerow-new.zip ( 15 KB | Downloads )

greetings
Jeff
Back to top
WWW  
IP Logged
 
aerow90
Senior Member
****
Offline



Posts: 253
Joined: Mar 18th, 2006
Re: Rebuild Messageindex - Plus
Reply #26 - Mar 11th, 2007 at 11:38am
Print Post  
Thank you very much now it works, can you tell me my misstake?
  
Back to top
WWW  
IP Logged
 
Jeff
God Member
*****
Offline


There are no bugs there
are only features

Posts: 2552
Joined: Jan 14th, 2005
Gender: Male
Re: Rebuild Messageindex - Plus
Reply #27 - Mar 11th, 2007 at 11:40am
Print Post  
maybe last line no replace?  Grin

}
  

greetings
Jeff
Back to top
WWW  
IP Logged
 
aerow90
Senior Member
****
Offline



Posts: 253
Joined: Mar 18th, 2006
Re: Rebuild Messageindex - Plus
Reply #28 - Mar 11th, 2007 at 11:41am
Print Post  
That can be right  Embarrassed
  
Back to top
WWW  
IP Logged
 
Zoo
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 290
Joined: Jan 22nd, 2003
Re: Rebuild Messageindex - Plus
Reply #29 - Mar 11th, 2007 at 3:15pm
Print Post  
thx Jet Li for support
I have no time to spare. My son 13 days old  Cheesy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 3 
Send TopicPrint