Gossamer Forum
Home : Products : Links 2.0 : Installation -- Unix :

Building new pages don't run

Quote Reply
Building new pages don't run
Hi,

I have a new problem, after change my server (solaris) for red-hat 7.0, i see the script (links 2.0) don't run correctly. All functions run, when i add a new link and validate i go to rebuilding all pages...see a e.g:

Building Pages

Pages built on 12-Dez-2002 at 17:50:26
--------------------------------------------------------

Backing up database . . .
Backup exists for today.. Skipping
Done.

Building URL Index . . .
Done.

Updating New and Popular Records . . .
What's New Cutoff: 14 days
Popular Cutoff: 2048 hits
Updating record: 20, marking as pop.
Updating record: 23, marking as pop.
Updating record: 19, marking as pop.

......

Updating record: 3240, marking as pop.
Done.

Updating ratings ..
Done.

Loading Category Information . . .
Done.

Gathering Category and Link information . . .
Done

Building Home Pages . . .
Categories: 40
Total Links: 3240
Opening page: /xxx/xxxx/xxxx/xxxx/xxxx/pages/index.html
Closing page.
Done

Building What's New Page . . .
Total New Links: ( **** HERE IS MY PROBLEM **** )

Done

Building Cool Sites Page . . .
Total Cool Sites: 103
Done

Building Top 10 Page . . .
Per Rate: 943222 .. 12345
Per Ratio: Yes .. No
Done



Building Category pages . . .
Building Category: axxxxx1

Sub Categories: 3
Links: 7
Directorie: /usr/local/xxx/xxx/axxx1
File Name: /usr/local/xxx/xxx/axxx1/index.shtml
Sub Page: /usr/local/xxx/xxx/axxx1/more2.html

Into the end, no have problems, i rebuilding all links (3240) with 19 ~25 segunds, not have problems, all categories is ok, all subcategories is ok, all pages is generated, all permissions is ok, all is ok . EXCEPT FOR the new sites added is not see, not is marking how to new, it does't appear new sites per day....Noting for new sites... I run several tests and not see a soluction. When i change a server i note problem with a date format

fatal error: invalid date format: 02-Aug-01 - parsed as (day: 2, month: 7, year: -1899). Reason: Can't handle date (0, 0, 0, 2, 7, -1899) at /home/.sites/122/site482/web/cgi-bin/links2/admin1/links.cfg line 173

I have searched the forum and found the fix provided by designerx in Jan:-

*********************************
Strangly enough the solution is absurdely simple. In your links.cfg script you would make one alteration... you simply add a 1 to the end of the $year

So for example on (my line 292) in links.cfg It would look like:
$time = &Time::Local::timelocal(0,0,0, $day, $months{$mon}, $year1);

instead of:
$time = &Time::Local::timelocal(0,0,0, $day, $months{$mon}, $year);

I think, my problem with no marking a news links is possible directly it is related to the problem with dates of the Unix. I use a Perl










Please i need a avanced assistence.

Thanks for your time,

Quirino





Help to me
Quote Reply
Re: [Quirino] Building new pages don't run In reply to
This looks to be my problem as well, all the other confusing stuff aside that I had in the other post. (See? I am looking through search results...) *Sangi clicks "Watch this Thread"*
--Sanguinarius
Your resident vampire ;P
http://www.sanguinarius.org/
Quote Reply
Re: [Sanguinarius] Building new pages don't run In reply to
I solve my problem, see below:

In links.cfg (old file)

sub date_to_unix {
# --------------------------------------------------------
# This routine must take your date format and return the time a la UNIX time().
# Some things to be careful about..
# timelocal does not like to be in array context, don't do my($time) = timelocal (..)
# int your values just in case to remove spaces, etc.
# catch the fatal error timelocal will generate if you have a bad date..
# don't forget that the month is indexed from 0!
#
my $date = shift; my $i;
my %months = map { $_ => $i++ } qw!Jan Fev Mar Abr Mai Jun Jul Ago Set Out Nov Dez!;
my ($day, $mon, $year) = split(/-/, $date);

exists $months{$mon} or return undef;
$day = int($day); $year = $year - 1900;

require Time::Local;
my $time = 0;
eval {
$time = &Time::Local::timelocal(0,0,0, $day, $months{$mon}, $year);
};
if ($@) { die "invalid date format: $date - parsed as (day: $day, month: $months{$mon}, year: $year). Reason: $@"; }
return $time;
}

Change to:



