<?php

/*
 * Created on 11.02.2012
 * Oliver Soop(osoop1@ut.ee)
 */
 
include_once ("../database/URLDatabaseService.php");
include_once ("../crawler/RSSUrlCrawler.php");

/**
 * Skript millega käivitada URL-ide roomamine, et leida RSS-vooge
 * Käivitamisel tuleb anda argumendid andmebaasi vastava algus ja lõpp rea kohta, kus roomamine käivitatakse
 */
if(count($argv) > 2) {
	$start = $argv[1];
	$end = $argv[2];
	$urls = URLDatabaseService :: getCrawlableUrls($start, $end);

	foreach ($urls as $url) {
		echo "start";
		$crawler = new RSSUrlCrawler($url);
		$crawler->setTimeLimit(1000);
		$foundFeeds = $crawler->crawl();
		URLDatabaseService :: setUrlCrawled($url, count($foundFeeds));
	}

} else {
	echo "Puuduvad andmebaasi ridade arvud";
}

?>
