Exemplo n.º 1
0
function register_qm_output_html_transients(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('transients')) {
        $output['transients'] = new QM_Output_Html_Transients($collector);
    }
    return $output;
}
 public function test_admin_toolbar_for_home_page()
 {
     $this->go_to_with_template(home_url());
     $this->assertTrue($this->html->is_active());
     $this->assertTrue($this->html->should_dispatch());
     ob_start();
     $this->html->dispatch();
     $output = ob_get_clean();
     $this->assertNotEmpty($output);
     $expected = array('admin' => false, 'assets' => true, 'conditionals' => false, 'db_callers' => true, 'db_components' => true, 'db_queries' => true, 'debug_bar' => false, 'environment' => true, 'hooks' => true, 'http' => true, 'languages' => true, 'overview' => false, 'php_errors' => false, 'redirects' => false, 'request' => true, 'theme' => true, 'transients' => true);
     $collectors = QM_Collectors::init();
     $menu = $this->html->js_admin_bar_menu();
     $this->assertInternalType('array', $menu);
     $this->assertArrayHasKey('top', $menu);
     $this->assertArrayHasKey('sub', $menu);
     $this->assertNotEmpty($menu['sub']);
     foreach ($collectors as $collector) {
         $this->assertArrayHasKey($collector->id, $expected, sprintf('%s is not present in the test menu', $collector->id));
         if ($expected[$collector->id]) {
             $this->assertArrayHasKey('query-monitor-' . $collector->id, $menu['sub']);
         } else {
             $this->assertArrayNotHasKey('query-monitor-' . $collector->id, $menu['sub']);
         }
     }
 }
Exemplo n.º 3
0
 public function process()
 {
     global $wp_actions, $wp_filter;
     $this->hide_qm = (defined('QM_HIDE_SELF') and QM_HIDE_SELF);
     $this->hide_core = (defined('QM_HIDE_CORE_HOOKS') and QM_HIDE_CORE_HOOKS);
     if (is_admin() and $admin = QM_Collectors::get('admin')) {
         $this->data['screen'] = $admin->data['base'];
     } else {
         $this->data['screen'] = '';
     }
     $hooks = $all_parts = $components = array();
     if (has_filter('all')) {
         $hooks['all'] = $this->process_action('all', $wp_filter);
     }
     if (defined('QM_SHOW_ALL_HOOKS') && QM_SHOW_ALL_HOOKS) {
         // Show all hooks
         $hook_names = array_keys($wp_filter);
     } else {
         // Only show action hooks that have been called at least once
         $hook_names = array_keys($wp_actions);
     }
     foreach ($hook_names as $name) {
         $hooks[$name] = $this->process_action($name, $wp_filter);
         $all_parts = array_merge($all_parts, $hooks[$name]['parts']);
         $components = array_merge($components, $hooks[$name]['components']);
     }
     $this->data['hooks'] = $hooks;
     $this->data['parts'] = array_unique(array_filter($all_parts));
     $this->data['components'] = array_unique(array_filter($components));
 }
