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

Update to tx_nG6_pi6.php

Function "resend_purge_demand" reworked to ignore hidden runs and
analyzes.

Issues #178, #193
parent 110f4ecb
......@@ -253,31 +253,45 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
$res_demands = tx_nG6_db::get_purge_demand_from_id($demands_id);
foreach($res_demands as $res_demand){
$res_project = tx_nG6_db::select_project($res_demand["project_id"]);
$total_project_size = tx_nG6_db::get_project_size($res_demand["project_id"], true) ;
//We compute the project size without hidden elements
$total_project_size = tx_nG6_db::get_project_size($res_demand["project_id"], true, false) ;
$run_info=Array();
$analyses_info=Array();
$search=array("###TYPE_OBJECT###","###RUN_ID###","###PROJECT_ID###");
$project_id = $res_demand["project_id"];
$all_purgeable_runs = explode(',',$res_demand["run_ids"]);
$all_purgeable_analysis = explode(',',$res_demand["analyze_ids"]);
$nb_run_purgeable = 0;
$nb_analyse_purgeable = 0;
$displayed_purge_size = 0;
foreach($all_purgeable_runs as $run_id ){
$run = tx_nG6_db::select_run($run_id);
$run_name = $run["name"];
$replace=array("run_id",$run_id,$project_id);
$run_info[] = '<a href="'.str_replace($search, $replace, $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["run_link_url"]).'">'.$run["name"].' ('.$run_id.')</a>';
// We exclude hidden runs from the mail
if( $run["hidden"] != 1 && isset($run["name"]) ){
$run_name = $run["name"];
$replace=array("run_id",$run_id,$project_id);
$run_info[] = '<a href="'.str_replace($search, $replace, $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["run_link_url"]).'">'.$run["name"].' ('.$run_id.')</a>';
$nb_run_purgeable++;
$displayed_purge_size = $displayed_purge_size + $run["storage_size"];
}
}
foreach($all_purgeable_analysis as $analysis_id ){
$analysis = tx_nG6_db::select_analyse($analysis_id);
$analysis_name = $analysis["name"];
$replace=array("analyze_id",$analysis_id,$project_id);
$analyses_info[] = '<a href="'.str_replace($search, $replace, $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["run_link_url"]).'">'.$analysis_name.' ('.$analysis_id.')</a>';
// We exclude hidden analyzes from the mail
if( $analysis["hidden"] != 1 && isset($analysis["name"]) ){
$analysis_name = $analysis["name"];
$replace=array("analyze_id",$analysis_id,$project_id);
$analyses_info[] = '<a href="'.str_replace($search, $replace, $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["run_link_url"]).'">'.$analysis_name.' ('.$analysis_id.')</a>';
$nb_analyse_purgeable++;
$displayed_purge_size = $displayed_purge_size + $analysis["storage_size"];
}
}
//We now use join(', ', $run_info) and join(', ', $analyses_info) in get_purge_mail().
$extension_allowed = 1;
$mail = tx_nG6_utils::get_purge_mail($res_project["name"],$res_demand["project_id"],
count(explode(",", $res_demand["run_ids"])), count(explode(",", $res_demand["analyze_ids"])), $res_demand["demand_id"],
tx_nG6_utils::get_octet_string_representation($res_demand["purge_size"]), tx_nG6_utils::get_octet_string_representation($total_project_size),
$nb_run_purgeable, $nb_analyse_purgeable, $res_demand["demand_id"],
tx_nG6_utils::get_octet_string_representation($displayed_purge_size), tx_nG6_utils::get_octet_string_representation($total_project_size),
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["delay_purge"],
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["extension_url_price"], $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["min_extension_duration"],
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["min_extension_size"], "This email was send to ". join(', ',$res_demand["emails"]).". ", join(', ', $run_info), join(', ', $analyses_info), $extension_allowed);
......
Markdown is supported
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