Exemple #1
0
 /**
  * @param IfwPsn_Wp_Plugin_Manager $pm
  * @return string
  */
 public static function getServerEnvironment(IfwPsn_Wp_Plugin_Manager $pm)
 {
     $tpl = IfwPsn_Wp_Tpl::getFilesytemInstance($pm);
     $count_users = count_users();
     $mysql_server_info = @mysql_get_server_info();
     $mysql_client_info = @mysql_get_client_info();
     $phpAutoloadFunctions = array();
     foreach (IfwPsn_Wp_Autoloader::getAllRegisteredAutoloadFunctions() as $function) {
         try {
             if (is_string($function)) {
                 array_push($phpAutoloadFunctions, $function);
             } elseif (is_array($function) && count($function) == 2) {
                 $autoloadObject = $function[0];
                 if (is_object($autoloadObject)) {
                     $autoloadObject = get_class($autoloadObject);
                 }
                 $autoloadMethod = $function[1];
                 if (!is_scalar($autoloadMethod)) {
                     $autoloadMethod = var_export($autoloadMethod, true);
                 }
                 array_push($phpAutoloadFunctions, $autoloadObject . '::' . $autoloadMethod);
             } elseif (is_object($function)) {
                 array_push($phpAutoloadFunctions, get_class($function));
             }
         } catch (Exception $e) {
             // no action
         }
     }
     $context = array('plugin_name' => $pm->getEnv()->getName(), 'plugin_version' => $pm->getEnv()->getVersion(), 'plugin_build_number' => $pm->getEnv()->getBuildNumber(), 'plugin_modules' => $pm->getBootstrap()->getModuleManager()->getModules(), 'plugin_modules_initialized' => $pm->getBootstrap()->getModuleManager()->getInitializedModules(), 'plugin_modules_custom_dir' => $pm->getBootstrap()->getModuleManager()->getCustomModulesLocation(), 'OS' => PHP_OS, 'uname' => php_uname(), 'wp_version' => IfwPsn_Wp_Proxy_Blog::getVersion(), 'wp_charset' => IfwPsn_Wp_Proxy_Blog::getCharset(), 'wp_count_users' => $count_users['total_users'], 'wp_debug' => WP_DEBUG == true ? 'true' : 'false', 'wp_debug_log' => WP_DEBUG_LOG == true ? 'true' : 'false', 'wp_debug_display' => WP_DEBUG_DISPLAY == true ? 'true' : 'false', 'plugins' => IfwPsn_Wp_Proxy_Blog::getPlugins(), 'theme_name' => IfwPsn_Wp_Proxy_Blog::getThemeName(), 'theme_version' => IfwPsn_Wp_Proxy_Blog::getThemeVersion(), 'theme_author' => IfwPsn_Wp_Proxy_Blog::getThemeAuthor(), 'theme_uri' => IfwPsn_Wp_Proxy_Blog::getThemeURI(), 'php_version' => phpversion(), 'php_memory_limit' => ini_get('memory_limit'), 'php_extensions' => IfwPsn_Wp_Server_Php::getExtensions(), 'php_include_path' => get_include_path(), 'php_open_basedir' => ini_get('open_basedir'), 'php_autoload_functions' => $phpAutoloadFunctions, 'mysql_version' => !empty($mysql_server_info) ? $mysql_server_info : '', 'mysql_client' => !empty($mysql_client_info) ? $mysql_client_info : '', 'server_software' => $_SERVER['SERVER_SOFTWARE']);
     if (function_exists('apache_get_version')) {
         $context['apache_version'] = apache_get_version();
     }
     if (function_exists('apache_get_modules')) {
         $context['apache_modules'] = apache_get_modules();
     }
     return $tpl->render('server_env.html.twig', $context);
 }