Exemplo n.º 4
0
function register_qm_output_headers_redirects(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('redirects')) {
        $output['redirects'] = new QM_Output_Headers_Redirects($collector);
    }
    return $output;
}
Exemplo n.º 5
0
function register_qm_output_html_rewrites(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('rewrites')) {
        $output['rewrites'] = new QM_Output_Html_Rewrites($collector);
    }
    return $output;
}
Exemplo n.º 6
0
function register_qm_output_headers_php_errors(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('php_errors')) {
        $output['php_errors'] = new QM_Output_Headers_PHP_Errors($collector);
    }
    return $output;
}
Exemplo n.º 7
0
function register_qm_output_html_theme(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('theme')) {
        $output['theme'] = new QM_Output_Html_Theme($collector);
    }
    return $output;
}
function register_qm_output_html_languages(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('languages')) {
        $output['languages'] = new QM_Output_Html_Languages($collector);
    }
    return $output;
}
Exemplo n.º 9
0
function register_qm_output_headers_overview(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('overview')) {
        $output['overview'] = new QM_Output_Headers_Overview($collector);
    }
    return $output;
}
Exemplo n.º 10
0
function register_qm_output_html_admin(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('admin')) {
        $output['admin'] = new QM_Output_Html_Admin($collector);
    }
    return $output;
}
Exemplo n.º 11
0
function register_qm_output_html_conditionals(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('conditionals')) {
        $output['conditionals'] = new QM_Output_Html_Conditionals($collector);
    }
    return $output;
}
Exemplo n.º 12
0
 public function output()
 {
     $data = $this->collector->get_data();
     $db_query_num = null;
     $db_query_types = array();
     $db_queries = QM_Collectors::get('db_queries');
     if ($db_queries) {
         # @TODO: make this less derpy:
         $db_queries_data = $db_queries->get_data();
         if (isset($db_queries_data['types']) && isset($db_queries_data['total_time'])) {
             $db_query_num = $db_queries_data['types'];
         }
     }
     echo '<div class="qm" id="' . esc_attr($this->collector->id()) . '">';
     echo '<table cellspacing="0">';
     echo '<thead>';
     echo '<tr>';
     echo '<th scope="col">' . esc_html__('Page generation time', 'query-monitor') . '</th>';
     echo '<th scope="col">' . esc_html__('Peak memory usage', 'query-monitor') . '</th>';
     if (isset($db_query_num)) {
         echo '<th scope="col">' . esc_html__('Database query time', 'query-monitor') . '</th>';
         echo '<th scope="col">' . esc_html__('Database queries', 'query-monitor') . '</th>';
     }
     echo '</tr>';
     echo '</thead>';
     echo '<tbody>';
     echo '<tr>';
     echo '<td>';
     echo esc_html(number_format_i18n($data['time'], 4));
     echo '<br><span class="qm-info">';
     echo esc_html(sprintf(__('%1$s%% of %2$ss limit', 'query-monitor'), number_format_i18n($data['time_usage'], 1), number_format_i18n($data['time_limit'])));
     echo '</span>';
     echo '</td>';
     if (empty($data['memory'])) {
         echo '<td><em>' . esc_html__('Unknown', 'query-monitor') . '</em></td>';
     } else {
         echo '<td>';
         echo esc_html(sprintf(__('%s kB', 'query-monitor'), number_format_i18n($data['memory'] / 1024)));
         echo '<br><span class="qm-info">';
         echo esc_html(sprintf(__('%1$s%% of %2$s kB limit', 'query-monitor'), number_format_i18n($data['memory_usage'], 1), number_format_i18n($data['memory_limit'] / 1024)));
         echo '</span>';
         echo '</td>';
     }
     if (isset($db_query_num)) {
         echo '<td>';
         echo esc_html(number_format_i18n($db_queries_data['total_time'], 4));
         echo '</td>';
         echo '<td>';
         foreach ($db_query_num as $type_name => $type_count) {
             $db_query_types[] = sprintf('%1$s: %2$s', $type_name, number_format_i18n($type_count));
         }
         echo implode('<br>', array_map('esc_html', $db_query_types));
         echo '</td>';
     }
     echo '</tr>';
     echo '</tbody>';
     echo '</table>';
     echo '</div>';
 }
 static function register_output(array $output, QM_Collectors $collectors)
 {
     if ($collector = QM_Collectors::get('variable_checking')) {
         require_once QMCV_CLASS_DIR . 'query_monitor/output.php';
         $output['variable_checking'] = new QMCV_Output_Variable_Checking($collector);
     }
     return $output;
 }
function register_qm_output(array $output, \QM_Collectors $collectors)
{
    if ($collector = \QM_Collectors::get('flamegraph')) {
        include_once dirname(__FILE__) . '/inc/class-qm-output-html.php';
        $output['flamegraph'] = new QM_Output_Html($collector);
    }
    return $output;
}
 protected static function get_theme_data($item)
 {
     // @TODO this should be abstracted into a more general method which can be used for any of the collectors
     $theme = QM_Collectors::get('theme');
     $theme->process();
     $data = $theme->get_data();
     return $data[$item];
 }
Exemplo n.º 16
0
 public function admin_menu(array $menu)
 {
     if ($dbq = QM_Collectors::get('db_dupes')) {
         $dbq_data = $dbq->get_data();
         if (isset($dbq_data['dupes']) && count($dbq_data['dupes'])) {
             $menu[] = $this->menu(array('title' => esc_html(sprintf(__('Duplicate Queries (%s)', 'query-monitor'), count($dbq_data['dupes'])))));
         }
     }
     return $menu;
 }
