PDA

View Full Version : reindex specific PHP page on change?


ZAP
11-28-2003, 02:11 PM
Hello -

Great script!

Our site has some pages with articles that users can comment on. The comments are added to a text file and then included at the bottom of the page using a simple PHP include statement. phpDig is able to index these comments with no problem.

What I would ideally like to do is to add a line to my PHP comment script that would make phpDig reindex just that page after adding the new comment. I realize that I could call the spider script after adding the comment, but how can I specify the specific URL and keep phpDig from spidering all the other links? I want to keep my search index up-to-date, but I don't want to tax the server unnecessarily.

THANKS in advance for your response.

Charter
11-28-2003, 05:56 PM
Hi. Maybe try something like the following:

// edit to fit your OS and script
if ($_POST['is_new_comment'] == "yes it is") {
$comment_page = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$comment_page = escapeshellcmd($comment_page);
$the_command = "php -f [PHPDIG_DIR]/admin/spider.php ".$comment_page;
exec($the_command);
}

/* set the following in config.php
define('SPIDER_MAX_LIMIT',0);
define('SPIDER_DEFAULT_LIMIT',0);
define('RESPIDER_LIMIT',0);
*/

ZAP
11-28-2003, 07:35 PM
Thanks! I'll give it a try in a day or so and let you know how it turned out. I think I'll probably add a flag to spider.php to make it only reindex that one page rather than setting it in the config file (since at other times I'll want it to spider).