*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/**
* \file htdocs/admin/system/perf.php
* \brief Page to show Performance information
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$langs->load("admin");
$langs->load("install");
$langs->load("other");
if (! $user->admin)
accessforbidden();
if (GETPOST('action') == 'donothing')
{
exit;
}
/*
* View
*/
$form=new Form($db);
$nowstring=dol_print_date(dol_now(),'dayhourlog');
llxHeader();
print_fiche_titre($langs->trans("PerfDolibarr"),'','title_setup');
print $langs->trans("YouMayFindPerfAdviceHere",'http://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').' ('.$langs->trans("Reload").')
';
// Recupere la version de PHP
$phpversion=version_php();
print "
PHP - ".$langs->trans("Version").": ".$phpversion."
\n";
// Recupere la version du serveur web
print "
Web server - ".$langs->trans("Version").": ".$_SERVER["SERVER_SOFTWARE"]."
\n";
// XDebug
print '
';
print ''.$langs->trans("XDebug").': ';
$test=!function_exists('xdebug_is_enabled');
if ($test) print img_picto('','tick.png').' '.$langs->trans("NotInstalled");
else
{
print img_picto('','warning').' '.$langs->trans("XDebugInstalled");
print ' '.$langs->trans("MoreInformation").' XDebug admin page';
}
print '
';
// Applicative cache
print '
';
print ''.$langs->trans("ApplicativeCache").': ';
$test=!empty($conf->memcached->enabled);
if ($test)
{
if (!empty($conf->global->MEMCACHED_SERVER))
{
print img_picto('','tick.png').' '.$langs->trans("MemcachedAvailableAndSetup");
print ' '.$langs->trans("MoreInformation").' Memcached module admin page';
}
else
{
print img_picto('','warning').' '.$langs->trans("MemcachedModuleAvailableButNotSetup");
print ' Memcached module admin page';
}
}
else print img_picto('','warning').' '.$langs->trans("MemcachedNotAvailable");
print '';
// OPCode cache
print '
';
print ''.$langs->trans("OPCodeCache").': ';
$foundcache=0;
$test=function_exists('xcache_info');
if (! $foundcache && $test)
{
$foundcache++;
print img_picto('','tick.png').' '.$langs->trans("XCacheInstalled");
print ' '.$langs->trans("MoreInformation").' Xcache admin page';
}
$test=function_exists('eaccelerator_info');
if (! $foundcache && $test)
{
$foundcache++;
print img_picto('','tick.png').' '.$langs->trans("EAcceleratorInstalled");
}
$test=function_exists('apc_cache_info');
if (! $foundcache && $test)
{
//var_dump(apc_cache_info());
if (ini_get('apc.enabled'))
{
$foundcache++;
print img_picto('','tick.png').' '.$langs->trans("APCInstalled");
}
else
{
print img_picto('','warning').' '.$langs->trans("APCCacheInstalledButDisabled");
}
}
if (! $foundcache) print $langs->trans("NoOPCodeCacheFound");
print '
';
// HTTPCacheStaticResources
print '';
print '
';
print ''.$langs->trans("HTTPCacheStaticResources").' - ';
print $langs->trans("CacheByServer").':
';
// No cahce on PHP
//print '
'.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCompressed",'php (.php)').'
';
//print ''.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeNotCached",'php (.php)').'
';
// Cache on rest
print ''.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCached",'css (.css)').'
';
print ''.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCached",'css (.css)').'
';
print ''.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCached",'css (.css.php)').'
';
print ''.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCached",'css (.css.php)').'
';
print ''.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCached",'img (.png)').'
';
print ''.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCached",'img (.png)').'
';
print ''.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCached",'javascript (.js)').'
';
print ''.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCached",'javascript (.js)').'
';
print ''.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCached",'javascript (.js.php)').'
';
print ''.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCached",'javascript (.js.php)').'
';
print '
';
print ''.$langs->trans("HTTPCacheStaticResources").' - ';
print $langs->trans("CacheByClient").':
';
print $langs->trans("TestNotPossibleWithCurrentBrowsers").'
';
// Compressions
print '
';
print ''.$langs->trans("CompressionOfResources").': ';
//$tmp=getURLContent(DOL_URL_ROOT.'/index.php','GET');var_dump($tmp);
print '
';
// on PHP
print ''.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCompressed",'php (.php)').'
';
print ''.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCompressed",'php (.php)').'
';
// on rest
print ''.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCompressed",'css (.css)').'
';
print ''.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCompressed",'css (.css)').'
';
print ''.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCompressed",'css (.css.php)').'
';
print ''.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCompressed",'css (.css.php)').'
';
//print ''.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCompressed",'img (.png)').'
';
//print ''.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCompressed",'img (.png)').'
';
print ''.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCompressed",'javascript (.js)').'
';
print ''.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCompressed",'javascript (.js)').'
';
print ''.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCompressed",'javascript (.js.php)').'
';
print ''.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCompressed",'javascript (.js.php)').'
';
// Database driver
print '
';
print ''.$langs->trans("DriverType").': ';
print '
';
if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli')
{
$test=($conf->db->type == 'mysqli');
if ($test)
{
print img_picto('','tick.png').' '.$langs->trans("YouUseBestDriver",$conf->db->type);
}
else
{
print img_picto('','warning.png').' '.$langs->trans("YouDoNotUseBestDriver",$conf->db->type,'mysqli');
}
print '
';
}
// Product search
print '
';
print ''.$langs->trans("SearchOptim").': ';
print '
';
$tab = array();
$sql = "SELECT COUNT(*) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$resql=$db->query($sql);
if ($resql)
{
$limitforoptim=10000;
$num=$db->num_rows($resql);
$obj=$db->fetch_object($resql);
$nb=$obj->nb;
if ($nb > $limitforoptim)
{
if (empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE))
{
print img_picto('','warning.png').' '.$langs->trans("YouHaveXProductUseSearchOptim",$nb);
}
else
{
print img_picto('','tick.png').' '.$langs->trans("YouHaveXProductAndSearchOptimOn",$nb);
}
}
else
{
print img_picto('','tick.png').' '.$langs->trans("NbOfProductIsLowerThanNoPb",$nb);
}
print '
';
$db->free($resql);
}
// Browser
print '
';
print ''.$langs->trans("Browser").':
';
if (! in_array($conf->browser->name, array('chrome','opera','safari','firefox')))
{
print img_picto('','warning.png').' '.$langs->trans("BrowserIsKO",$conf->browser->name);
}
else
{
print img_picto('','tick.png').' '.$langs->trans("BrowserIsOK",$conf->browser->name);
}
print '
';
// Database statistics update
/*
print '
';
print ''.$langs->trans("DatabaseStatistics").': ';
print '
';
*/
llxFooter();
$db->close();