Exemplo n.º 17
0
 public function admin_menu(array $menu)
 {
     if ($dbq = QM_Collectors::get('db_queries')) {
         $dbq_data = $dbq->get_data();
         if (isset($dbq_data['component_times'])) {
             $menu[] = $this->menu(array('title' => __('Queries by Component', 'query-monitor')));
         }
     }
     return $menu;
 }
Exemplo n.º 18
0
 public function get_outputters($outputter_id)
 {
     $out = array();
     $collectors = QM_Collectors::init();
     $collectors->process();
     $this->outputters = apply_filters("qm/outputter/{$outputter_id}", array(), $collectors);
     /* @var QM_Output[] */
     foreach ($this->outputters as $id => $outputter) {
         $out[$id] = $outputter;
     }
     return $out;
 }
Exemplo n.º 19
0
 public function process()
 {
     if ($dbq = QM_Collectors::get('db_queries')) {
         if (isset($dbq->data['component_times'])) {
             $this->data['times'] = $dbq->data['component_times'];
             usort($this->data['times'], 'QM_Collector::sort_ltime');
         }
         if (isset($dbq->data['types'])) {
             $this->data['types'] = $dbq->data['types'];
         }
     }
 }
Exemplo n.º 20
0
 public function process()
 {
     global $wp_version;
     $mysql_vars = array('key_buffer_size' => true, 'max_allowed_packet' => false, 'max_connections' => false, 'query_cache_limit' => true, 'query_cache_size' => true, 'query_cache_type' => 'ON');
     if ($dbq = QM_Collectors::get('db_queries')) {
         foreach ($dbq->db_objects as $id => $db) {
             $variables = $db->get_results("\n\t\t\t\t\tSHOW VARIABLES\n\t\t\t\t\tWHERE Variable_name IN ( '" . implode("', '", array_keys($mysql_vars)) . "' )\n\t\t\t\t");
             if (is_resource($db->dbh)) {
                 # Standard mysql extension
                 $driver = 'mysql';
             } else {
                 if (is_object($db->dbh)) {
                     # mysqli or PDO
                     $driver = get_class($db->dbh);
                 } else {
                     # Who knows?
                     $driver = '<span class="qm-warn">' . __('Unknown', 'query-monitor') . '</span>';
                 }
             }
             if (method_exists($db, 'db_version')) {
                 $version = $db->db_version();
             } else {
                 $version = '<span class="qm-warn">' . __('Unknown', 'query-monitor') . '</span>';
             }
             $this->data['db'][$id] = array('version' => $version, 'driver' => $driver, 'user' => $db->dbuser, 'host' => $db->dbhost, 'name' => $db->dbname, 'vars' => $mysql_vars, 'variables' => $variables);
         }
     }
     $this->data['php']['version'] = phpversion();
     $this->data['php']['user'] = self::get_current_user();
     foreach ($this->php_vars as $setting) {
         $this->data['php']['variables'][$setting]['after'] = ini_get($setting);
     }
     $this->data['php']['error_reporting'] = error_reporting();
     $this->data['wp'] = array('version' => $wp_version, 'WP_DEBUG' => self::format_bool_constant('WP_DEBUG'), 'WP_DEBUG_DISPLAY' => self::format_bool_constant('WP_DEBUG_DISPLAY'), 'WP_DEBUG_LOG' => self::format_bool_constant('WP_DEBUG_LOG'), 'SCRIPT_DEBUG' => self::format_bool_constant('SCRIPT_DEBUG'), 'WP_CACHE' => self::format_bool_constant('WP_CACHE'), 'CONCATENATE_SCRIPTS' => self::format_bool_constant('CONCATENATE_SCRIPTS'), 'COMPRESS_SCRIPTS' => self::format_bool_constant('COMPRESS_SCRIPTS'), 'COMPRESS_CSS' => self::format_bool_constant('COMPRESS_CSS'), 'WP_LOCAL_DEV' => self::format_bool_constant('WP_LOCAL_DEV'));
     if (is_multisite()) {
         $this->data['wp']['SUNRISE'] = self::format_bool_constant('SUNRISE');
     }
     $server = explode(' ', $_SERVER['SERVER_SOFTWARE']);
     $server = explode('/', reset($server));
     if (isset($server[1])) {
         $server_version = $server[1];
     } else {
         $server_version = null;
     }
     if (isset($_SERVER['SERVER_ADDR'])) {
         $address = $_SERVER['SERVER_ADDR'];
     } else {
         $address = null;
     }
     $this->data['server'] = array('name' => $server[0], 'version' => $server_version, 'address' => $address, 'host' => php_uname('n'));
 }