sub date_to_unix {

# --------------------------------------------------------

# This routine must take your date format and return the time a la UNIX time().

# Some things to be careful about..

# timelocal does not like to be in array context, don't do my($time) = timelocal (..)

# int your values just in case to remove spaces, etc.

# catch the fatal error timelocal will generate if you have a bad date..

# don't forget that the month is indexed from 0!

# Fri Dec 13 10:11:08 PST 2002

my $date = shift; my $i;

my %months = map { $_ => $i++ } qw!Jan Fev Mar Abr Mai Jun Jul Ago Set Out Nov Dez!;

my ($day, $mon, $year) = split(/-/, $date);



exists $months{$mon} or return undef;

$day = int($day); $year = $year - 1900;



require Time::Local;

my $time = 0;

eval {


$time = &Time::Local::timelocal(0,0,0,$day,0,$months{$mon},$year); (*** This is s line was cahnge for solve a problem with date and what's new page ***)


};

if ($@) { die "invalid date format: $date - parsed as (day: $day, month: $months{$mon}, year: $year). Reason: $@"; }

return $time;

}



Thanks for all.


Quote Reply
Re: [Quirino] Building new pages don't run In reply to
Now, have a new error, the counting of links new, is being made made a mistake. I use 30 days old, and the counting is being made in 102 days doesn't know as to solve this.

My old links:

$db_new_cutoff = 15;

Now i need a advanced help.

Thanks

Quirino
Quote Reply
Re: [Quirino] Building new pages don't run In reply to
This may not solve your problem, but when you put a comment in the code, it needs a hash mark (pound sign?) in front of it, so your code
Code:
$time = &Time::Local::timelocal(0,0,0,$day,0,$months{$mon},$year); (*** This is s line was cahnge for solve a problem with date and what's new page ***)




Should look like this
Code:
$time = &Time::Local::timelocal(0,0,0,$day,0,$months{$mon},$year); #This line was changed to solve a problem with date and what's new page.




or you can put the comment on its' own line, but make sure there is aline break between comment and code (not a wrapped line).

Code:
# Next line was changed to solve a problem with date and what's new page.

$time = &Time::Local::timelocal(0,0,0,$day,0,$months{$mon},$year);


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Building new pages don't run In reply to
I am sorry about a my bad english, dear friend. In the code below, i don't put a message (*** This is a line was change for solve a problem with date and what's is new page ***), this message i put for all friends see about how is a my problem. My modified source code is below:

$time = &Time::Local::timelocal(0,0,0,$day,0,$months{$mon},$year);

Still, i don't solve a my problem with a script (links 2.0), to be seeing last the 102 days as old. Therefore mine links.cfg says that it would to only see last the 15 days. ($db_new_cutoff = 15;).

I need a help.

Thanks

Quirino
Quote Reply
Re: [PerlFlunkie] Building new pages don't run In reply to
That's great. At least I get my New Pages built again! But I have a 28 day cutoff, and all the new pages are showing clear back to June sometime...and also, it's not showing the new links that I added in December, either. :/

Quote:


(snip)

Updating New and Popular Records . . .
What's New Cutoff: 28 days

(snip)

Building What's New Page . . .
New Links for 30-Nov-2001: 1
New Links for 29-Nov-2000: 1
New Links for 28-Nov-2000: 1
New Links for 27-Nov-2000: 2
New Links for 26-Nov-2000: 5
New Links for 25-Nov-2001: 3
New Links for 18-Nov-1999: 1
New Links for 17-Nov-1999: 3
New Links for 16-Nov-1999: 2
New Links for 14-Nov-1999: 1
New Links for 12-Nov-1999: 2
New Links for 11-Nov-2001: 1
New Links for 09-Nov-1999: 1
New Links for 8-Nov-2001: 4
New Links for 5-Nov-2001: 3
New Links for 4-Nov-2001: 5
New Links for 3-Nov-2001: 1
New Links for 1-Nov-1999: 1
New Links for 31-Jul-2000: 1
New Links for 30-Jul-2002: 2
New Links for 29-Jul-2002: 1
New Links for 28-Jul-2000: 1
New Links for 27-Jul-2000: 1
New Links for 26-Jul-2002: 1
New Links for 25-Jul-2002: 4
New Links for 25-Jul-2001: 1
New Links for 24-Jul-2002: 1
New Links for 24-Jul-1999: 2
New Links for 23-Jul-2000: 1
New Links for 22-Jul-1999: 1
New Links for 20-Jul-2000: 1
New Links for 18-Jul-2000: 5
New Links for 18-Jul-1999: 1
New Links for 17-Jul-1999: 4
New Links for 15-Jul-1999: 1
New Links for 14-Jul-2002: 10
New Links for 14-Jul-1999: 4
New Links for 13-Jul-2000: 1
New Links for 12-Jul-2000: 1
New Links for 12-Jul-2001: 1
New Links for 11-Jul-2001: 4
New Links for 11-Jul-1999: 3
New Links for 10-Jul-2001: 1
New Links for 9-Jul-2000: 1
New Links for 7-Jul-2000: 1
New Links for 7-Jul-2002: 8
New Links for 5-Jul-2000: 4
New Links for 4-Jul-2000: 1
New Links for 3-Jul-2000: 1
New Links for 27-Jun-2000: 4
New Links for 26-Jun-2000: 2
New Links for 25-Jun-2002: 12
New Links for 22-Jun-2001: 1
New Links for 21-Jun-2002: 1
New Links for 21-Jun-2000: 1
New Links for 20-Jun-2000: 1
New Links for 20-Jun-2001: 1
New Links for 16-Jun-1999: 3
New Links for 15-Jun-2000: 4
New Links for 14-Jun-2000: 2
New Links for 13-Jun-1999: 1
New Links for 8-Jun-2002: 1
New Links for 5-Jun-2000: 1
New Links for 3-Jun-1999: 2
Total New Links: 145
Done


Quote:


I should have 2 x in December that it shows New Links update thing (above). Those aren't showing up.

Ack! Go to my New Page and look at the dates! :( at http://www.sanguinarius.org/...bin/links/pages/New/ all January, all ranging form 2005 to 2010!? What the heck is going on NOW?

If somebody who KNOWS a solution who can help me for REAL, pleaee let me know because I am willing to pay you so that I don't have all my time taken up Mickey Mousing around with stupid crap like this! :(

PLEASE!
--Sanguinarius
Your resident vampire ;P
http://www.sanguinarius.org/
Quote Reply
Re: [Quirino] Building new pages don't run In reply to
You should have a look at the solve for your original problem here:

http://www.gossamer-threads.com/...20problem%21;#123915

After a lot of messing around with code changes, I found that fixing the date format in the links.db fixed everything and allowed the removal of all the code fixes. If you instal a new version of 2.0 it works fine with the exact same code as in the old links.cfg file, so the "invalid date format" problem is not in that file!