コード例 #1
0
    file_put_contents($csv_file, preg_replace('/[\\r\\n]+/', "\n", file_get_contents($csv_file)));
    file_put_contents($results_dir . '/groups.log', $status, FILE_APPEND | LOCK_EX);
    $csv = new EasyCSV\Reader($csv_file, 'r+', false);
    while (true) {
        $row = $csv->getRow();
        if (!$row) {
            break;
        }
        //        skip headers
        if (in_array(trim(strtolower($row['0'])), ['dataset', 'url'])) {
            continue;
        }
        $datasetName = basename($row['0']);
        $StagingClient->say(str_pad($datasetName, 100, ' . '), '');
        try {
            $DatasetArray = $StagingClient->getDataset($datasetName);
            //            no exception, cool
            $StagingClient->say(str_pad('Staging OK', 15, ' . '), '');
            $ProductionClient->diffUpdate($datasetName, $DatasetArray);
            //            var_dump($DatasetArray);die();
        } catch (Exceptions\NotFoundHttpException $ex) {
            $StagingClient->say(str_pad('Staging 404', 15, ' . '));
        } catch (\Exception $ex) {
            $StagingClient->say(str_pad('Staging Error: ' . $ex->getMessage(), 15, ' . '));
        }
        //        debug
        //        die();
    }
}
// show running time on finish
timer();