Ignore:
Timestamp:
2012-07-25T06:24:02+02:00 (21 months ago)
Author:
moo
Message:

cacher/admin: adds more phpinfo when XCache is not loaded. improve looking in module info

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mod_cacher/htdocs/xcache.php

    r1038 r1041  
    207207} 
    208208 
     209$php_version = phpversion(); 
     210$xcache_version = XCACHE_VERSION; 
     211$xcache_modules = XCACHE_MODULES; 
     212 
    209213if (!extension_loaded('XCache')) { 
     214    include("header.tpl.php"); 
    210215    echo '<h1>XCache is not loaded</h1>'; 
    211216    ob_start(); 
    212     phpinfo(); 
     217    phpinfo(INFO_GENERAL); 
    213218    $info = ob_get_clean(); 
    214     if (preg_match('!<td class="v">(.*\\.ini)!', $info, $m)) { 
     219    if (preg_match_all("!<tr>[^<]*<td[^>]*>[^<]*(?:Configuration|ini|Server API)[^<]*</td>[^<]*<td[^>]*>[^<]*</td>[^<]*</tr>!s", $info, $m)) { 
     220        echo '<div class="phpinfo">'; 
     221        echo 'PHP Info'; 
     222        echo '<table>'; 
     223        echo implode('', $m[0]); 
     224        echo '</table>'; 
     225        echo '</div>'; 
     226    } 
     227    if (preg_match('!<td class="v">(.*?\\.ini)!', $info, $m)) { 
    215228        echo "Please check $m[1]"; 
    216229    } 
     
    221234        echo "You don't even have a php.ini yet?"; 
    222235    } 
     236    echo "(See above)"; 
     237    include("footer.tpl.php"); 
    223238    exit; 
    224239} 
     
    369384    phpinfo(INFO_MODULES); 
    370385    $moduleinfo = ob_get_clean(); 
    371     if (preg_match_all('!XCache[^<]*</a></h2>(.*?)<h2>!is', $moduleinfo, $m)) { 
    372         $moduleinfo = implode('', $m[1]); 
     386    if (preg_match_all('!(XCache[^<>]*)</a></h2>(.*?)<h2>!is', $moduleinfo, $m)) { 
     387        $moduleinfo = array(); 
     388        foreach ($m[1] as $i => $dummy) { 
     389            $moduleinfo[] = '<h3>' . trim($m[1][$i]) . '</h3>'; 
     390            $moduleinfo[] = str_replace('<br />', '', trim($m[2][$i])); 
     391        } 
     392        $moduleinfo = implode('', $moduleinfo); 
    373393    } 
    374394    else { 
     
    382402$type_var = XC_TYPE_VAR; 
    383403$types = array($type_none => _('Statistics'), $type_php => _('List PHP'), $type_var => _('List Var Data')); 
    384 $php_version = phpversion(); 
    385 $xcache_version = XCACHE_VERSION; 
    386 $xcache_modules = XCACHE_MODULES; 
    387404 
    388405include("xcache.tpl.php"); 
Note: See TracChangeset for help on using the changeset viewer.