Exemplo n.º 21
0
 public function output()
 {
     $data = $this->collector->get_data();
     $db_query_num = null;
     $db_query_types = array();
     $db_queries = QM_Collectors::get('db_queries');
     if ($db_queries) {
         # @TODO: make this less derpy:
         $db_queries_data = $db_queries->get_data();
         if (isset($db_queries_data['types'])) {
             $db_query_num = $db_queries_data['types'];
             $db_stime = number_format_i18n($db_queries_data['total_time'], 4);
         }
     }
     $total_stime = number_format_i18n($data['time'], 4);
     echo '<div class="qm" id="' . esc_attr($this->collector->id()) . '">';
     echo '<table cellspacing="0">';
     $memory_usage = '<br><span class="qm-info">' . sprintf(__('%1$s%% of %2$s kB limit', 'query-monitor'), number_format_i18n($data['memory_usage'], 1), number_format_i18n($data['memory_limit'] / 1024)) . '</span>';
     $time_usage = '<br><span class="qm-info">' . sprintf(__('%1$s%% of %2$ss limit', 'query-monitor'), number_format_i18n($data['time_usage'], 1), number_format_i18n($data['time_limit'])) . '</span>';
     echo '<thead>';
     echo '<tr>';
     echo '<th scope="col">' . __('Page generation time', 'query-monitor') . '</th>';
     echo '<th scope="col">' . __('Peak memory usage', 'query-monitor') . '</th>';
     if (isset($db_query_num)) {
         echo '<th scope="col">' . __('Database query time', 'query-monitor') . '</th>';
         echo '<th scope="col">' . __('Database queries', 'query-monitor') . '</th>';
     }
     echo '</tr>';
     echo '</thead>';
     echo '<tbody>';
     echo '<tr>';
     echo "<td>{$total_stime}{$time_usage}</td>";
     if (empty($data['memory'])) {
         echo '<td><em>' . __('Unknown', 'query-monitor') . '</em><br><span class="qm-info">' . __('Neither memory_get_peak_usage() nor memory_get_usage() are available. Speak to your host and get them to sort it out.', 'query-monitor') . '</span></td>';
     } else {
         echo '<td>' . sprintf(__('%s kB', 'query-monitor'), number_format_i18n($data['memory'] / 1024)) . $memory_usage . '</td>';
     }
     if (isset($db_query_num)) {
         echo "<td>{$db_stime}</td>";
         echo '<td>';
         foreach ($db_query_num as $type_name => $type_count) {
             $db_query_types[] = sprintf('%1$s: %2$s', $type_name, number_format_i18n($type_count));
         }
         echo implode('<br>', $db_query_types);
         echo '</td>';
     }
     echo '</tr>';
     echo '</tbody>';
     echo '</table>';
     echo '</div>';
 }
Exemplo n.º 22
0
 public function action_plugins_loaded()
 {
     # Register additional collectors:
     foreach (apply_filters('qm/collectors', array(), $this) as $collector) {
         QM_Collectors::add($collector);
     }
     # Load dispatchers:
     foreach (glob($this->plugin_path('dispatchers/*.php')) as $file) {
         include $file;
     }
     # Register built-in and additional dispatchers:
     foreach (apply_filters('qm/dispatchers', array(), $this) as $dispatcher) {
         QM_Dispatchers::add($dispatcher);
     }
 }
