* datasetName, orgId */ foreach (glob(CKANMNGR_DATA_DIR . '/delete*.csv') as $csv_file) { $status = PHP_EOL . PHP_EOL . basename($csv_file) . PHP_EOL . PHP_EOL; echo $status; // fix wrong END-OF-LINE file_put_contents($csv_file, preg_replace('/[\\r\\n]+/', "\n", file_get_contents($csv_file))); $basename = str_replace('.csv', '', basename($csv_file)); $logFile = $results_dir . '/' . $basename . '_log.csv'; $csv = new EasyCSV\Reader($csv_file, 'r+', false); $i = 1; while (true) { $row = $csv->getRow(); if (!$row) { break; } // skip headers if (in_array(trim(strtolower($row['0'])), ['dataset', 'url', 'old dataset url', 'from'])) { continue; } $datasetName = basename($row['0']); // $organizationName = basename($row['1']); printf('[%04d] ', $i++); $CkanManager->deleteDataset($datasetName); //, $organizationName file_put_contents($logFile, $CkanManager->logOutput, FILE_APPEND | LOCK_EX); $CkanManager->logOutput = ''; } } // show running time on finish timer();