request('gDossier',"number", -1);
if ($gDossier==-1)
{
echo " Vous devez donner le dossier avec paramètre gDossier dans l'url, exemple http://localhost/noalyss/html/test.php?gDossier=25";
exit();
}
$gDossierLogInput=$gDossier;
global $cn, $g_user, $g_succeed, $g_failed;
$cn=Dossier::connect();
$g_parameter=new Noalyss_Parameter_Folder($cn);
$g_user=new Noalyss_user($cn);
if (!file_exists('authorized_debug'))
{
echo "Pour pouvoir utiliser ce fichier vous devez creer un fichier nomme authorized_debug
dans le repertoire html du server";
exit();
}
define('ALLOWED', 1);
load_all_script();
// To enable assert , set "zend.assertions" in the php.ini file
// deprecated PHP8.3
//ini_set("assert.active",1);
//assert_options(ASSERT_ACTIVE, 1);
//assert_options(ASSERT_WARNING, 1);
//removed in PHP8 assert_options(ASSERT_QUIET_EVAL, 1);
//
//function my_assert_handler($file, $line, $code)
//{
// echo "
Assert Failed :
// File '$file'
// Line '$line'
// Code '$code'
";
//}
//assert_options(ASSERT_CALLBACK, 'my_assert_handler');
/******************************************************************************************************************/
/* Utilities
/******************************************************************************************************************/
/**
* Return the card this most activities
* @return integer (fiche.f_id)
*/
function get_card_with_activity() {
global $cn;
$card_count=$cn->get_array("select count(*),f_id ".
" from jrnx ".
" where ".
" f_id is not null ".
"group by f_id order by count(*) desc");
return $card_count[0]['f_id'];
}
/*
* Loading of all scenario
*/
$scan=scandir('../scenario/');
$maxscan=count($scan);
$cnt_scenario=0;$scenario=array();
for ($e_scan=0; $e_scan<$maxscan; $e_scan++)
{
if (is_file('../scenario/'.$scan[$e_scan])&&strpos($scan[$e_scan], '.php')==true)
{
$description="";
$a_description=file('../scenario/'.$scan[$e_scan]);
$max_description=count($a_description);
for ($w=0; $w<$max_description; $w++)
{
if (strpos($a_description[$w], '@description:')==true)
{
$description=$a_description[$w];
$description=noalyss_str_replace('//@description:', '', $description);
}
}
$scenario[$cnt_scenario]['file']=$scan[$e_scan];
$scenario[$cnt_scenario]['desc']=$description;
$cnt_scenario++;
}
}
$script=$http->request('script', "string",'');
$min=$cn->get_value("select p_id from parm_periode order by p_start asc limit 1");
$max=$cn->get_value("select p_id from parm_periode order by p_start desc limit 1");
printf ("Max période %s Min période %s",$max,$min);
if ($script=="")
{
echo "Test NOALYSS
";
/*
* cherche pour fichier a include, s'il y en a alors les affiche
* avec une description
*/
echo '';
$get='test.php?'.http_build_query(array('script'=>"all", 'gDossier'=>$gDossierLogInput, 'description'=>"Tous les scripts"));
echo '';
echo '| ';
echo '';
echo "Tous ";
echo '';
echo ' | ';
echo 'Tous les scripts | ';
echo '
';
for ($e=0; $e<$cnt_scenario; $e++)
{
$get='test.php?'.http_build_query(array('script'=>$scenario[$e]['file'], 'gDossier'=>$gDossierLogInput, 'description'=>$scenario[$e]['desc']));
echo '';
echo '| ';
echo $e;
echo ' | ';
echo '';
echo '';
echo $scenario[$e]['file'];
echo '';
echo ' | ';
echo ''.$scenario[$e]['desc'].' | ';
echo '
';
}
echo '
';
}
else if ($script=='all')
{
$nb=$http->get('nb_script', "number",0);
$start_mem=memory_get_usage();
$start_time=microtime(true);
$script=noalyss_str_replace('../', '', $script);
echo ''.$nb." ".$scenario[$nb]['file']."
";
echo ' description = '.$scenario[$nb]["desc"].'
';
include '../scenario/'.$scenario[$nb]['file'];
echo '';
echo '';
$end_mem=memory_get_usage();
$end_time=microtime(true);
echo "start mem : ".$start_mem;
echo '
';
echo "end mem : ".$end_mem;
echo '
';
echo "Diff = ".($end_mem-$start_mem)." bytes ";
echo "
Diff = ".(round(($end_mem-$start_mem)/1024, 2))." kbytes ";
echo "
Diff = ".(round(($end_mem-$start_mem)/1024/1024, 2))." Mbytes ";
echo '
';
echo "Execution script ".$script." time = ".(round(($end_time-$start_time), 4))." secondes
";
$nb++;
if ( $nb == $maxscan ) {
echo "Dernier test";
} else {
$get='test.php?'.http_build_query(array('script'=>"all", 'gDossier'=>$gDossierLogInput, 'nb_script'=>$nb));
echo '';
echo $scenario[$nb]['file'];
}
}
else
{
$start_mem=memory_get_usage();
$start_time=microtime(true);
$script=noalyss_str_replace('../', '', $script);
$description=$http->get("description","string", "aucune description");
echo ''.$script."
";
echo ' description = '.$description.'
';
include '../scenario/'.$script;
$end_mem=memory_get_usage();
$end_time=microtime(true);
echo "
start mem : ".$start_mem;
echo '
';
echo "end mem : ".$end_mem;
echo '
';
echo "Diff = ".($end_mem-$start_mem)." bytes ";
echo "
Diff = ".(round(($end_mem-$start_mem)/1024, 2))." kbytes ";
echo "
Diff = ".(round(($end_mem-$start_mem)/1024/1024, 2))." Mbytes ";
echo '
';
echo "Execution script ".$script." time = ".(round(($end_time-$start_time), 4))." secondes
";
}