Exemplo n.º 23
0
function register_qm_output_html_debug_bar(array $output, QM_Collectors $collectors)
{
    global $debug_bar;
    if (empty($debug_bar)) {
        return $output;
    }
    foreach ($debug_bar->panels as $panel) {
        $panel_id = strtolower(get_class($panel));
        $collector = QM_Collectors::get("debug_bar_{$panel_id}");
        if ($collector and $collector->is_visible()) {
            $output["debug_bar_{$panel_id}"] = new QM_Output_Html_Debug_Bar($collector);
        }
    }
    return $output;
}
Exemplo n.º 24
0
 public function process()
 {
     global $wp_rewrite;
     if (is_admin() or QM_Util::is_async()) {
         return;
     }
     if (!($request = QM_Collectors::get('request'))) {
         return;
     }
     if (empty($wp_rewrite->rules)) {
         return;
     }
     $req = $request->data['request']['request'];
     $matching = array();
     foreach ($wp_rewrite->rules as $match => $query) {
         if (preg_match("#^{$match}#", $req)) {
             $matching[$match] = $query;
         }
     }
     $this->data['matching'] = $matching;
 }
Exemplo n.º 25
0
 public function process()
 {
     global $wp_actions, $wp_filter;
     $this->hide_qm = (defined('QM_HIDE_SELF') and QM_HIDE_SELF);
     if (is_admin() and $admin = QM_Collectors::get('admin')) {
         $this->data['screen'] = $admin->data['base'];
     } else {
         $this->data['screen'] = '';
     }
     $hooks = $all_parts = $components = array();
     if (has_filter('all')) {
         $hooks['all'] = $this->process_action('all', $wp_filter);
     }
     foreach ($wp_actions as $name => $count) {
         $hooks[$name] = $this->process_action($name, $wp_filter);
         $all_parts = array_merge($all_parts, $hooks[$name]['parts']);
         $components = array_merge($components, $hooks[$name]['components']);
     }
     $this->data['hooks'] = $hooks;
     $this->data['parts'] = array_unique(array_filter($all_parts));
     $this->data['components'] = array_unique(array_filter($components));
 }
