Gossamer Forum
Home : Products : Links 2.0 : Customization :

New mod - Update Ratings & Hits Only

Quote Reply
New mod - Update Ratings & Hits Only
This mod will allow you to update your Ratings & Hits from the control panel without having to do a complete build.

1. Copy nph-build.cgi to the same folder and rename it to nph-build-update.cgi

2. Open nph-build-update.cgi

3. Find: sub build_all {

4. Replace

Code:


sub build_all {

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

# Rebuild the entire directory.



# Determine if we are printing to command line, or to browser.



$nph++;

&html_print_headers() if ($use_html);





my $start = time();

my $date = &get_date;

my $time = &get_time;





# Print HTML Header

$use_html ?

print qq|<html><head><tittle>Links Manager: Building Pages</title></head>

<BASE TARGET="_top">

<BODY BGCOLOR=#FFFFFF><H2><TT>Building Pages</TT></H2>

<PRE>| :

print qq|Building Pages\n|;

print "Pages built on " . $date . " at " . $time . "\n";

print "--------------------------------------------------------\n\n";



# Backup the database.

print "Backing up database . . .\n";

&build_backup;

print "Done.\n\n";



# Rebuild URL Index (This file is auto-generated, you will never need to touch it!

print "Building URL Index . . .\n";

&build_url_index;

print "Done.\n\n";



# Update New and Popular Records..

print "Updating New and Popular Records . . .\n";

&build_update_newpop;

print "Done.\n\n";



# Update voting information ..

print "Updating ratings .. \n";

&build_update_ratings;

print "Done.\n\n";



# Load Category Information

print "Loading Category Information . . .\n";

&build_category_information;

print "Done.\n\n";





# Generate some stats for future pages...

print "Gathering Category and Link information . . .\n";

&build_stats;

print "Done\n\n";



# Generate detailed view pages.

if ($build_detailed) {

print "Generating detailed view pages . . . \n";

&build_detailed_view;

print "Done\n\n";

}





# Create Home Page

$use_html ?

print qq|Building <A HREF="$build_root_url/$build_index">Home Pages</A> . . .\n| :

print qq|Building Home Page . . .\n|;

&build_home_page;

print "\tDone\n\n";



# Create What's Cool Page

$use_html ?

print "Building <A HREF=\"$build_cool_url/$build_index\">What's Cool</A> Page . . .\n" :

print "Building What's Cool Page . . .\n";

&build_cool_page;

print "Done\n\n";





# Create What's New Page

$use_html ?

print "Building <A HREF=\"$build_new_url/$build_index\">What's New</A> Page . . .\n" :

print "Building What's New Page . . .\n";

&build_new_page;

print "Done\n\n";



# Create Top Rated Page

$use_html ?

print "Building <A HREF=\"$build_ratings_url/$build_index\">Top Rated</A> Page . . .\n" :

print "Building Top Rated . . .\n";

&build_rate_page;

print "Done\n\n";





# Create Category Pages

print "Building Category Pages . . .\n";

&build_category_pages;

print "Done\n\n";





# We are finished!

print "Pages Built (", time() - $start, " s)!";

print "</PRE></BODY></HTML>" if ($use_html);

}




with

Code:


sub build_all {

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

# Rebuild the entire directory.



# Determine if we are printing to command line, or to browser.



$nph++;

&html_print_headers() if ($use_html);





my $start = time();

my $date = &get_date;

my $time = &get_time;





# Print HTML Header

$use_html ?

print qq|<html><head><tittle>Links Manager: Updating Ratings & Hits</title></head>

<BASE TARGET="_top">

<BODY BGCOLOR=#FFFFFF><H2><TT>Updating Ratings & Hits</TT></H2>

<PRE>| :

print qq|Building Pages\n|;

print "Pages built on " . $date . " at " . $time . "\n";

print "--------------------------------------------------------\n\n";



# Backup the database.

print "Backing up database . . .\n";

&build_backup;

print "Done.\n\n";



# Rebuild URL Index (This file is auto-generated, you will never need to touch it!

print "Building URL Index . . .\n";

&build_url_index;

print "Done.\n\n";



# Update New and Popular Records..

print "Updating New and Popular Records . . .\n";

&build_update_newpop;

print "Done.\n\n";



# Update voting information ..

print "Updating ratings .. \n";

&build_update_ratings;

print "Done.\n\n";



# Load Category Information

print "Loading Category Information . . .\n";

&build_category_information;

print "Done.\n\n";





# Generate some stats for future pages...

print "Gathering Category and Link information . . .\n";

&build_stats;

print "Done\n\n";



# Generate detailed view pages.

if ($build_detailed) {

print "Generating detailed view pages . . . \n";

&build_detailed_view;

print "Done\n\n";

}





# Create Home Page

# $use_html ?

# print qq|Building <A HREF="$build_root_url/$build_index">Home Pages</A> . . .\n| :

# print qq|Building Home Page . . .\n|;

# &build_home_page;

# print "\tDone\n\n";



# Create What's Cool Page

$use_html ?

print "Building <A HREF=\"$build_cool_url/$build_index\">What's Cool</A> Page . . .\n" :

print "Building What's Cool Page . . .\n";

&build_cool_page;

print "Done\n\n";





# Create What's New Page

# $use_html ?

# print "Building <A HREF=\"$build_new_url/$build_index\">What's New</A> Page . . .\n" :

# print "Building What's New Page . . .\n";

# &build_new_page;

# print "Done\n\n";



# Create Top Rated Page

$use_html ?

print "Building <A HREF=\"$build_ratings_url/$build_index\">Top Rated</A> Page . . .\n" :

print "Building Top Rated . . .\n";

&build_rate_page;

print "Done\n\n";





# Create Category Pages

# print "Building Category Pages . . .\n";

# &build_category_pages;

# print "Done\n\n";





# We are finished!

print "Pages Built (", time() - $start, " s)!";

print "</PRE></BODY></HTML>" if ($use_html);

}


5. Open admin_html.cgi

6. Find

Code:


<a href="nph-build.cgi">Build All</a><br>

<a href="nph-build.cgi?staggered=1">Staggered</a><br>

<a href="nph-build.cgi?staggered=1&auto=1">Staggered (Auto)</a><br>

<a href="$db_script_url?db=links&html_edit_template=1">Edit Templates</a><br>


and add

Code:


<a href="nph-build-update.cgi">Update Ratings & Hits</a><br>



7. Upload admin_html.cgi and nph-build-update.cgi

8. CHMOD nph-build-update.cgi to 755

9. Enter the control panel and select Update Ratings & Hits to run. That's it!



( Thanks to Andy & Stealth for their input. Wink )

Quote Reply
Re: [MJB] New mod - Update Ratings & Hits Only In reply to
As the above doesn't look too good I've attached a zip file to this post that contains the formatted text file.

Last edited by:

MJB: Sep 12, 2003, 1:35 PM
Quote Reply
Re: [MJB] New mod - Update Ratings & Hits Only In reply to
I've stuck this thread to the top of the forum, as I'm sure quite a few people would like to use it :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [MJB] New mod - Update Ratings & Hits Only In reply to
nice - i'm sure this will keep my host happier - i'll just set a cronjob to do this hourly rather than the whole thing twice daily
Quote Reply
Re: [MJB] New mod - Update Ratings & Hits Only In reply to
An additional note to avoid confusion:

Because this mod doesn't do a complete build it ONLY builds the Ratings & Cool pages. For the stats to show correctly throughout you will still have to do a complete build at some point.
Quote Reply
Re: [MJB] New mod - Update Ratings & Hits Only In reply to
A litte modifycation on this mod

I changed the function name of the replacement build_all in build_update and replaced the $IN selection and added it to nph-build.cgi.

Attachment is the modifyction of this mod

Last edited by:

athair: Nov 26, 2003, 6:18 AM
Quote Reply
Re: [athair] New mod - Update Ratings & Hits Only In reply to
I installed the mod with cronjob a Great every it is updated daily

Cheers
Megrisoft
Web Hosting Company
India Software Company
SEO Company


Quote Reply
Re: [megri] New mod - Update Ratings & Hits Only In reply to
If you don't mind me asking. When I've done this and click the Update Ratings & Hits what should it say after I click that. I get "The page cannot be displayed" is this right?
Post deleted by jayman In reply to
Post deleted by jayman In reply to