Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update tep_get_system_information so it could be used to collect anon…

…ymous statistics with the store owners permission
  • Loading branch information...
commit e14a8a9f92c31395c0c6d00ca8ecab35b73a34a0 1 parent 3f3dc72
@markkevans markkevans authored haraldpdl committed
View
68 catalog/admin/includes/functions/general.php
@@ -784,7 +784,7 @@ function tep_mod_select_option($select_array, $key_name, $key_value) {
////
// Retreive server information
- function tep_get_system_information() {
+ function tep_get_system_information($anonymous = false) {
global $HTTP_SERVER_VARS;
$db_query = tep_db_query("select now() as datetime");
@@ -792,19 +792,59 @@ function tep_get_system_information() {
list($system, $host, $kernel) = preg_split('/[\s,]+/', @exec('uname -a'), 5);
- return array('date' => tep_datetime_short(date('Y-m-d H:i:s')),
- 'system' => $system,
- 'kernel' => $kernel,
- 'host' => $host,
- 'ip' => gethostbyname($host),
- 'uptime' => @exec('uptime'),
- 'http_server' => $HTTP_SERVER_VARS['SERVER_SOFTWARE'],
- 'php' => PHP_VERSION,
- 'zend' => (function_exists('zend_version') ? zend_version() : ''),
- 'db_server' => DB_SERVER,
- 'db_ip' => gethostbyname(DB_SERVER),
- 'db_version' => 'MySQL ' . (function_exists('mysql_get_server_info') ? mysql_get_server_info() : ''),
- 'db_date' => tep_datetime_short($db['datetime']));
+ $data = array();
+
+ $data['system'] = array('date' => tep_datetime_short(date('Y-m-d H:i:s')),
+ 'os' => PHP_OS,
+ 'kernel' => $kernel,
+ 'host' => $host,
+ 'uptime' => @exec('uptime'),
+ 'ip' => gethostbyname($host),
+ 'http_server' => $HTTP_SERVER_VARS['SERVER_SOFTWARE']);
+
+ $data['mysql'] = array('version' => 'MySQL ' . (function_exists('mysql_get_server_info') ? mysql_get_server_info() : ''),
+ 'server' => DB_SERVER,
+ 'ip' => gethostbyname(DB_SERVER),
+ 'date' => tep_datetime_short($db['datetime']));
+
+ $data['php'] = array('version' => PHP_VERSION,
+ 'zend' => (function_exists('zend_version') ? zend_version() : ''),
+ 'sapi' => PHP_SAPI,
+ 'int_size' => defined('PHP_INT_SIZE') ? PHP_INT_SIZE : '',
+ 'safe_mode' => (int) @ini_get('safe_mode'),
+ 'open_basedir' => (int) @ini_get('open_basedir'),
+ 'memory_limit' => @ini_get('memory_limit'),
+ 'error_reporting' => error_reporting(),
+ 'display_errors' => (int)@ini_get('display_errors'),
+ 'allow_url_fopen' => (int) @ini_get('allow_url_fopen'),
+ 'allow_url_include' => (int) @ini_get('allow_url_include'),
+ 'file_uploads' => (int) @ini_get('file_uploads'),
+ 'upload_max_filesize' => @ini_get('upload_max_filesize'),
+ 'post_max_size' => @ini_get('post_max_size'),
+ 'disable_functions' => @ini_get('disable_functions'),
+ 'disable_classes' => @ini_get('disable_classes'),
+ 'enable_dl' => (int) @ini_get('enable_dl'),
+ 'magic_quotes_gpc' => (int) @ini_get('magic_quotes_gpc'),
+ 'register_globals' => (int) @ini_get('register_globals'),
+ 'filter.default' => @ini_get('filter.default'),
+ 'zend.ze1_compatibility_mode' => (int) @ini_get('zend.ze1_compatibility_mode'),
+ 'unicode.semantics' => (int) @ini_get('unicode.semantics'),
+ 'zend_thread_safty' => (int) function_exists('zend_thread_id'),
+ 'extensions' => get_loaded_extensions());
+
+ // If we need anonymous data we need to remove some data which could
+ // potentially be used to identify a particular installation. A SHA1 hash
+ // is used purely to identify duplicate submissions
+ if ($anonymous === true) {
+ $data['system']['host'] = sha1($data['system']['host'] . $data['system']['ip']);
+ $data['system']['ip'] = '0.0.0.0';
+ $data['system']['uptime'] = '0';
+
+ $data['mysql']['server'] = '';
+ $data['mysql']['ip'] = '';
+ }
+
+ return $data;
}
function tep_generate_category_path($id, $from = 'category', $categories_array = '', $index = 0) {
View
20 catalog/admin/server_info.php
@@ -12,7 +12,7 @@
require('includes/application_top.php');
- $system = tep_get_system_information();
+ $info = tep_get_system_information();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html <?php echo HTML_PARAMS; ?>>
@@ -50,36 +50,36 @@
<td><table border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="smallText"><b><?php echo TITLE_SERVER_HOST; ?></b></td>
- <td class="smallText"><?php echo $system['host'] . ' (' . $system['ip'] . ')'; ?></td>
+ <td class="smallText"><?php echo $info['system']['host'] . ' (' . $info['system']['ip'] . ')'; ?></td>
<td class="smallText">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><?php echo TITLE_DATABASE_HOST; ?></b></td>
- <td class="smallText"><?php echo $system['db_server'] . ' (' . $system['db_ip'] . ')'; ?></td>
+ <td class="smallText"><?php echo $info['mysql']['server'] . ' (' . $info['mysql']['ip'] . ')'; ?></td>
</tr>
<tr>
<td class="smallText"><b><?php echo TITLE_SERVER_OS; ?></b></td>
- <td class="smallText"><?php echo $system['system'] . ' ' . $system['kernel']; ?></td>
+ <td class="smallText"><?php echo $info['system']['os'] . ' ' . $info['system']['kernel']; ?></td>
<td class="smallText">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><?php echo TITLE_DATABASE; ?></b></td>
- <td class="smallText"><?php echo $system['db_version']; ?></td>
+ <td class="smallText"><?php echo $info['mysql']['version']; ?></td>
</tr>
<tr>
<td class="smallText"><b><?php echo TITLE_SERVER_DATE; ?></b></td>
- <td class="smallText"><?php echo $system['date']; ?></td>
+ <td class="smallText"><?php echo $info['system']['date']; ?></td>
<td class="smallText">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><?php echo TITLE_DATABASE_DATE; ?></b></td>
- <td class="smallText"><?php echo $system['db_date']; ?></td>
+ <td class="smallText"><?php echo $info['mysql']['date']; ?></td>
</tr>
<tr>
<td class="smallText"><b><?php echo TITLE_SERVER_UP_TIME; ?></b></td>
- <td colspan="3" class="smallText"><?php echo $system['uptime']; ?></td>
+ <td colspan="3" class="smallText"><?php echo $info['system']['uptime']; ?></td>
</tr>
<tr>
<td colspan="4"><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
</tr>
<tr>
<td class="smallText"><b><?php echo TITLE_HTTP_SERVER; ?></b></td>
- <td colspan="3" class="smallText"><?php echo $system['http_server']; ?></td>
+ <td colspan="3" class="smallText"><?php echo $info['system']['http_server']; ?></td>
</tr>
<tr>
<td class="smallText"><b><?php echo TITLE_PHP_VERSION; ?></b></td>
- <td colspan="3" class="smallText"><?php echo $system['php'] . ' (' . TITLE_ZEND_VERSION . ' ' . $system['zend'] . ')'; ?></td>
+ <td colspan="3" class="smallText"><?php echo $info['php']['version'] . ' (' . TITLE_ZEND_VERSION . ' ' . $info['php']['zend'] . ')'; ?></td>
</tr>
</table></td>
</tr>
Please sign in to comment.
Something went wrong with that request. Please try again.