diff options
Diffstat (limited to 'general_deletion.inc')
-rwxr-xr-x | general_deletion.inc | 53 |
1 files changed, 7 insertions, 46 deletions
diff --git a/general_deletion.inc b/general_deletion.inc index 604768a..fc3a09b 100755 --- a/general_deletion.inc +++ b/general_deletion.inc @@ -4,7 +4,7 @@ /****************************** DELETION FUNCTIONS ****************************/ /******************************************************************************/ -function delete_solution($solution_id) +function lab_migration_delete_solution($solution_id) { global $user; $root_path = lab_migration_path(); @@ -90,7 +90,7 @@ function delete_solution($solution_id) return $status; } -function delete_experiment($experiment_id) +function lab_migration_delete_experiment($experiment_id) { $status = TRUE; $root_path = lab_migration_path(); @@ -109,7 +109,7 @@ function delete_experiment($experiment_id) while ($solution_data = db_fetch_object($solution_q)) { $delete_exp_folder = TRUE; - if (!delete_solution($solution_data->id)) + if (!lab_migration_delete_solution($solution_data->id)) $status = FALSE; } @@ -147,7 +147,7 @@ function delete_experiment($experiment_id) return FALSE; } -function delete_lab($lab_id) +function lab_migration_delete_lab($lab_id) { $status = TRUE; $root_path = lab_migration_path(); @@ -164,7 +164,7 @@ function delete_lab($lab_id) $experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d", $proposal_data->id); while ($experiment_data = db_fetch_object($experiment_q)) { - if (!delete_experiment($experiment_data->id)) + if (!lab_migration_delete_experiment($experiment_data->id)) { $status = FALSE; } @@ -172,46 +172,7 @@ function delete_lab($lab_id) return $status; } -function delete_file($file_id) -{ - $root_path = lab_migration_path(); - - $file_q = db_query("SELECT * FROM {lab_migration_solution_files} WHERE id = %d LIMIT 1", $file_id); - $file_data = db_fetch_object($file_q); - if (!$file_data) - { - drupal_set_message('Invalid file specified.', 'error'); - return FALSE; - } - - if (!file_exists($root_path . $file_data->filepath)) - { - drupal_set_message(t('Error deleting !file. File does not exists.', array('!file' => $file_data->filepath)), 'error'); - return FALSE; - } - - /* removing solution file */ - if (!unlink($root_path . $file_data->filepath)) - { - drupal_set_message(t('Error deleting !file', array('!file' => $file_data->filepath)), 'error'); - - /* sending email to admins */ - $email_to = variable_get('lab_migration_emails', ''); - $param['standard']['subject'] = "[ERROR] Error deleting file"; - $param['standard']['body'] = "Error deleting file by " . $user->uid . " at " . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . " : - file id : " . $file_id . " - file path : " . $file_data->filepath; - if (!drupal_mail('lab_migration', 'standard', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE)) - drupal_set_message('Error sending email message.', 'error'); - return FALSE; - } else { - /* deleting example files database entries */ - db_query("DELETE FROM {lab_migration_solution_files} WHERE id = %d", $file_id); - return TRUE; - } -} - -function del_lab_pdf($lab_id) +function lab_migration_del_lab_pdf($lab_id) { $root_path = lab_migration_path(); $dir_path = $root_path . "latex/"; @@ -221,7 +182,7 @@ function del_lab_pdf($lab_id) } -function delete_dependency($dependency_id) +function lab_migration_delete_dependency($dependency_id) { global $user; $root_path = lab_migration_path(); |