Exemplo n.º 26
0
function register_qm_collectors_debug_bar()
{
    global $debug_bar;
    if (class_exists('Debug_Bar') || qm_debug_bar_being_activated()) {
        return;
    }
    $collectors = QM_Collectors::init();
    $qm = QueryMonitor::init();
    require_once $qm->plugin_path('classes/debug_bar.php');
    $debug_bar = new Debug_Bar();
    $redundant = array('debug_bar_actions_addon_panel', 'debug_bar_remote_requests_panel', 'debug_bar_screen_info_panel', 'ps_listdeps_debug_bar_panel');
    foreach ($debug_bar->panels as $panel) {
        $panel_id = strtolower(get_class($panel));
        if (in_array($panel_id, $redundant)) {
            continue;
        }
        $collector = new QM_Collector_Debug_Bar();
        $collector->set_id("debug_bar_{$panel_id}");
        $collector->set_panel($panel);
        $collectors->add($collector);
    }
}
Exemplo n.º 27
0
function register_qm_output_html_db_queries(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('db_queries')) {
        $output['db_queries'] = new QM_Output_Html_DB_Queries($collector);
    }
    return $output;
}
Exemplo n.º 28
0
        $trace = new QM_Backtrace();
        $filtered = $trace->get_filtered_trace();
        $caller = array();
        foreach ($filtered as $i => $item) {
            if (in_array($item['function'], array('load_plugin_textdomain', 'load_theme_textdomain', 'load_default_textdomain'), true)) {
                $caller = $item;
                $display = $i + 1;
                if (isset($filtered[$display])) {
                    $caller['display'] = $filtered[$display]['display'];
                }
                break;
            }
        }
        if (empty($caller)) {
            if (isset($filtered[1])) {
                $caller = $filtered[1];
            } else {
                $caller = $filtered[0];
            }
        }
        if (!isset($caller['file']) && isset($filtered[0]['file']) && isset($filtered[0]['line'])) {
            $caller['file'] = $filtered[0]['file'];
            $caller['line'] = $filtered[0]['line'];
        }
        $this->data['languages'][] = array('caller' => $caller, 'domain' => $domain, 'mofile' => $mofile, 'found' => file_exists($mofile) ? filesize($mofile) : false);
        return $override;
    }
}
# Load early to catch early errors
QM_Collectors::add(new QM_Collector_Languages());
function register_qm_output_html_environment(array $output, QM_Collectors $collectors)
{
    if ($collector = QM_Collectors::get('environment')) {
        $output['environment'] = new QM_Output_Html_Environment($collector);
    }
    return $output;
}
Exemplo n.º 30
0
 public function process()
 {
     global $wp_version;
     $mysql_vars = array('key_buffer_size' => true, 'max_allowed_packet' => false, 'max_connections' => false, 'query_cache_limit' => true, 'query_cache_size' => true, 'query_cache_type' => 'ON');
     if ($dbq = QM_Collectors::get('db_queries')) {
         foreach ($dbq->db_objects as $id => $db) {
             $variables = $db->get_results("\n\t\t\t\t\tSHOW VARIABLES\n\t\t\t\t\tWHERE Variable_name IN ( '" . implode("', '", array_keys($mysql_vars)) . "' )\n\t\t\t\t");
             if (is_resource($db->dbh)) {
                 # Old mysql extension
                 $extension = 'mysql';
             } else {
                 if (is_object($db->dbh)) {
                     # mysqli or PDO
                     $extension = get_class($db->dbh);
                 } else {
                     # Who knows?
                     $extension = null;
                 }
             }
             if (method_exists($db, 'db_version')) {
                 $server = $db->db_version();
             } else {
                 $server = null;
             }
             if (isset($db->use_mysqli) && $db->use_mysqli) {
                 $client = mysqli_get_client_version();
             } else {
                 if (preg_match('|[0-9]{1,2}\\.[0-9]{1,2}\\.[0-9]{1,2}|', mysql_get_client_info(), $matches)) {
                     $client = $matches[0];
                 } else {
                     $client = null;
                 }
             }
             if ($client) {
                 $client_version = implode('.', QM_Util::get_client_version($client));
                 $client_version = sprintf('%s (%s)', $client, $client_version);
             } else {
                 $client_version = null;
             }
             $info = array('extension' => $extension, 'server version' => $server, 'client version' => $client_version, 'user' => $db->dbuser, 'host' => $db->dbhost, 'database' => $db->dbname);
             $this->data['db'][$id] = array('info' => $info, 'vars' => $mysql_vars, 'variables' => $variables);
         }
     }
     $this->data['php']['version'] = phpversion();
     $this->data['php']['sapi'] = php_sapi_name();
     $this->data['php']['user'] = self::get_current_user();
     if (defined('HHVM_VERSION')) {
         $this->data['php']['hhvm'] = HHVM_VERSION;
     }
     foreach ($this->php_vars as $setting) {
         $this->data['php']['variables'][$setting]['after'] = ini_get($setting);
     }
     $this->data['php']['error_reporting'] = error_reporting();
     $this->data['wp'] = array('version' => $wp_version, 'WP_DEBUG' => self::format_bool_constant('WP_DEBUG'), 'WP_DEBUG_DISPLAY' => self::format_bool_constant('WP_DEBUG_DISPLAY'), 'WP_DEBUG_LOG' => self::format_bool_constant('WP_DEBUG_LOG'), 'SCRIPT_DEBUG' => self::format_bool_constant('SCRIPT_DEBUG'), 'WP_CACHE' => self::format_bool_constant('WP_CACHE'), 'CONCATENATE_SCRIPTS' => self::format_bool_constant('CONCATENATE_SCRIPTS'), 'COMPRESS_SCRIPTS' => self::format_bool_constant('COMPRESS_SCRIPTS'), 'COMPRESS_CSS' => self::format_bool_constant('COMPRESS_CSS'), 'WP_LOCAL_DEV' => self::format_bool_constant('WP_LOCAL_DEV'));
     if (is_multisite()) {
         $this->data['wp']['SUNRISE'] = self::format_bool_constant('SUNRISE');
     }
     $server = explode(' ', $_SERVER['SERVER_SOFTWARE']);
     $server = explode('/', reset($server));
     if (isset($server[1])) {
         $server_version = $server[1];
     } else {
         $server_version = null;
     }
     if (isset($_SERVER['SERVER_ADDR'])) {
         $address = $_SERVER['SERVER_ADDR'];
     } else {
         $address = null;
     }
     $this->data['server'] = array('name' => $server[0], 'version' => $server_version, 'address' => $address, 'host' => php_uname('n'));
 }