HomeHelpTrac

Changeset 15296


Ignore:
Timestamp:
06/30/11 01:36:15 (11 months ago)
Author:
Alexander Trofimov
Message:

Ticket #2552

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/administration/host_tools.php

    r15211 r15296  
    1212} 
    1313 
    14 bx_import('BxDolAdminTools'); 
     14bx_import('BxDolStudioTools'); 
    1515 
    1616$logged['admin'] = member_auth( 1, true, true ); 
    1717 
    18 $oAdmTools = new BxDolAdminTools(); 
     18$oAdmTools = new BxDolStudioTools(); 
    1919$sResult = $oAdmTools->GenCommonCode(); 
    2020 
    2121switch(bx_get('action')) { 
     22    case 'audit_send_test_email': 
     23        header('Content-type: text/html; charset=utf-8'); 
     24        echo $oAdmTools->sendTestEmail(); 
     25        exit; 
    2226    case 'cache_engines': 
    2327        $sResult .= $oAdmTools->GenCacheEnginesTable(); 
     
    2529    case 'perm_table': 
    2630        $sResult .= $oAdmTools->GenPermTable(); 
    27         break; 
    28     case 'main_params': 
    29         $sResult .= $oAdmTools->GenMainParamsTable(); 
    3031        break; 
    3132    case 'main_page': 
  • trunk/install/langs/lang-en.php

    r15293 r15296  
    25512551    '_adm_admtools_Non_Executable' => 'Non-Executable', 
    25522552    '_adm_admtools_Permissions' => 'Permissions', 
    2553     '_adm_admtools_Host_Params' => 'Host Params', 
    2554     '_adm_admtools_Name' => 'Name', 
    2555     '_adm_admtools_Value' => 'Value', 
    2556     '_adm_admtools_Recommended' => 'Recommended', 
    2557     '_adm_admtools_Different_settings' => 'Different settings', 
    2558     '_adm_admtools_Installed_apache_modules' => 'Installed apache modules', 
    25592553    '_sys_invitation_no_users_selected' => 'Please check at least one user or write at least one email', 
    25602554    '_sys_invitation_step_select_users' => 'Select Users', 
     
    27792773    '_sys_adm_installed' => 'Installed', 
    27802774    '_sys_adm_available' => 'Available', 
     2775    '_adm_admtools_Audit' => 'Audit', 
    27812776); 
    27822777?> 
  • trunk/studio/classes/BxDolStudioTools.php

    r15293 r15296  
    454454    } 
    455455 
    456     function GenMainParamsTable() { 
    457         $sNameC = _t('_adm_admtools_Name'); 
    458         $sValueC = _t('_adm_admtools_Value'); 
    459         $sRecommendedC = _t('_adm_admtools_Recommended'); 
    460         $sDifferentSettingsC = _t('_adm_admtools_Different_settings'); 
    461         $sInstalledApacheModulesC = _t('_adm_admtools_Installed_apache_modules'); 
    462  
    463         $sRegGlobal = ini_get('register_globals'); 
    464         $sRegGlobal = ($sRegGlobal==0) ? '<font color="green">Off</font>' : '<font color="red">On (warning, you should have this param in Off state, or your site will unsafe)</font>'; 
    465         $sSafeMode = ini_get('safe_mode'); 
    466         $sSafeMode = ($sSafeMode==0) ? '<font color="green">Off</font>' : '<font color="red">On (warning)</font>'; 
    467         $sDisabledFunc = ini_get('disable_functions'); 
    468         $sMemLimit = ini_get('memory_limit'); 
    469         $sMaxExecTime = ini_get('max_execution_time'); 
    470         $sPostMaxSize = ini_get('post_max_size'); 
    471         $sUploadMaxSize = ini_get('upload_max_filesize'); 
    472         $sAllowUrlFopen = ini_get('allow_url_fopen'); 
    473         $sAllowUrlFopen = ($sAllowUrlFopen==0) ? 'Off (warning, better keep this parameter in On to able register Dolphin' : '<font color="green">On</font>'; 
    474  
    475         $sSQLClientInfo = mysql_get_client_info(); 
    476         $sPhpVersion = phpversion(); 
    477  
    478         $sMbstring = '<font color="green">mbstring extension installed</font>'; 
    479         //check mbstring 
    480         if( !extension_loaded( 'mbstring' ) ) { 
    481             $sMbstring = '<font color="red">mbstring extension not installed. <b>Warning!</b> Dolphin cannot work without <b>mbstring</b> extension.</font>'; 
    482         } 
    483  
    484         $sAllowUrlInclude = ($this->isAllowUrlInclude() == true) ? '<font color="red">On (warning, disable it, or your site will unsafe)</font>' : '<font color="green">Off</font>'; 
    485  
    486         $sInstalledModules = ''; 
    487         if (function_exists('apache_get_modules')) { 
    488             $aInstalledModules = apache_get_modules(); 
    489             ob_start(); 
    490             echoDbg($aInstalledModules); 
    491             $sInstalledModules = ob_get_contents(); 
    492             ob_end_clean(); 
    493         } else { 
    494             $sInstalledModules = 'Can`t evaluate installed modules'; 
    495         } 
    496  
    497         $sOperationSystem = @php_uname(); 
    498  
    499         $sFfmpeg = realpath(BX_DIRECTORY_PATH_ROOT . "flash/modules/global/app/ffmpeg.exe"); 
    500         $sFfmpegOutput  = `$sFfmpeg -version 2>&1`; 
    501  
    502         $sRet = <<<EOF 
    503 <table width="100%" cellspacing="1" cellpadding="0" class="install_table"> 
    504     <tr class="head troubled"> 
    505         <td>{$sNameC}</td> 
    506         <td class="left_aligned">{$sValueC}</td> 
    507         <td class="left_aligned">{$sRecommendedC}</td> 
    508     </tr> 
    509     <tr class="head troubled"> 
    510         <td colspan="3" style="text-align:center;">{$sDifferentSettingsC}</td> 
    511     </tr> 
    512     <tr class="head troubled"> 
    513         <td>register globals</td> 
    514         <td class="left_aligned">{$sRegGlobal}</td> 
    515         <td class="left_aligned">Off</td> 
    516     </tr> 
    517     <tr class="head troubled"> 
    518         <td>safe mode</td> 
    519         <td class="left_aligned">{$sSafeMode}</td> 
    520         <td class="left_aligned">Off</td> 
    521     </tr> 
    522     <tr class="head troubled"> 
    523         <td>disabled functions</td> 
    524         <td class="left_aligned">{$sDisabledFunc}</td> 
    525         <td class="left_aligned"></td> 
    526     </tr> 
    527     <tr class="head troubled"> 
    528         <td>memory limit</td> 
    529         <td class="left_aligned">{$sMemLimit}</td> 
    530         <td class="left_aligned">128M</td> 
    531     </tr> 
    532     <tr class="head troubled"> 
    533         <td>max execution time</td> 
    534         <td class="left_aligned">{$sMaxExecTime}</td> 
    535         <td class="left_aligned">300</td> 
    536     </tr> 
    537     <tr class="head troubled"> 
    538         <td>post_max_size</td> 
    539         <td class="left_aligned">{$sPostMaxSize}</td> 
    540         <td class="left_aligned">128M or more</td> 
    541     </tr> 
    542     <tr class="head troubled"> 
    543         <td>upload max filesize</td> 
    544         <td class="left_aligned">{$sUploadMaxSize}</td> 
    545         <td class="left_aligned">128M or more</td> 
    546     </tr> 
    547     <tr class="head troubled"> 
    548         <td>allow_url_fopen</td> 
    549         <td class="left_aligned">{$sAllowUrlFopen}</td> 
    550         <td class="left_aligned">On</td> 
    551     </tr> 
    552     <tr class="head troubled"> 
    553         <td>allow_url_include (for php > 5.2)</td> 
    554         <td class="left_aligned">{$sAllowUrlInclude}</td> 
    555         <td class="left_aligned">Off</td> 
    556     </tr> 
    557     <tr class="head troubled"> 
    558         <td>mbstring installation</td> 
    559         <td class="left_aligned">{$sMbstring}</td> 
    560         <td class="left_aligned">Installed</td> 
    561     </tr> 
    562     <tr class="head troubled"> 
    563         <td>PHP version</td> 
    564         <td class="left_aligned">{$sPhpVersion}</td> 
    565         <td class="left_aligned">4.4.0/5.1.0 and higher</td> 
    566     </tr> 
    567     <tr class="head troubled"> 
    568         <td>SQL Client library version</td> 
    569         <td class="left_aligned">{$sSQLClientInfo}</td> 
    570         <td class="left_aligned">4.1.2 and higher</td> 
    571     </tr> 
    572     <tr class="head troubled"> 
    573         <td>{$sInstalledApacheModulesC}</td> 
    574         <td class="left_aligned">{$sInstalledModules}</td> 
    575         <td class="left_aligned"></td> 
    576     </tr> 
    577     <tr class="head troubled"> 
    578         <td>Operating system</td> 
    579         <td class="left_aligned">{$sOperationSystem}</td> 
    580         <td class="left_aligned">Unix / Linux / Windows</td> 
    581     </tr> 
    582     <tr class="head troubled"> 
    583         <td colspan="3" style="text-align:center;">Flash ffmpeg settings</td> 
    584     </tr> 
    585     <tr class="head troubled"> 
    586         <td>ffmpeg output</td> 
    587         <td class="left_aligned">{$sFfmpegOutput}</td> 
    588         <td class="left_aligned"></td> 
    589     </tr> 
    590 </table> 
    591 EOF; 
    592         return $sRet; 
    593     } 
    594  
    595456    function GenTabbedPage() { 
    596457        $sTitleC = _t('_adm_admtools_title'); 
     458        $sAuditC = _t('_adm_admtools_Audit'); 
    597459        $sPermissionsC = _t('_adm_admtools_Permissions'); 
    598         $sHostParamsC = _t('_adm_admtools_Host_Params'); 
    599460        $sCacheEnginesC = _t('_adm_admtools_cache_engines'); 
    600461 
     462        $sAuditTab = $this->GenAuditPage(); 
    601463        $sPermissionsTab = $this->GenPermTable(); 
    602         $sSettingsTab = $this->GenMainParamsTable(); 
    603464        $sCacheEnginesTab = $this->GenCacheEnginesTable(); 
    604465 
     
    624485 
    625486<div class="boxContent" id="adm_pages"> 
     487    <div id="page0" class="visible">{$sAuditTab}</div> 
    626488    <div id="page1" class="visible">{$sPermissionsTab}</div> 
    627     <div id="page2" class="hidden">{$sSettingsTab}</div> 
    628489    <div id="page3" class="hidden"> 
    629490        <iframe frameborder="0" width="100%" height="800" scrolling="auto" src="host_tools.php?get_phpinfo=true"></iframe> 
     
    635496        $sActions = <<<EOF 
    636497<div class="dbTopMenu"> 
    637     <div class="active" id="main_menu1"><span><a href="#" class="top_members_menu" onclick="switchAdmPage(1); return false;">{$sPermissionsC}</a></span></div> 
    638     <div class="notActive" id="main_menu2"><span><a href="#" class="top_members_menu" onclick="switchAdmPage(2); return false;">{$sHostParamsC}</a></span></div> 
     498    <div class="active" id="main_menu0"><span><a href="#" class="top_members_menu" onclick="switchAdmPage(0); return false;">{$sAuditC}</a></span></div> 
    639499    <div class="notActive" id="main_menu3"><span><a href="#" class="top_members_menu" onclick="switchAdmPage(3); return false;">phpinfo</a></span></div> 
    640500    <div class="notActive" id="main_menu4"><span><a href="#" class="top_members_menu" onclick="switchAdmPage(4); return false;">{$sCacheEnginesC}</a></span></div> 
     
    684544    } 
    685545 
     546 
     547    function GenAuditPage() { 
     548 
     549        $sDolphinPath = BX_DIRECTORY_PATH_ROOT; 
     550 
     551        $sEmailToCkeckMailSending = getParam('site_email'); 
     552 
     553        $sLatestDolphinVer = file_get_contents("http://rss.boonex.com/"); 
     554        if (preg_match ('#<dolphin>([\.0-9]+)</dolphin>#', $sLatestDolphinVer, $m)) 
     555            $sLatestDolphinVer = $m[1]; 
     556        else 
     557            $sLatestDolphinVer = 'undefined'; 
     558 
     559        $sMinPhpVer = '5.2.0'; 
     560        $sMinMysqlVer = '4.1.2'; 
     561 
     562        $a = unserialize(file_get_contents("http://www.php.net/releases/index.php?serialize=1")); 
     563        $sLatestPhpVersion = $a[5]['version']; 
     564        $sLatestPhp52Version = '5.2.17'; 
     565 
     566        $aPhpSettings = array ( 
     567            'allow_url_fopen' => array('op' => '=', 'val' => true, 'type' => 'bool'), 
     568            'allow_url_include' => array('op' => '=', 'val' => false, 'type' => 'bool'), 
     569            'magic_quotes_gpc' => array('op' => '=', 'val' => false, 'type' => 'bool'), 
     570            'memory_limit' => array('op' => '>=', 'val' => 128*1024*1024, 'type' => 'bytes'), 
     571            'post_max_size' => array('op' => '>=', 'val' => 50*1024*1024, 'type' => 'bytes'), 
     572            'upload_max_filesize' => array('op' => '>=', 'val' => 50*1024*1024, 'type' => 'bytes'), 
     573            'register_globals' => array('op' => '=', 'val' => false, 'type' => 'bool'), 
     574            'safe_mode' => array('op' => '=', 'val' => false, 'type' => 'bool'), 
     575            'short_open_tag' => array('op' => '=', 'val' => true, 'type' => 'bool'), 
     576            'disable_functions' => array('op' => '=', 'val' => ''), 
     577            'php module: curl' => array('op' => 'module', 'val' => 'curl'), 
     578            'php module: gd' => array('op' => 'module', 'val' => 'gd'), 
     579            'php module: mbstring' => array('op' => 'module', 'val' => 'mbstring'), 
     580            'php module: xsl' => array('op' => 'module', 'val' => 'xsl'), 
     581        ); 
     582 
     583        $aMysqlSettings = array ( 
     584            'key_buffer_size' => array('op' => '>', 'val' => 128*1024, 'type' => 'bytes'), 
     585            'query_cache_limit' => array('op' => '>', 'val' => 1000000), 
     586            'query_cache_size' => array('op' => '>', 'val' => 16*1024*1024, 'type' => 'bytes'), 
     587            'query_cache_type' => array('op' => 'strcasecmp', 'val' => 'on'), 
     588            'max_heap_table_size' => array('op' => '>=', 'val' => 16*1024*1024, 'type' => 'bytes'), 
     589            'tmp_table_size' => array('op' => '>=', 'val' => 16*1024*1024, 'type' => 'bytes'), 
     590            'thread_cache_size ' => array('op' => '>', 'val' => 0), 
     591        ); 
     592 
     593        $aRequiredApacheModules = array ( 
     594            'rewrite_module' => 'mod_rewrite', 
     595        ); 
     596 
     597        $aDolphinOptimizationSettings = array ( 
     598 
     599            'DB cache' => array('enabled' => 'sys_db_cache_enable', 'cache_engine' => 'sys_db_cache_engine', 'check_accel' => true), 
     600 
     601            'Page blocks cache' => array('enabled' => 'sys_pb_cache_enable', 'cache_engine' => 'sys_pb_cache_engine', 'check_accel' => true), 
     602 
     603            'Member menu cache' => array('enabled' => 'always_on', 'cache_engine' => 'sys_mm_cache_engine', 'check_accel' => true), 
     604 
     605            'Templates Cache' => array('enabled' => 'sys_template_cache_enable', 'cache_engine' => 'sys_template_cache_engine', 'check_accel' => true), 
     606 
     607            'CSS files cache' => array('enabled' => 'sys_template_cache_css_enable', 'cache_engine' => '', 'check_accel' => false), 
     608 
     609            'JS files cache' => array('enabled' => 'sys_template_cache_js_enable', 'cache_engine' => '', 'check_accel' => false), 
     610 
     611            'Compression for CSS/JS cache' => array('enabled' => 'sys_template_cache_compress_enable', 'cache_engine' => '', 'check_accel' => false), 
     612        ); 
     613 
     614        ob_start(); 
     615?> 
     616<style> 
     617.ok { 
     618    color:green; 
    686619} 
    687  
     620.fail { 
     621    color:red; 
     622} 
     623.warn { 
     624    color:orange; 
     625} 
     626.undef { 
     627    color:gray; 
     628} 
     629.code { 
     630    border:1px solid #090; 
     631    color:#090; 
     632    padding:10px; 
     633    margin:10px; 
     634} 
     635</style> 
     636<h2>Software requirements</h2> 
     637<ul> 
     638    <li><b>PHP</b>:  
     639        <?php  
     640        $sPhpVer = PHP_VERSION; 
     641        echo $sPhpVer . ' - ';  
     642        if (version_compare($sPhpVer, $sMinPhpVer, '<')) 
     643            echo '<b class="fail">FAIL</b> (your version is incompatible with Dolphin, must be at least ' . $sMinPhpVer . ')'; 
     644        elseif (version_compare($sPhpVer, '5.3.0', '>=') && version_compare($sPhpVer, '6.0.0', '<') && !version_compare($sPhpVer, $sLatestPhpVersion, '>=')) 
     645            echo '<b class="warn">WARNING</b> (your PHP version is outdated, upgrade to the latest ' . $sLatestPhpVersion . ' maybe required)'; 
     646        elseif (version_compare($sPhpVer, '5.2.0', '>=') && version_compare($sPhpVer, '5.3.0', '<') && !version_compare($sPhpVer, $sLatestPhp52Version, '>=')) 
     647            echo '<b class="warn">WARNING</b> (your PHP version is outdated, upgrade to the latest ' . $sLatestPhp52Version . ' maybe required)'; 
     648        else 
     649            echo '<b class="ok">OK</b>'; 
     650         
     651        ?> 
     652        <ul> 
     653        <?php  
     654        foreach ($aPhpSettings as $sName => $r) { 
     655            $a = $this->checkPhpSetting($sName, $r); 
     656            echo "<li>$sName = " . $this->format_output($a['real_val'], $r) ." - " . ($a['res'] ? '<b class="ok">OK</b>' : "<b class='fail'>FAIL</b> (must be {$r['op']} " . $this->format_output($r['val'], $r) . ")") . "</li>\n"; 
     657        }  
     658        ?> 
     659        </ul> 
     660    </li> 
     661    <li><b>MySQL</b>:  
     662        <?php 
     663            $sMysqlVer = mysql_get_server_info($GLOBALS['bx_db_link']); 
     664            echo $sMysqlVer . ' - '; 
     665            if (preg_match ('/^(\d+)\.(\d+)\.(\d+)/', $sMysqlVer, $m)) { 
     666                $sMysqlVer = "{$m[1]}.{$m[2]}.{$m[3]}"; 
     667                if (version_compare($sMysqlVer, $sMinMysqlVer, '<')) 
     668                    echo '<b class="fail">FAIL</b> (your version is incompatible with Dolphin, must be at least ' . $sMinMysqlVer . ')'; 
     669                else 
     670                    echo '<b class="ok">OK</b>'; 
     671            } else { 
     672                echo '<b class="undef">UNDEFINED</b>'; 
     673            } 
     674        ?> 
     675    </li> 
     676    <li><b>Web-server</b>: 
     677        <?php 
     678            echo $_SERVER['SERVER_SOFTWARE']; 
     679        ?> 
     680        <ul> 
     681            <?php 
     682                foreach ($aRequiredApacheModules as $sName => $sNameCompiledName) 
     683                    echo '<li>' . $sName . ' - ' . $this->checkApacheModule($sName, $sNameCompiledName) . '</li>'; 
     684            ?>            
     685        </ul> 
     686    </li>  
     687    <li><b>OS</b>: 
     688        <?php 
     689            echo php_uname(); 
     690        ?> 
     691    </li>  
     692</ul> 
     693 
     694 
     695 
     696 
     697<h2>Hardware requirements</h2> 
     698<p> 
     699    Hardware requirements can not be determined automatically - <a href="#manual_audit">manual server audit</a> may be reqired. 
     700</p> 
     701 
     702 
     703<h2>Site setup</h2> 
     704<ul> 
     705    <li> 
     706        <b>Dolphin version</b> =  
     707        <?php             
     708            $sDolphinVer = $GLOBALS['site']['ver'] . '.' . $GLOBALS['site']['build']; 
     709            echo $sDolphinVer . ' - '; 
     710            if (!version_compare($sDolphinVer, $sLatestDolphinVer, '>=')) 
     711                echo '<b class="warn">WARNING</b> (your Dolphin version is outdated please upgrade to the latest ' . $sLatestDolphinVer . ' version)'; 
     712            else 
     713                echo '<b class="ok">OK</b>'; 
     714        ?> 
     715    </li> 
     716    <li> 
     717        <b>files and folders permissions</b> 
     718        <br /> 
     719        Please <a href="javascript:void(0);" onclick="switchAdmPage(1);">click here</a> to find out if dolphin permissions are correct. 
     720    </li> 
     721    <li> 
     722        <b>ffmpeg</b> 
     723        <pre class="code"><?php echo `{$sDolphinPath}flash/modules/global/app/ffmpeg.exe 2>&1`;?></pre> 
     724        if you don't know if output is correct then <a href="#manual_audit">manual server audit</a> may be reqired. 
     725    </li> 
     726    <li> 
     727        <script language="javascript"> 
     728            function bx_sys_adm_audit_test_email() { 
     729                $('#bx-sys-adm-audit-test-email').html('Sending...'); 
     730                $.post('<?php echo $GLOBALS['site']['url_admin']; ?>host_tools.php?action=audit_send_test_email', function(data) { 
     731                    $('#bx-sys-adm-audit-test-email').html(data); 
     732                }); 
     733            } 
     734        </script> 
     735        <b>mail sending - </b> 
     736        <span id="bx-sys-adm-audit-test-email"><a href="javascript:void(0);" onclick="bx_sys_adm_audit_test_email()">click here</a> to send test email to <?php echo $sEmailToCkeckMailSending; ?></span> 
     737    </li> 
     738    <li> 
     739        <b>cronjobs</b> 
     740        <pre class="code"><?php echo `crontab -l 2>&1`;?></pre> 
     741        if you are unsure if output is correct then <a href="#manual_audit">manual server audit</a> may be reqired. 
     742    </li> 
     743    <li> 
     744        <b>media server</b> 
     745        <br /> 
     746        Please follow <a href="<?php echo $GLOBALS['site']['url_admin']; ?>flash.php">this link</a> to check media server settings. Also you can try video chat - if video chat is working then most probably that flash media server is working correctly, however it doesn't guarantee that all other flash media server application will work. 
     747    </li> 
     748    <li> 
     749        <b>forums</b> 
     750        <br /> 
     751        Please follow <a href="<?php echo BX_DOL_URL_ROOT; ?>forum/">this link</a> to check if forum is functioning properly. If it is working but '[L[' signs are displayed everywhere, then you need to <a href="<?php echo BX_DOL_URL_ROOT; ?>forum/?action=goto&manage_forum=1">compile language file</a> (you maybe be need to compile language file separately for every language and template you have). 
     752    </li> 
     753</ul> 
     754 
     755 
     756 
     757 
     758<h2>Site optimization</h2> 
     759<ul> 
     760    <li><b>PHP</b>:  
     761        <ul> 
     762            <li><b>php accelerator</b> =  
     763            <?php 
     764                $sAccel = $this->getPhpAccelerator(); 
     765                if (!$sAccel) 
     766                    echo 'NO - <b class="warn">WARNING</b> (Dolphin can be much faster if you install some php accelator))'; 
     767                else 
     768                    echo $sAccel . ' - <b class="ok">OK</b>'; 
     769            ?> 
     770            </li> 
     771            <li><b>php setup</b> =  
     772            <?php 
     773                $sSapi = php_sapi_name(); 
     774                echo $sSapi . ' - '; 
     775                if (0 == strncasecmp('cgi', $sSapi, 3)) 
     776                    echo '<b class="warn">WARNING</b> (your PHP setup maybe very inefficient, <a href="?action=phpinfo">please check it for sure</a> and try to switch to mod_php, apache dso module or FastCGI)'; 
     777                else 
     778                    echo '<b class="ok">OK</b>'; 
     779            ?> 
     780            </li> 
     781        </ul> 
     782    </li> 
     783    <li><b>MySQL</b>:  
     784        <ul> 
     785            <?php                 
     786                foreach ($aMysqlSettings as $sName => $r) { 
     787                    $a = $this->checkMysqlSetting($sName, $r, $l); 
     788                    echo "<li><b>$sName</b> = " . $this->format_output($a['real_val'], $r) ." - " . ($a['res'] ? '<b class="ok">OK</b>' : "<b class='fail'>FAIL</b> (must be {$r['op']} " . $this->format_output($r['val'], $r) . ")") . "</li>\n"; 
     789                }  
     790            ?> 
     791        </ul> 
     792    </li> 
     793    <li><b>Web-server</b>:  
     794        <ul> 
     795            <li> 
     796                <b>User-side caching for static conten</b> =  
     797                <a href="<?php echo $this->getUrlForGooglePageSpeed('LeverageBrowserCaching'); ?>">click here to check it in Google Page Speed</a> 
     798                <br /> 
     799                If it is not enabled then please consider implement this optimization, since it improve perceived site speed and save the bandwidth, refer to <a target="_blank" href="http://www.boonex.com/trac/dolphin/wiki/HostingServerSetupRecommendations#Usersidecachingforstaticcontent">this tutorial</a> on how to do this. 
     800                <br /> 
     801                <?php 
     802                    $sName = 'expires_module'; 
     803                    echo 'To apply this optimization you need to have <b>' . $sName . '</b> Apache module - ' . $this->checkApacheModule($sName); 
     804                ?>  
     805            </li> 
     806            <li> 
     807                <b>Server-size content compression</b> = can be checked <a href="#manual_audit">manually</a> or in "Page Speed" tool build-in into browser. 
     808                <br /> 
     809                If it is not enabled then please consider implement this optimization, since it improve perceived site speed and save the bandwidth, refer to <a href="http://www.boonex.com/trac/dolphin/wiki/HostingServerSetupRecommendations#Serversidecontentcompression">this tutorial</a> on how to do this. 
     810                </textarea> 
     811                <br /> 
     812                <?php 
     813                    $sName = 'deflate_module';                 
     814                    echo 'To apply this optimization you need to have <b>' . $sName . '</b> Apache module - ' . $this->checkApacheModule($sName); 
     815                ?>  
     816            </li> 
     817        </ul> 
     818    </li> 
     819    <li><b>Dolphin</b>:  
     820        <ul> 
     821            <?php 
     822                 
     823                foreach ($aDolphinOptimizationSettings as $sName => $a) { 
     824 
     825                    echo "<li><b>$sName</b> = "; 
     826 
     827                    echo ('always_on' == $a['enabled'] || getParam($a['enabled'])) ? 'On' : 'Off'; 
     828 
     829                    if ($a['cache_engine']) 
     830                        echo " (" . getParam($a['cache_engine']) . ' based cache engine)';  
     831 
     832                    echo ' - '; 
     833 
     834                    if ('always_on' != $a['enabled'] && !getParam($a['enabled'])) 
     835                        echo '<b class="fail">FAIL</b> (please enable this cache in Dolphin Admin Panel -> Settings -> Advanced Settings)'; 
     836                    elseif ($a['check_accel'] && !$this->getPhpAccelerator() && 'File' == getParam($a['cache_engine'])) 
     837                        echo '<b class="warn">WARNING</b> (installing php accelerator will speed-up file cache)'; 
     838                    else 
     839                        echo '<b class="ok">OK</b>'; 
     840                     
     841                    echo "</li>\n"; 
     842                } 
     843 
     844            ?> 
     845        </ul> 
     846    </li> 
     847</ul> 
     848 
     849<a name="manual_audit"></a> 
     850<h2>Manual Server Audit</h2> 
     851<p> 
     852    Some things can not be determined automatically, manual server audit is required to check it. If you don't know how to do it by yourself you can submit <a target="_blank" href="http://www.boonex.com/help/tickets">BoonEx Server Audit Request</a>. Also if you are owner of <a target="_blank" href="http://www.boonex.com/enterprise">Enterprise package</a> - you have 1 free Server Audit Request. 
     853</p> 
     854 
     855<?php 
     856 
     857        return ob_get_clean(); 
     858    } 
     859 
     860    function checkPhpSetting($sName, $a) { 
     861 
     862        $mixedVal = ini_get($sName); 
     863        $mixedVal = $this->format_input ($mixedVal, $a); 
     864 
     865        switch ($a['op']) { 
     866            case 'module': 
     867                $bResult = extension_loaded($a['val']); 
     868                $mixedVal = $bResult ? $a['val'] : ''; 
     869                break; 
     870            case '>': 
     871                $bResult = ($mixedVal > $a['val']); 
     872                break; 
     873            case '>=': 
     874                $bResult = ($mixedVal >= $a['val']); 
     875                break; 
     876            case '=': 
     877            default: 
     878                $bResult = ($mixedVal == $a['val']); 
     879        } 
     880        return array ('res' => $bResult, 'real_val' => $mixedVal); 
     881    } 
     882 
     883    function checkMysqlSetting($sName, $a, $l) {     
     884 
     885        $mixedVal = $this->mysqlGetOption($sName, $l); 
     886        $mixedVal = $this->format_input ($mixedVal, $a); 
     887 
     888        switch ($a['op']) { 
     889            case '>': 
     890                $bResult = ($mixedVal > $a['val']); 
     891                break; 
     892            case '>=': 
     893                $bResult = ($mixedVal >= $a['val']); 
     894                break; 
     895            case 'strcasecmp': 
     896                $bResult = 0 == strcasecmp($mixedVal, $a['val']); 
     897                break; 
     898            case '=': 
     899            default: 
     900                $bResult = ($mixedVal == $a['val']); 
     901        } 
     902        return array ('res' => $bResult, 'real_val' => $mixedVal); 
     903    } 
     904 
     905    function format_output ($mixedVal, $a) { 
     906        switch ($a['type']) { 
     907            case 'bool': 
     908                return $mixedVal ? 'On' : 'Off'; 
     909            default: 
     910                return $mixedVal; 
     911        } 
     912    } 
     913 
     914    function format_input ($mixedVal, $a) { 
     915        switch ($a['type']) { 
     916            case 'bytes': 
     917                return $this->format_bytes ($mixedVal); 
     918            default: 
     919                return $mixedVal; 
     920        } 
     921    } 
     922 
     923    function format_bytes($val) { 
     924        return return_bytes($val); 
     925    } 
     926 
     927    function checkApacheModule ($sModule, $sNameCompiledName = '') { 
     928        $a = array ( 
     929            'deflate_module' => 'mod_deflate', 
     930            'expires_module' => 'mod_expires', 
     931        ); 
     932        if (!$sNameCompiledName && isset($a[$sModule])) 
     933            $sNameCompiledName = $a[$sModule]; 
     934 
     935        if (function_exists('apache_get_modules')) { 
     936 
     937            $aModules = apache_get_modules(); 
     938            $ret = in_array($sNameCompiledName, $aModules); 
     939 
     940        } else { 
     941 
     942            $sApachectlPath = trim(`which apachectl`);  
     943            if (!$sApachectlPath) 
     944                $sApachectlPath = trim(`which apache2ctl`);  
     945            if (!$sApachectlPath) 
     946                $sApachectlPath = trim(`which /usr/local/apache/bin/apachectl`);      
     947            if (!$sApachectlPath) 
     948                $sApachectlPath = trim(`which /usr/local/apache/bin/apache2ctl`); 
     949            if (!$sApachectlPath) 
     950                return '<b class="undef">UNDEFINED</b> (try to check manually: apachectl -M 2>&1 | grep ' . $sModule . ')'; 
     951 
     952            $ret = (boolean)`$sApachectlPath -M 2>&1 | grep $sModule`; 
     953            if (!$ret) 
     954                $ret = (boolean)`$sApachectlPath -l 2>&1 | grep $sNameCompiledName`; 
     955        } 
     956 
     957        return $ret ? '<b class="ok">OK</b>' : '<b class="fail">FAIL</b> (You will need to install ' . $sModule . ' for Apache)'; 
     958    } 
     959 
     960 
     961    function getPhpAccelerator () {    
     962        $aAccelerators = array ( 
     963            'eAccelerator' => array('op' => 'module', 'val' => 'eaccelerator'), 
     964            'APC' => array('op' => 'module', 'val' => 'apc'), 
     965            'XCache' => array('op' => 'module', 'val' => 'xcache'), 
     966        ); 
     967        foreach ($aAccelerators as $sName => $r) { 
     968            $a = $this->checkPhpSetting($sName, $r); 
     969            if ($a['res']) 
     970                return $sName; 
     971        } 
     972        return false; 
     973    } 
     974 
     975    function mysqlGetOption ($s, $l) { 
     976        return db_value("SELECT @@{$s}", $l); 
     977    } 
     978 
     979    function getUrlForGooglePageSpeed ($sRule) { 
     980        $sUrl = urlencode(BX_DOL_URL_ROOT); 
     981        return 'http://pagespeed.googlelabs.com/#url=' . $sUrl . '&mobile=false&rule=' . $sRule; 
     982    } 
     983 
     984    function sendTestEmail () { 
     985        $sEmailToCkeckMailSending = getParam('site_email'); 
     986        $mixedRet = sendMail($sEmailToCkeckMailSending, 'Audit Test Email', 'Sample text for testing<br /><u><b>Sample text for testing</b></u>'); 
     987        if (!$mixedRet) 
     988            return '<b class="fail">FAIL</b> (mail send failed)';        
     989        else 
     990            return 'test mail was send, please check ' . $sEmailToCkeckMailSending . ' mailbox'; 
     991    } 
     992 
     993} 
     994 
Note: See TracChangeset for help on using the changeset viewer.