Commit 60b8f8bd authored by Romain Therville's avatar Romain Therville 🐭
Browse files

Merge branch 'issue#27' into 'master'

Merge branch Issue#27 with master

See merge request !44
parents 197ef09d 086d87fb
......@@ -1212,19 +1212,19 @@ INSERT INTO `tx_nG6_project` (`uid`, `pid`, `tstamp`, `crdate`, `cruser_id`, `de
--
-- Structure de la vue `tx_nG6_view_project_analyze`
--
CREATE ALGORITHM=UNDEFINED DEFINER=`typo3`@`localhost` SQL SECURITY DEFINER VIEW `tx_nG6_view_project_analyze` AS select `tx_nG6_project`.`uid` AS `project_id`,`tx_nG6_project`.`name` AS `project_name`,`tx_nG6_analyze`.`uid` AS `analyze_id`,`tx_nG6_analyze`.`storage_size` AS `storage_size`,`tx_nG6_analyze`.`purged_size` AS `purged_size`,`tx_nG6_analyze`.`data_state` AS `state`,`tx_nG6_analyze`.`retention_date` AS `retention_date`,`tx_nG6_analyze`.`purge_demand_id` AS `purge_demand_id` from ((`tx_nG6_project` join `tx_nG6_project_analyze` on((`tx_nG6_project_analyze`.`project_id` = `tx_nG6_project`.`uid`))) join `tx_nG6_analyze` on((`tx_nG6_project_analyze`.`analyze_id` = `tx_nG6_analyze`.`uid`)));
CREATE ALGORITHM=UNDEFINED DEFINER=`typo3`@`localhost` SQL SECURITY DEFINER VIEW `tx_nG6_view_project_analyze` AS select `tx_nG6_project`.`uid` AS `project_id`,`tx_nG6_project`.`name` AS `project_name`,`tx_nG6_analyze`.`uid` AS `analyze_id`,`tx_nG6_analyze`.`storage_size` AS `storage_size`,`tx_nG6_analyze`.`purged_size` AS `purged_size`,`tx_nG6_analyze`.`data_state` AS `state`,`tx_nG6_analyze`.`retention_date` AS `retention_date`,`tx_nG6_analyze`.`purge_demand_id` AS `purge_demand_id`, `tx_nG6_analyze`.`hidden` AS `hidden` from ((`tx_nG6_project` join `tx_nG6_project_analyze` on((`tx_nG6_project_analyze`.`project_id` = `tx_nG6_project`.`uid`))) join `tx_nG6_analyze` on((`tx_nG6_project_analyze`.`analyze_id` = `tx_nG6_analyze`.`uid`)));
--
-- Structure de la vue `tx_nG6_view_project_run`
--
CREATE ALGORITHM=UNDEFINED DEFINER=`typo3`@`localhost` SQL SECURITY DEFINER VIEW `tx_nG6_view_project_run` AS select `tx_nG6_project`.`uid` AS `project_id`,`tx_nG6_project`.`name` AS `project_name`,`tx_nG6_run`.`uid` AS `run_id`,`tx_nG6_run`.`storage_size` AS `storage_size`,`tx_nG6_run`.`purged_size` AS `purged_size`,`tx_nG6_run`.`data_state` AS `state`,`tx_nG6_run`.`retention_date` AS `retention_date`,`tx_nG6_run`.`purge_demand_id` AS `purge_demand_id` from ((`tx_nG6_run` join `tx_nG6_project_run` on((`tx_nG6_project_run`.`run_id` = `tx_nG6_run`.`uid`))) join `tx_nG6_project` on((`tx_nG6_project`.`uid` = `tx_nG6_project_run`.`project_id`)));
CREATE ALGORITHM=UNDEFINED DEFINER=`typo3`@`localhost` SQL SECURITY DEFINER VIEW `tx_nG6_view_project_run` AS select `tx_nG6_project`.`uid` AS `project_id`,`tx_nG6_project`.`name` AS `project_name`,`tx_nG6_run`.`uid` AS `run_id`,`tx_nG6_run`.`storage_size` AS `storage_size`,`tx_nG6_run`.`purged_size` AS `purged_size`,`tx_nG6_run`.`data_state` AS `state`,`tx_nG6_run`.`retention_date` AS `retention_date`,`tx_nG6_run`.`purge_demand_id` AS `purge_demand_id`, `tx_nG6_run`.`hidden` AS `hidden` from ((`tx_nG6_run` join `tx_nG6_project_run` on((`tx_nG6_project_run`.`run_id` = `tx_nG6_run`.`uid`))) join `tx_nG6_project` on((`tx_nG6_project`.`uid` = `tx_nG6_project_run`.`project_id`)));
--
-- Structure de la vue `tx_nG6_view_project_run_analyze`
--
CREATE ALGORITHM=UNDEFINED DEFINER=`typo3`@`localhost` SQL SECURITY DEFINER VIEW `tx_nG6_view_project_run_analyze` AS select `tx_nG6_project`.`uid` AS `project_id`,`tx_nG6_project`.`name` AS `project_name`,`tx_nG6_analyze`.`uid` AS `analyze_id`,`tx_nG6_analyze`.`storage_size` AS `storage_size`,`tx_nG6_analyze`.`purged_size` AS `purged_size`,`tx_nG6_analyze`.`data_state` AS `state`,`tx_nG6_analyze`.`retention_date` AS `retention_date`,`tx_nG6_analyze`.`purge_demand_id` AS `purge_demand_id` from ((((`tx_nG6_run` join `tx_nG6_project_run` on((`tx_nG6_project_run`.`run_id` = `tx_nG6_run`.`uid`))) join `tx_nG6_project` on((`tx_nG6_project`.`uid` = `tx_nG6_project_run`.`project_id`))) join `tx_nG6_run_analyze` on((`tx_nG6_run_analyze`.`run_id` = `tx_nG6_run`.`uid`))) join `tx_nG6_analyze` on((`tx_nG6_run_analyze`.`analyze_id` = `tx_nG6_analyze`.`uid`)));
CREATE ALGORITHM=UNDEFINED DEFINER=`typo3`@`localhost` SQL SECURITY DEFINER VIEW `tx_nG6_view_project_run_analyze` AS select `tx_nG6_project`.`uid` AS `project_id`,`tx_nG6_project`.`name` AS `project_name`,`tx_nG6_analyze`.`uid` AS `analyze_id`,`tx_nG6_analyze`.`storage_size` AS `storage_size`,`tx_nG6_analyze`.`purged_size` AS `purged_size`,`tx_nG6_analyze`.`data_state` AS `state`,`tx_nG6_analyze`.`retention_date` AS `retention_date`,`tx_nG6_analyze`.`purge_demand_id` AS `purge_demand_id`, `tx_nG6_analyze`.`hidden` AS `hidden` from ((((`tx_nG6_run` join `tx_nG6_project_run` on((`tx_nG6_project_run`.`run_id` = `tx_nG6_run`.`uid`))) join `tx_nG6_project` on((`tx_nG6_project`.`uid` = `tx_nG6_project_run`.`project_id`))) join `tx_nG6_run_analyze` on((`tx_nG6_run_analyze`.`run_id` = `tx_nG6_run`.`uid`))) join `tx_nG6_analyze` on((`tx_nG6_run_analyze`.`analyze_id` = `tx_nG6_analyze`.`uid`)));
--
-- Structure de la vue `tx_nG6_view_project_user`
......
......@@ -196,7 +196,7 @@ class tx_nG6_db {
return (tx_nG6_db::select_list_retention_data_info($where));
}
static function select_a_project_retention_data_info($project_id=null, $all=FALSE) {
static function select_a_project_retention_data_info($project_id=null, $all=FALSE, $count_hidden=FALSE) {
$condition=Array();
if ($all === FALSE) {
$condition[]='DATEDIFF( FROM_UNIXTIME( retention_date ) , now( ) ) <0';
......@@ -204,6 +204,9 @@ class tx_nG6_db {
if (null != $project_id) {
$condition[]="project_id = " . $project_id ;
}
if(!$count_hidden){
$condition[]="hidden = 0";
}
$where = join( ' AND ', $condition);
return(tx_nG6_db::select_list_retention_data_info($where));
}
......@@ -242,6 +245,7 @@ class tx_nG6_db {
$by_project[$current_project_id]['total_purgeable_size'] += $res_row['storage_size'];
}
}
//select obsolete analyses of a run
$res = tx_nG6_db::select_all_in_view("tx_nG6_view_project_run_analyze",$where,'10');
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
......@@ -251,16 +255,16 @@ class tx_nG6_db {
$by_project[$current_project_id]['project_name']= $res_row['project_name'];
}
if ($res_row['analyze_id'] != ""){
$by_project[$current_project_id]['state'][$res_row['state']]['nb_analyze'] += 1;
$key = 'storage_size';
if($res_row['state'] == "purged"){
$key = "purged_size";
}
$by_project[$current_project_id]['state'][$res_row['state']]['size_analyze'] += $res_row[$key];
$by_project[$current_project_id]['state'][$res_row['state']]['analysis_ids'][]=$res_row['analyze_id'];
$by_project[$current_project_id]['total_purgeable_size'] += $res_row['storage_size'];
$by_project[$current_project_id]['state'][$res_row['state']]['nb_analyze'] += 1;
$key = 'storage_size';
if($res_row['state'] == "purged"){
$key = "purged_size";
}
$by_project[$current_project_id]['state'][$res_row['state']]['size_analyze'] += $res_row[$key];
$by_project[$current_project_id]['state'][$res_row['state']]['analysis_ids'][]=$res_row['analyze_id'];
$by_project[$current_project_id]['total_purgeable_size'] += $res_row['storage_size'];
}
}
}
//select obsolete analyses of a project
$res = tx_nG6_db::select_all_in_view("tx_nG6_view_project_analyze", $where);
......@@ -284,21 +288,21 @@ class tx_nG6_db {
}
}
$res = tx_nG6_db::select_count_in_view("tx_nG6_view_project_run","");
$res = tx_nG6_db::select_count_in_view("tx_nG6_view_project_run",$where);
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
if (isset ($by_project[$res_row['project_id']])) {
$by_project[$res_row['project_id']]["nb_runs"]=$res_row['count'];
}
}
$res = tx_nG6_db::select_count_in_view("tx_nG6_view_project_run_analyze","");
$res = tx_nG6_db::select_count_in_view("tx_nG6_view_project_run_analyze",$where);
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
if (isset ($by_project[$res_row['project_id']])) {
$by_project[$res_row['project_id']]["nb_analyses"]=$res_row['count'];
}
}
$res = tx_nG6_db::select_count_in_view("tx_nG6_view_project_analyze","");
$res = tx_nG6_db::select_count_in_view("tx_nG6_view_project_analyze",$where);
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
if (isset ($by_project[$res_row['project_id']])) {
if (!isset ($by_project[$res_row['project_id']]["nb_analyses"])) {
......
......@@ -213,7 +213,13 @@ class tx_nG6_pi1 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
}
$smarty->assign('h_analysis', tx_nG6_utils::trace_hierarchy($project_analysis));
$smarty->assign('project_analysis', $project_analysis);
$smarty->assign('managment_purged_data', tx_nG6_db::select_a_project_retention_data_info($projects[key($projects)]['id'], TRUE));
if( $projects[$project_id]['is_admin'] == 1 ){
$smarty->assign('managment_purged_data', tx_nG6_db::select_a_project_retention_data_info($projects[key($projects)]['id'], TRUE, TRUE));
}else{
$smarty->assign('managment_purged_data', tx_nG6_db::select_a_project_retention_data_info($projects[key($projects)]['id'], TRUE, FALSE));
}
$txNG6Utils = new tx_nG6_utils;
//$smarty->register_object('tx_nG6_utils',$txNG6Utils);
$smarty->assign_by_ref('tx_nG6_utils', $txNG6Utils);
......
......@@ -107,7 +107,7 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
foreach(explode(",", $project_ids) as $project_id){
#retrieve project data
$p=tx_nG6_db::select_a_project_retention_data_info($project_id);
$p=tx_nG6_db::select_a_project_retention_data_info($project_id, FALSE, TRUE);
#build email list of managers
$users_id=array();
......
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