New: Optimisation. Ajout de la durée de génération de la page si la variable environnement serveur DOL_TUNING est positionnée.

This commit is contained in:
Laurent Destailleur 2005-11-01 15:58:51 +00:00
parent 2e3d082698
commit 5cb69e6096
3 changed files with 147 additions and 129 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com> * Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -20,7 +20,6 @@
* *
* $Id$ * $Id$
* $Source$ * $Source$
*
*/ */
/** /**
@ -32,9 +31,11 @@
require_once("main.inc.php"); require_once("main.inc.php");
// C'est un wrapper, donc header vierge // C'est un wrapper, donc header vierge
function llxHeader() { } function llxHeader() { }
$original_file = urldecode($_GET["file"]); $original_file = urldecode($_GET["file"]);
$modulepart = urldecode($_GET["modulepart"]); $modulepart = urldecode($_GET["modulepart"]);
$type = urldecode($_GET["type"]); $type = urldecode($_GET["type"]);
@ -45,7 +46,7 @@ $original_file = str_replace("../","/", "$original_file");
$accessallowed=0; $accessallowed=0;
if ($modulepart) if ($modulepart)
{ {
// On fait une vérification des droits et on définit le répertoire concerné // On fait une vérification des droits et on définit le répertoire concern
// Wrapping pour les factures // Wrapping pour les factures
if ($modulepart == 'facture') if ($modulepart == 'facture')
@ -177,6 +178,10 @@ if (! $accessallowed)
accessforbidden(); accessforbidden();
} }
// Ouvre et renvoi fichier
clearstatcache();
$filename = basename($original_file); $filename = basename($original_file);
if (! file_exists($original_file)) if (! file_exists($original_file))

View File

@ -29,6 +29,10 @@
\version $Revision$ \version $Revision$
*/ */
// Pour le tuning optionnel. Activer si la variable d'environnement DOL_TUNING
// est positionnée. A appeler avant tout.
if (isset($_SERVER['DOL_TUNING'])) $micro_start_time=microtime(true);
require_once("master.inc.php"); require_once("master.inc.php");
@ -477,12 +481,18 @@ function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch='search',$
function llxFooter($foot='') function llxFooter($foot='')
{ {
global $dolibarr_auto_user; global $dolibarr_auto_user, $micro_start_time;
print "\n</div>\n".'<!-- end div class="fiche" -->'."\n"; print "\n</div>\n".'<!-- end div class="fiche" -->'."\n";
print "\n</div>\n".'<!-- end div class="vmenuplusfiche" -->'; print "\n</div>\n".'<!-- end div class="vmenuplusfiche" -->';
print "\n</div>\n".'<!-- end div class="body" -->'."\n"; print "\n</div>\n".'<!-- end div class="body" -->'."\n";
if (isset($_SERVER['DOL_TUNING']))
{
print '<script language="javascript" type="text/javascript">window.status="Build time: '.ceil(1000*(microtime(true)-$micro_start_time)).' ms"</script>';
print "\n";
}
print "</body>\n</html>\n"; print "</body>\n</html>\n";
} }
?> ?>

View File

@ -33,9 +33,12 @@
define('DOL_VERSION','2.0.0-alpha2'); define('DOL_VERSION','2.0.0-alpha2');
// La fonction clearstatcache ne doit pas etre appelé de manière globale car ralenti
// fortement. Elle doit etre appelée uniquement par les pages qui ont besoin d'absence
// de cache, comme par exemple document.php
clearstatcache(); clearstatcache();
// Forcage du param?trage PHP error_reporting (Dolibarr non utilisable en mode error E_ALL) // Forcage du parametrage PHP error_reporting (Dolibarr non utilisable en mode error E_ALL)
if (function_exists("define_syslog_variables")) if (function_exists("define_syslog_variables"))
{ {
define_syslog_variables(); define_syslog_variables();