Commit daaf9194 authored by Romain Therville's avatar Romain Therville 🐭
Browse files

Update to the purge to log additionnal informations in the log file

defined in application.properties.

Issue #192
parent a2966774
...@@ -929,6 +929,8 @@ class tx_nG6_eid { ...@@ -929,6 +929,8 @@ class tx_nG6_eid {
$purge_delay = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('purge_delay')); $purge_delay = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('purge_delay'));
$purge_demand_filter_space = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('purge_demand_filter_space')); $purge_demand_filter_space = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('purge_demand_filter_space'));
$purge_demand_filter_delay_exceeded = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('purge_demand_filter_delay_exceeded')); $purge_demand_filter_delay_exceeded = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('purge_demand_filter_delay_exceeded'));
print json_encode(tx_nG6_db::get_purge_demand_list($purge_delay,$purge_demand_filter_space,$purge_demand_filter_delay_exceeded)); print json_encode(tx_nG6_db::get_purge_demand_list($purge_delay,$purge_demand_filter_space,$purge_demand_filter_delay_exceeded));
} elseif ($type == 'refresh_purge_list') { } elseif ($type == 'refresh_purge_list') {
$max_retention_date = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('max_retention_date')); $max_retention_date = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('max_retention_date'));
...@@ -937,8 +939,6 @@ class tx_nG6_eid { ...@@ -937,8 +939,6 @@ class tx_nG6_eid {
$without_laboratories_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('without_lab')); $without_laboratories_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('without_lab'));
$with_laboratories_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('with_lab')); $with_laboratories_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('with_lab'));
$create_users = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('create_users')); $create_users = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('create_users'));
//Change date format
//print ('test');
print json_encode(tx_nG6_db::filter_list_retention_data_info($filter_space,$max_retention_date,$create_users, $without_laboratories_id,$with_laboratories_id)); print json_encode(tx_nG6_db::filter_list_retention_data_info($filter_space,$max_retention_date,$create_users, $without_laboratories_id,$with_laboratories_id));
} elseif ($type == 'delete_purge_data') { } elseif ($type == 'delete_purge_data') {
//Delete data link to the list of purge demand //Delete data link to the list of purge demand
......
...@@ -194,6 +194,9 @@ class tx_nG6_db { ...@@ -194,6 +194,9 @@ class tx_nG6_db {
$conditions[] = "project_id in (" . $project_list_ids.")" ; $conditions[] = "project_id in (" . $project_list_ids.")" ;
} }
$where = join(' AND ', $conditions); $where = join(' AND ', $conditions);
$log_file_path = tx_nG6_utils::get_log_path();
error_log("IN filter_list_retention_data_info(), where=".$where." \n", 3, $log_file_path);
return (tx_nG6_db::select_list_retention_data_info($where)); return (tx_nG6_db::select_list_retention_data_info($where));
} }
...@@ -214,6 +217,7 @@ class tx_nG6_db { ...@@ -214,6 +217,7 @@ class tx_nG6_db {
} }
static function select_list_retention_data_info($where) { static function select_list_retention_data_info($where) {
$by_project=array(); $by_project=array();
$empty_res_structure = array( $empty_res_structure = array(
'project_name' => "", 'project_name' => "",
...@@ -333,6 +337,9 @@ class tx_nG6_db { ...@@ -333,6 +337,9 @@ class tx_nG6_db {
} }
} }
$log_file_path = tx_nG6_utils::get_log_path();
error_log("IN filter_list_retention_data_info(), return=".print_r($by_project,TRUE)." \n", 3, $log_file_path);
return($by_project); return($by_project);
} }
......
...@@ -440,6 +440,29 @@ $template_mail.='<p>Yours sincerely</p> ...@@ -440,6 +440,29 @@ $template_mail.='<p>Yours sincerely</p>
return($path_to_save_dir); return($path_to_save_dir);
} }
static function get_log_path(){
$config_file_content = tx_nG6_utils::get_config_content();
$array_config_content = explode(PHP_EOL, $config_file_content);
$pattern_to_find = "log_file = ";
$log_file_path_found = FALSE;
//We want to return the log file path
foreach($array_config_content as $line_id => $line_content){
//if we found the right line
if(strpos ( $line_content , $pattern_to_find) === 0){
$log_file_path_found = TRUE;
}
if($log_file_path_found){
$log_file_path = str_replace($pattern_to_find,'',$line_content);
return($log_file_path);
}
}
return('0');
}
static function convert_epoch_timestamp_to_nice_date( $epoch_date ){ static function convert_epoch_timestamp_to_nice_date( $epoch_date ){
//return(gmdate('D, d M Y', $epoch_date)); //return(gmdate('D, d M Y', $epoch_date));
return(gmdate('l jS \of F Y', $epoch_date)); return(gmdate('l jS \of F Y', $epoch_date));
......
...@@ -169,6 +169,10 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { ...@@ -169,6 +169,10 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
//Retrieve purgeable information for email //Retrieve purgeable information for email
$run_info=Array(); $run_info=Array();
$analyses_info=Array(); $analyses_info=Array();
$log_file_path = tx_nG6_utils::get_log_path();
error_log("IN tx_nG6_pi6.php, 'add_purge_demand' \n p = ".print_r($p, TRUE), 3, $log_file_path);
$all_purgeable_runs=array_merge($p[$project_id]["state"]["stored"]["run_ids"],$p[$project_id]["state"]["extended"]["run_ids"]); $all_purgeable_runs=array_merge($p[$project_id]["state"]["stored"]["run_ids"],$p[$project_id]["state"]["extended"]["run_ids"]);
$all_purgeable_analysis=array_merge($p[$project_id]["state"]["stored"]["analysis_ids"],$p[$project_id]["state"]["extended"]["analysis_ids"]); $all_purgeable_analysis=array_merge($p[$project_id]["state"]["stored"]["analysis_ids"],$p[$project_id]["state"]["extended"]["analysis_ids"]);
$nb_run_purgeable = $p[$project_id]["state"]["stored"]["nb_run"]+ $p[$project_id]["state"]["extended"]["nb_run"]; $nb_run_purgeable = $p[$project_id]["state"]["stored"]["nb_run"]+ $p[$project_id]["state"]["extended"]["nb_run"];
...@@ -192,8 +196,14 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { ...@@ -192,8 +196,14 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
http_response_code(401); http_response_code(401);
return "Nobody seems to be authenticated."; return "Nobody seems to be authenticated.";
} }
$log_file_path = tx_nG6_utils::get_log_path();
error_log("IN tx_nG6_pi6.php, 'add_purge_demand' \n all_purgeable_runs = ".print_r($all_purgeable_runs, TRUE), 3, $log_file_path);
#Add purge demand to get id #Add purge demand to get id
$purge_demand_id = tx_nG6_db::add_purge_demand($GLOBALS['TSFE']->fe_user->user['uid'],$project_id,$p[$project_id]["total_purgeable_size"],$all_purgeable_runs,$all_purgeable_analysis,$purge_user_id_to); $purge_demand_id = tx_nG6_db::add_purge_demand($GLOBALS['TSFE']->fe_user->user['uid'],$project_id,$p[$project_id]["total_purgeable_size"],$all_purgeable_runs,$all_purgeable_analysis,$purge_user_id_to);
#Build corresponding string array #Build corresponding string array
//TODO RETURN TOTAL SIZE tx_nG6_utils::get_octet_string_representation($p[$project_id]["total_size"] //TODO RETURN TOTAL SIZE tx_nG6_utils::get_octet_string_representation($p[$project_id]["total_size"]
$total_project_size = tx_nG6_db::get_project_size($project_id, true); $total_project_size = tx_nG6_db::get_project_size($project_id, true);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment