Gossamer Forum
Home : Products : Links 2.0 : Discussions :

frustrated!!!!!!!!

Quote Reply
frustrated!!!!!!!!
I have gotten the links program to work (finally). Now I'm faced with another problem: I first added about 3 links. I validated them and then selected build all. Everything worked great and everyone was happy. Then, I found more links to put on, and I followed the same procedure. After running 'build all', though, the previous links got erased. Why is this? How can I solve this?
Quote Reply
Re: frustrated!!!!!!!! In reply to
Make sure the linksid.txt file in your admin/data directory contains the highest ID number currently in links.db (including the ID numbers in validate.db, if any).

I hope this helps.
Quote Reply
Re: frustrated!!!!!!!! In reply to
That did the trick! Thank you. I now have a related problem which may have caused the first one. When I add from admin.cgi, it gives it the next identification number. But when I add from add.cgi, it gives it the same number as the highest. Links recognizes that they have the same number, and gives the entry four more digits while building, thus making much larger than linksid.txt. Is there any way to fix this, or do I have modify the first entry after the last build every time?
Quote Reply
Re: frustrated!!!!!!!! In reply to
You may need to edit the ID numbers in links.db/validate.db and in linksid.txt to totally fix this problem. What you are describing should not be happening. Links should be using the highest ID+1 regardless of whether it is done from the admin screen or from the user add form.

Try this script to fix things (validate your records first). Put the script in your admin/data directory, chmod the directory to 777 and the script to 755 and then run it. It will create a new file, links_new.db, and should have all the ID numbers in order. When you are satisfied that the new file is correct, rename the old links.db to links_org.db (just to be on the safe side) and then rename links_new.db to links.db. This script will also update your linksid.txt to the correct value.

Code:
#!/usr/bin/perl
# -------------------------------------------
# Change next line to full path to links.cfg if you have problems with this script.
require "../links.cfg";
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";

$counter = 0;
$ENV{'REQUEST_METHOD'} and (print "Content-type: text/plain\n\n");
open (DB, "<$db_links_name")
or print "Unable to open links database 'links.db'. Reason: $!\n" and exit;
open (DBOUT, ">$db_script_path/data/links_new.db")
or print "Unable to open output database. Reason: $!\n" and exit;
LINE: while (<DB> )
{
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp; # Remove trailing new line.
$counter++;
@rec = &split_decode($_);
$rec[$db_key] = $counter;
print DBOUT &join_encode(&array_to_hash(0, @rec));
}
close DB;
close DBOUT;
open (DBID, ">$db_script_path/data/linksid_new.txt")
or print "Unable to open linksid.txt. Reason: $!" and exit;
print DBID $counter;
close DBID;
# ---------------------------------------------

I hope this helps.
Quote Reply
Re: frustrated!!!!!!!! In reply to
Thank you very much for your help, but it hasn't solved the problems. This time, when you add a link from either the admin or add.cgi, it erases the rest of the links. It also adds a strange id number to it. I think I'll just download the program again (I may have somehow done something to do this-I don't think so, but...). Thank you again for all your help-it's really nice having a support forum to solve your problems.