Exemplo n.º 1
0
require realpath(dirname(__FILE__)) . '/../../../common/Loader.php';
try {
    # Initialize
    $feeder = new FeederModule($pakiti);
    # Asynchronous mode - only store the results and exit
    #----------------------------------------------------
    if (Config::$FEEDER_MODE == Constants::$FEEDER_ASYNCHRONOUS_MODE) {
        Utils::log(LOG_DEBUG, "Processing report in asynchronous mode");
        $feeder->storeReportToFile();
    } elseif (Config::$FEEDER_MODE == Constants::$FEEDER_SYNCHRONOUS_MODE) {
        Utils::log(LOG_DEBUG, "Processing report in synchronous mode");
        # Process incomming data
        $feeder->processReport();
        # Should we send the results back to the client?
        if (Utils::getHttpVar(Constants::$REPORT_REPORT) == Constants::$SEND_REPORT) {
            $feeder->sendResultsBack();
        }
    } else {
        Utils::log(LOG_ERROR, "Undefined feeder mode");
        print Constants::$RETURN_ERROR;
        exit;
    }
    # End
    Utils::log(LOG_INFO, "Report done for [host=" . Utils::getHttpVar(Constants::$REPORT_HOSTNAME) . "] in " . Utils::getTimer($time) . "s\n");
    print Constants::$RETURN_OK;
    exit;
} catch (Exception $e) {
    Utils::log(LOG_ERR, $e->getMessage());
    print Constants::$RETURN_ERROR;
    exit;
}