summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSashi202019-03-27 15:37:57 +0530
committerSashi202019-03-27 15:37:57 +0530
commit9afb9aed90606594d73cc9958b886f3a7abb07b7 (patch)
tree5d1e07874cb727f885807238a82a36af1259cff5
parentb32025aca1b725d36cce18a66f28409c8924f0cb (diff)
downloadDWSIM_lab_migration_module-9afb9aed90606594d73cc9958b886f3a7abb07b7.tar.gz
DWSIM_lab_migration_module-9afb9aed90606594d73cc9958b886f3a7abb07b7.tar.bz2
DWSIM_lab_migration_module-9afb9aed90606594d73cc9958b886f3a7abb07b7.zip
Fix issue to disapprove the entire lab
-rwxr-xr-xbulk_approval.inc31
-rwxr-xr-xgeneral_deletion.inc14
2 files changed, 39 insertions, 6 deletions
diff --git a/bulk_approval.inc b/bulk_approval.inc
index 8afa5bc..0ec220a 100755
--- a/bulk_approval.inc
+++ b/bulk_approval.inc
@@ -489,6 +489,27 @@ FOSSEE,IIT Bombay', array(
}
elseif (($form_state['values']['lab_actions'] == 3) && ($form_state['values']['lab_experiment_actions'] == 0) && ($form_state['values']['lab_experiment_solution_actions'] == 0))
{
+ $query = db_select('lab_migration_proposal');
+ $query->fields('lab_migration_proposal');
+ $query->condition('id', $form_state['values']['lab']);
+ $proposal_q = $query->execute()->fetchObject();
+ $query = db_select('lab_migration_experiment');
+ $query->fields('lab_migration_experiment');
+ $query->condition('proposal_id', $form_state['values']['lab']);
+ $experiment_q = $query->execute();
+ $experiment_data = $experiment_q->fetchObject();
+ $exp_path = $root_path . $proposal_q->directory_name . '/EXP' . $experiment_data->number;
+ //$dir_path = $root_path . $proposal_q->directory_name;
+ if (is_dir($dir_path))
+ {
+ //rmdir($exp_path);
+ $res = rmdir($exp_path);
+ if (!$res)
+ {
+ drupal_set_message(t("Cannot delete Lab directory : " . $dir_path . ". Please contact administrator."), 'error');
+ return;
+ }
+ }
if (strlen(trim($form_state['values']['message'])) <= 30)
{
form_set_error('message', t(''));
@@ -577,13 +598,17 @@ FOSSEE,IIT Bombay', array(
$query = db_select('lab_migration_proposal');
$query->fields('lab_migration_proposal');
$query->condition('id', $form_state['values']['lab']);
+ $proposal_q = $query->execute()->fetchObject();
+ $query = db_select('lab_migration_experiment');
+ $query->fields('lab_migration_experiment');
+ $query->condition('proposal_id', $form_state['values']['lab']);
$experiment_q = $query->execute();
$experiment_data = $experiment_q->fetchObject();
- //var_dump($experiment_q);die;
- $dir_path = $root_path . $experiment_data->directory_name;
- //var_dump($experiment_data->directory_name);die;
+ $exp_path = $root_path . $proposal_q->directory_name . '/EXP' . $experiment_data->number;
+ $dir_path = $root_path . $proposal_q->directory_name;
if (is_dir($dir_path))
{
+ rmdir($exp_path);
$res = rmdir($dir_path);
if (!$res)
{
diff --git a/general_deletion.inc b/general_deletion.inc
index 33ac98a..1121ef5 100755
--- a/general_deletion.inc
+++ b/general_deletion.inc
@@ -116,8 +116,10 @@ function lab_migration_delete_solution($solution_id)
$query->condition('id', $experiment_data->proposal_id);
$proposal_q = $query->execute();
$proposal_data = $proposal_q->fetchObject();
- $ex_path = $proposal_data->directory_name . '/' . $solution_files_data->filepath;
- $dir_path = $root_path . $ex_path;
+ //$ex_path = $proposal_data->directory_name . '/' . $solution_files_data->filepath;
+ //$dir_path = $root_path . $ex_path;
+ $dir_path = $root_path . $proposal_data->directory_name . '/EXP' . $experiment_data->number . '/CODE' . $solution_data->code_number;
+ //var_dump($dir_path);die;
if (is_dir($dir_path))
{
if (!rmdir($dir_path))
@@ -167,6 +169,12 @@ function lab_migration_delete_experiment($experiment_id)
$query->condition('id', $experiment_id);
$experiment_q = $query->execute();
$experiment_data = $experiment_q->fetchObject();
+ $query = db_select('lab_migration_proposal');
+ $query->fields('lab_migration_proposal');
+ $query->condition('id', $form_state['values']['lab']);
+ $proposal_q = $query->execute();
+ $proposal_data = $proposal_q->fetchObject();
+
if (!$experiment_data)
{
drupal_set_message('Invalid experiment.', 'error');
@@ -195,7 +203,7 @@ function lab_migration_delete_experiment($experiment_id)
if ($status)
{
- $dir_path = $root_path . $experiment_data->proposal_id . '/EXP' . $experiment_data->number;
+ $dir_path = $root_path . $proposal_data->directory_name . '/EXP' . $experiment_data->number;
if (is_dir($dir_path))
{