<?php

chdir("/***/YellowPagesGrabber");
require_once "prepend.php";
error_reporting(E_ALL);
require_once "YellowPagesContentGrabber.php";
require_once "YellowPages1ContentGrabber.php";
require_once "ProxiesService.php";
require_once "UrlUtils.php";
require_once "StateUtils.php";
require_once "FileUtils.php";
define("CALC_REALNUMS_STAT", "data/calcRealNumsStat.dat");
define("CALC_START_ID", StateUtils::getStateFileName("data/startId.dat"));
function onShutdown()
{
    StateUtils::resetBusy(CALC_REALNUMS_STAT);
}
set_time_limit(0);
if (StateUtils::isBusy(CALC_REALNUMS_STAT)) {
    print "Is busy\n";
    exit;
}
StateUtils::setBusy(CALC_REALNUMS_STAT);
register_shutdown_function("onShutdown");
// ƒл¤ YellowPagesContentGrabber запускать скрипт без параметров или 0 0
// ƒл¤ YellowPages1ContentGrabber запускать скрипт c параметрами 1 1
$parserId = StateUtils::getProcessNum() + 1;
if ($parserId == 1) {
    $Parser =& new YellowPagesContentGrabber();
} else {
    $Parser =& new YellowPages1ContentGrabber();