<?php

require_once __DIR__.'/Common.php';

class Main
{
    private $common;
    private $mongo;
    private $con_dist;

    public function __construct()
    {
        $this->common = new Common();
        $dbc = new Database();

        $this->common->chkEmptyVar(array(MY_IP, CRAWL_DIR, SCRAPY_DIR, PROCESS_CHILDS, PROCESS_DIR, BASE_DIR));

        $dist = $dbc->conDist();
        $this->mongo = $dbc->conMongo();

        if (!is_object($mongo)) {
            $this->common->logErrorFatal('', 'mongo:', 'mongo connection object is unusable'.print_r($mongo, true), print_r(error_get_last(), true));
        }

        if ($dist instanceof mysqli) {
            $this->con_dist = $dist;
        } else {
            $this->common->logErrorFatal('', 'mysql:', 'dist mysql connection object is unusable'.print_r($dist, true), print_r(error_get_last(), true));
        }
    }


}
