diff --git a/.gitattributes b/.gitattributes index 30f5fcb9e30d9b74293bd6abfc08a17306a8e49e..4a6b0863975271d1562444de9e11d468f0a0f4bf 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4923,6 +4923,7 @@ scripts/opac3.el -text scripts/org-link-minor-mode.el -text scripts/split_unimarc.php -text scripts/svn-export.sh -text +scripts/test_performance_recherche.php -text scripts/top_10_slow_request.sh -text tests/.htaccess -text tests/TestXPathFactory.php -text diff --git a/scripts/test_performance_recherche.php b/scripts/test_performance_recherche.php new file mode 100644 index 0000000000000000000000000000000000000000..2c6a8a50f9250cf385ec894055455a31f167c1cd --- /dev/null +++ b/scripts/test_performance_recherche.php @@ -0,0 +1,66 @@ +<?php + +function old_recherche($expression_recherchee){ +$cookie_file = "/tmp/cookie/cookie_1.txt"; +$url_old_recherche = "http://web.afi-sa.net/pergame-enligne.net/recherche/simple"; +$url_new_recherche = "http://web.afi-sa.net/opacce.pergame.net/recherche/simple/expressionRecherche/"; +$post_fields=array('expressionRecherche'=>urlencode($expression_recherchee)); +//"expressionRecherche=$expression_recherchee"; +//$item_recherche; + +// OLD recherche Step1 fill cookie + $curl_old_step_1 = curl_init($url_old_recherche); + + curl_setopt($curl_old_step_1,CURLOPT_COOKIESESSION, true); + curl_setopt($curl_old_step_1,CURLOPT_COOKIEJAR, $cookie_file); + curl_setopt ($curl_old_step_1, CURLOPT_RETURNTRANSFER, true); + curl_setopt($curl_old_step_1,CURLOPT_COOKIEFILE, $cookie_file); + curl_setopt($curl_old_step_1,CURLOPT_POSTFIELDS, $post_fields); + + $result_old_step_1 = curl_exec($curl_old_step_1); + $temps_step_1 = curl_getinfo($curl_old_step_1,CURLINFO_TOTAL_TIME ); + echo($temps_step_1); + +// OLD recherche Step2 recherche/simple avec cookie + + $curl_old_step_2 = curl_init($url_old_recherche); + curl_setopt($curl_old_step_2,CURLOPT_COOKIEJAR, $cookie_file); + + $result_old_step_2 = curl_exec($curl_old_step_2); + $temps_step_2 = curl_getinfo($curl_old_step_2,CURLINFO_TOTAL_TIME ); + echo '<br/>'; + echo($temps_step_1); + echo '<br/>'; + echo($temps_step_2); + echo '<br/>'; + $total_time = $temps_step_1 + $temps_step_2; + echo($total_time); + +} + +// main + +$array_item_a_rechercher = [ + 'Millenium', + 'auteur', + 'France', + 'Livre', + 'loisirs', + 'sports', + 'jardin', + 'informatique', + 'univers', + 'bouteille', + 'eau', + 'telephone', + 'Mac', + 'Hercule', + 'Emacs', + 'Ordinateur', + 'son', + 'Millenium']; + + +old_recherche('Millenium'); + +?> \ No newline at end of file