$sql->get_row($query, $sample_regions[$i]); } $sql->send_query($lock_jobs_query, TRUE); for ($i = 0; $i < sizeof($samples_to_process); $i++) { if ($delete_files_from_disk) { //make a processing job for the sample--this will allow us to delete all temprary data later on. $job = new ns_processing_job(); $job->id = 0; $job->maintenance_task = $ns_maintenance_tasks['ns_maintenance_delete_files_from_disk_request']; $job->time_submited = ns_current_time(); for ($d = 0; $d < sizeof($file_deletion_job->operations); $d++) { $job->operations[$d] = 0; } if ($delete_sample_images != '') { $job->sample_id = $samples_to_process[$i]; $job->save_to_db($sql); // ns_delete_sample_from_database($samples_to_process[$i],$sql); } else { if ($clear_region != '') { for ($b = 0; $b < sizeof($sample_regions[$i]); $b++) { $file_deletion_job = clone $job; $file_deletion_job->region_id = $sample_regions[$i][$b][0]; $file_deletion_job->save_to_db($sql); ns_delete_region_from_database($sample_regions[$i][$b][0], $sql); } } else { throw new ns_ex("Unknown error!"); } } } }
function ns_delete_images_from_database($experiment_id, $sample_id, $region_id, $image_id, $sql) { global $ns_maintenance_tasks; global $ns_maintenance_flags; $job = new ns_processing_job(); $job->maintenance_task = $ns_maintenance_tasks['ns_maintenance_delete_images_from_database']; $job->experiment_id = $experiment_id; $job->sample_id = $sample_id; $job->region_id = $region_id; $job->image_id = $image_id; $job->urgent = 2; $job->time_submitted = ns_current_time(); if ($experiment_id == 0 && $sample_id == 0 && $region_id != 0 && $image_id == 0) { // die("WHOOP!"); $job->maintenance_flag = $ns_maintenance_flags['ns_delete_entire_sample_region']; } $job->save_to_db($sql); ns_update_job_queue($sql); }