Yireo_Mpi - Version 0.2.4

Version Notes

No notes

Download this release

Release Info

Developer Yireo
Extension Yireo_Mpi
Version 0.2.4
Comparing to
See all releases


Code changes from version 0.2.1 to 0.2.4

app/code/community/Yireo/Mpi/Block/System/Config/Form/Field/Version.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Yireo Mpi for Magento
4
+ *
5
+ * @package Yireo_Mpi
6
+ * @author Yireo (http://www.yireo.com/)
7
+ * @copyright Copyright 2015 Yireo (http://www.yireo.com/)
8
+ * @license Open Source License (OSL v3)
9
+ */
10
+
11
+ /**
12
+ * System check class
13
+ */
14
+ class Yireo_Mpi_Block_System_Config_Form_Field_Version extends Mage_Adminhtml_Block_System_Config_Form_Field
15
+ {
16
+ /**
17
+ * @param Varien_Data_Form_Element_Abstract $element
18
+ *
19
+ * @return string
20
+ */
21
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
22
+ {
23
+ $config = Mage::app()->getConfig()->getModuleConfig('Yireo_Mpi');
24
+ return (string)$config->version;
25
+ }
26
+ }
app/code/community/Yireo/Mpi/Helper/Data.php CHANGED
@@ -91,4 +91,13 @@ class Yireo_Mpi_Helper_Data extends Mage_Core_Helper_Abstract
91
 
92
  return $groups;
93
  }
 
 
 
 
 
 
 
 
 
94
  }
91
 
92
  return $groups;
93
  }
94
+
95
+ public function getDefaultStore()
96
+ {
97
+ $defaultStore = Mage::app()
98
+ ->getWebsite(true)
99
+ ->getDefaultGroup()
100
+ ->getDefaultStore();
101
+ return $defaultStore;
102
+ }
103
  }
app/code/community/Yireo/Mpi/Model/Metric.php CHANGED
@@ -23,7 +23,7 @@ class Yireo_Mpi_Model_Metric
23
  /**
24
  * Allowed metric types
25
  */
26
- protected $allowedTypes = array('int', 'bool', 'string', 'text', 'seconds', 'bytes', 'double', 'timestamp', 'array');
27
 
28
  /**
29
  * Metric name
23
  /**
24
  * Allowed metric types
25
  */
26
+ protected $allowedTypes = array('int', 'bool', 'string', 'text', 'seconds', 'bytes', 'kilobytes', 'megabytes', 'double', 'timestamp', 'array');
27
 
28
  /**
29
  * Metric name
app/code/community/Yireo/Mpi/Model/Resource.php CHANGED
@@ -23,6 +23,7 @@ class Yireo_Mpi_Model_Resource
23
  'test',
24
  ),
25
  'all' => array(
 
26
  'core_attribute',
27
  'core_cache',
28
  'core_catalog',
@@ -47,6 +48,7 @@ class Yireo_Mpi_Model_Resource
47
  'security_admin',
48
  'security_get',
49
  'security_shoplift',
 
50
  'security_xmlrpc',
51
  'webserver_advanced',
52
  'webserver_basics',
@@ -56,8 +58,10 @@ class Yireo_Mpi_Model_Resource
56
  'database_variable',
57
  ),
58
  'poll_short' => array(
 
59
  ),
60
  'poll_long' => array(
 
61
  ),
62
  );
63
 
@@ -66,8 +70,25 @@ class Yireo_Mpi_Model_Resource
66
  */
67
  public function getResourceModels()
68
  {
69
- // @todo: Add an event to allow for third party extensions to extend this array
70
- return $this->resourceModels;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  }
72
 
73
  /**
@@ -107,6 +128,7 @@ class Yireo_Mpi_Model_Resource
107
  return array();
108
  }
109
 
 
110
  $modelMetrics = $model->getData();
111
 
112
  if (is_array($modelMetrics) == false) {
@@ -134,7 +156,7 @@ class Yireo_Mpi_Model_Resource
134
  {
135
  $data = array();
136
 
137
- foreach ($this->resourceModels as $resourceModelGroupName => $resourceModelGroup) {
138
 
139
  if(!empty($selectGroups) && in_array($resourceModelGroupName, $selectGroups) == false) {
140
  continue;
23
  'test',
24
  ),
25
  'all' => array(
26
+ 'attribute_listing',
27
  'core_attribute',
28
  'core_cache',
29
  'core_catalog',
48
  'security_admin',
49
  'security_get',
50
  'security_shoplift',
51
+ 'security_phpinfo',
52
  'security_xmlrpc',
53
  'webserver_advanced',
54
  'webserver_basics',
58
  'database_variable',
59
  ),
60
  'poll_short' => array(
61
+ 'database_status',
62
  ),
63
  'poll_long' => array(
64
+ 'database_status',
65
  ),
66
  );
67
 
70
  */
71
  public function getResourceModels()
72
  {
73
+ $resourceModelGroups = $this->resourceModels;
74
+
75
+ foreach ($resourceModelGroups as $resourceModelGroupName => $resourceModelGroup) {
76
+ foreach($resourceModelGroup as $resourceModel) {
77
+ if (preg_match('/^([a-z]+)_/', $resourceModel, $match)) {
78
+ $newGroup = $match[1];
79
+ if (!isset($resourceModelGroups[$newGroup])) {
80
+ $resourceModelGroups[$newGroup] = array();
81
+ }
82
+
83
+ $resourceModelGroups[$newGroup][] = $resourceModel;
84
+ }
85
+ }
86
+ }
87
+
88
+ // Add an event to allow for third party extensions to extend this array
89
+ Mage::dispatchEvent('mpi_list_resource_models', array('resourceModels' => $resourceModelGroups));
90
+
91
+ return $resourceModelGroups;
92
  }
93
 
94
  /**
128
  return array();
129
  }
130
 
131
+ //Mage::log('[Yireo_Mpi] '.$modelName);
132
  $modelMetrics = $model->getData();
133
 
134
  if (is_array($modelMetrics) == false) {
156
  {
157
  $data = array();
158
 
159
+ foreach ($this->getResourceModels() as $resourceModelGroupName => $resourceModelGroup) {
160
 
161
  if(!empty($selectGroups) && in_array($resourceModelGroupName, $selectGroups) == false) {
162
  continue;
app/code/community/Yireo/Mpi/Model/Resource/Attribute/Listing.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Yireo Mpi for Magento
4
+ *
5
+ * @package Yireo_Mpi
6
+ * @author Yireo (http://www.yireo.com/)
7
+ * @copyright Copyright 2015 Yireo (http://www.yireo.com/)
8
+ * @license Open Source License (OSL v3)
9
+ */
10
+
11
+ /**
12
+ *
13
+ */
14
+ class Yireo_Mpi_Model_Resource_Attribute_Listing extends Yireo_Mpi_Model_Resource_Abstract
15
+ {
16
+ protected $attributeListing = array();
17
+
18
+ protected $attributeConfigurable = array();
19
+
20
+ protected $attributeFilterable = array();
21
+
22
+ protected $attributeSearchable = array();
23
+
24
+ protected $attributeComparable = array();
25
+
26
+ protected $attributeSuper = array();
27
+
28
+ /**
29
+ * Return all data of this class
30
+ *
31
+ * @return array
32
+ */
33
+ public function getData()
34
+ {
35
+ $this->getAttributeListings();
36
+
37
+ $this->addMetric('catalog_product_attributes_array_listing', $this->attributeListing, 'array');
38
+ $this->addMetric('catalog_product_attributes_array_configurable', $this->attributeConfigurable, 'array');
39
+ $this->addMetric('catalog_product_attributes_array_filterable', $this->attributeFilterable, 'array');
40
+ $this->addMetric('catalog_product_attributes_array_searchable', $this->attributeSearchable, 'array');
41
+ $this->addMetric('catalog_product_attributes_array_comparable', $this->attributeComparable, 'array');
42
+ $this->addMetric('catalog_product_attributes_array_super', $this->attributeSuper, 'array');
43
+
44
+ return $this->metrics;
45
+ }
46
+
47
+ /**
48
+ *
49
+ */
50
+ protected function getAttributeListings()
51
+ {
52
+ $attributes = $this->getAttributes();
53
+ $superAttributes = $this->getUsedSuperAttributeIds();
54
+
55
+ foreach($attributes as $attribute) {
56
+
57
+ if($attribute->getData('is_user_defined') == 0) {
58
+ continue;
59
+ }
60
+
61
+ if($attribute->getData('used_in_product_listing') == 1) {
62
+ $this->attributeListing[] = $attribute->getName();
63
+ }
64
+
65
+ $applyTo = explode(',', $attribute->getData('apply_to'));
66
+ $allowFrontendInput = array('boolean', 'select', 'multiselect');
67
+ if($attribute->getData('is_configurable') == 1 && in_array('configurable', $applyTo)
68
+ && in_array($attribute->getData('frontend_input', $allowFrontendInput))) {
69
+ $this->attributeConfigurable[] = $attribute->getName();
70
+ }
71
+
72
+ if($attribute->getData('is_filterable') == 1) {
73
+ $this->attributeFilterable[] = $attribute->getName();
74
+ }
75
+
76
+ if($attribute->getData('is_searchable') == 1) {
77
+ $this->attributeSearchable[] = $attribute->getName();
78
+ }
79
+
80
+ if($attribute->getData('is_comparable') == 1) {
81
+ $this->attributeComparable[] = $attribute->getName();
82
+ }
83
+
84
+ if(in_array($attribute->getId(), $superAttributes)) {
85
+ $this->attributeSuper[] = $attribute->getName();
86
+ }
87
+ }
88
+ }
89
+
90
+ public function getUsedSuperAttributeIds()
91
+ {
92
+ $resource = Mage::getSingleton('core/resource');
93
+ $readConnection = $resource->getConnection('core_read');
94
+ $tableName = $resource->getTableName('catalog_product_super_attribute');
95
+ $query = 'SELECT DISTINCT(`attribute_id`) AS `id` FROM '.$tableName;
96
+ $results = $readConnection->fetchAll($query);
97
+
98
+ $ids = array();
99
+ foreach ($results as $result) {
100
+ $ids[] = $result['id'];
101
+ }
102
+
103
+ return $ids;
104
+ }
105
+
106
+ /**
107
+ * @return mixed
108
+ */
109
+ protected function getAttributes()
110
+ {
111
+ $attributes = Mage::getSingleton('eav/config')->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection();
112
+
113
+ return $attributes;
114
+ }
115
+ }
app/code/community/Yireo/Mpi/Model/Resource/Core/Attribute.php CHANGED
@@ -41,18 +41,13 @@ class Yireo_Mpi_Model_Resource_Core_Attribute extends Yireo_Mpi_Model_Resource_A
41
  protected function getAttributeStatistics()
42
  {
43
  $attributes = $this->getAttributes();
 
44
 
45
- foreach($attributes as $attribute) {
46
- $this->attributeCountAll++;
47
-
48
- if($attribute->getData('is_filterable') == 1) {
49
- $this->attributeCountLayNav++;
50
- }
51
 
52
- if($attribute->getData('is_searchable') == 1 && $attribute->getData('is_filterable_in_search') == 1) {
53
- $this->attributeCountSearch++;
54
- }
55
- }
56
  }
57
 
58
  /**
@@ -60,7 +55,7 @@ class Yireo_Mpi_Model_Resource_Core_Attribute extends Yireo_Mpi_Model_Resource_A
60
  */
61
  protected function getAttributes()
62
  {
63
- $attributes = Mage::getSingleton('eav/config')->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection();
64
  return $attributes;
65
  }
66
  }
41
  protected function getAttributeStatistics()
42
  {
43
  $attributes = $this->getAttributes();
44
+ $this->attributeCountAll = $attributes->getSize();
45
 
46
+ $attributes = $this->getAttributes();
47
+ $this->attributeCountLayNav = $attributes->addFieldToFilter('is_filterable', 1)->getSize();
 
 
 
 
48
 
49
+ $attributes = $this->getAttributes();
50
+ $this->attributeCountSearch = $attributes->addFieldToFilter('is_searchable', 1)->getSize();
 
 
51
  }
52
 
53
  /**
55
  */
56
  protected function getAttributes()
57
  {
58
+ $attributes = Mage::getModel('eav/config')->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection();
59
  return $attributes;
60
  }
61
  }
app/code/community/Yireo/Mpi/Model/Resource/Core/Configuration.php CHANGED
@@ -20,10 +20,11 @@ class Yireo_Mpi_Model_Resource_Core_Configuration extends Yireo_Mpi_Model_Resour
20
  */
21
  public function getData()
22
  {
 
23
  $result = array();
24
 
25
  foreach ($this->getPaths() as $path => $variableType) {
26
- $result[] = $this->getMetric($path, Mage::getStoreConfig($path), $variableType);
27
  }
28
 
29
  foreach ($this->getNodes() as $node => $variableType) {
@@ -62,6 +63,7 @@ class Yireo_Mpi_Model_Resource_Core_Configuration extends Yireo_Mpi_Model_Resour
62
  'dev/log/active' => 'bool',
63
  'dev/js/merge_files' => 'bool',
64
  'dev/css/merge_css_files' => 'bool',
 
65
  );
66
  }
67
  }
20
  */
21
  public function getData()
22
  {
23
+ $defaultStore = Mage::helper('mpi')->getDefaultStore();
24
  $result = array();
25
 
26
  foreach ($this->getPaths() as $path => $variableType) {
27
+ $result[] = $this->getMetric($path, Mage::getStoreConfig($path, $defaultStore), $variableType);
28
  }
29
 
30
  foreach ($this->getNodes() as $node => $variableType) {
63
  'dev/log/active' => 'bool',
64
  'dev/js/merge_files' => 'bool',
65
  'dev/css/merge_css_files' => 'bool',
66
+ 'general/locale/timezone' => 'string',
67
  );
68
  }
69
  }
app/code/community/Yireo/Mpi/Model/Resource/Environment/Basics.php CHANGED
@@ -13,6 +13,8 @@
13
  */
14
  class Yireo_Mpi_Model_Resource_Environment_Basics extends Yireo_Mpi_Model_Resource_Abstract
15
  {
 
 
16
  /**
17
  * Return all data of this class
18
  *
@@ -21,17 +23,28 @@ class Yireo_Mpi_Model_Resource_Environment_Basics extends Yireo_Mpi_Model_Resour
21
  public function getData()
22
  {
23
  return array(
 
24
  $this->getMetricFromCallback('ip', 'getIpAddress'),
25
  $this->getMetricFromCallback('internal_ip', 'getInternalIpAddress'),
26
  $this->getMetricFromCallback('keep_alive', 'getKeepAlive'),
27
  $this->getMetricFromCallback('gzip', 'getGzip'),
28
  $this->getMetricFromCallback('deflate', 'getDeflate'),
29
  $this->getMetricFromCallback('dns_time', 'getDnsTime', 'seconds'),
 
 
 
 
30
  $this->getMetric('timezone:php', date_default_timezone_get()),
31
  $this->getMetric('timezone:ini', ini_get('date.timezone')),
32
  );
33
  }
34
 
 
 
 
 
 
 
35
  public function getIpAddress()
36
  {
37
  return $_SERVER['SERVER_ADDR'];
@@ -57,9 +70,14 @@ class Yireo_Mpi_Model_Resource_Environment_Basics extends Yireo_Mpi_Model_Resour
57
  return (bool) stristr($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate');
58
  }
59
 
 
 
 
 
 
60
  public function getDnsTime()
61
  {
62
- $host = 'www.magentocommerce.com';
63
  $dnsTimer = 0;
64
  for($i = 0; $i < 4; $i++) {
65
  $startTimer = microtime(true);
@@ -70,4 +88,32 @@ class Yireo_Mpi_Model_Resource_Environment_Basics extends Yireo_Mpi_Model_Resour
70
 
71
  return (float) round($dnsTimer / 4, 4);
72
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  }
13
  */
14
  class Yireo_Mpi_Model_Resource_Environment_Basics extends Yireo_Mpi_Model_Resource_Abstract
15
  {
16
+ protected $dns_host = 'www.magentocommerce.com';
17
+
18
  /**
19
  * Return all data of this class
20
  *
23
  public function getData()
24
  {
25
  return array(
26
+ $this->getMetricFromCallback('extension_version', 'getExtensionVersion'),
27
  $this->getMetricFromCallback('ip', 'getIpAddress'),
28
  $this->getMetricFromCallback('internal_ip', 'getInternalIpAddress'),
29
  $this->getMetricFromCallback('keep_alive', 'getKeepAlive'),
30
  $this->getMetricFromCallback('gzip', 'getGzip'),
31
  $this->getMetricFromCallback('deflate', 'getDeflate'),
32
  $this->getMetricFromCallback('dns_time', 'getDnsTime', 'seconds'),
33
+ $this->getMetricFromCallback('dns_host', 'getDnsHost'),
34
+ $this->getMetricFromCallback('openssl_digest_methods', 'getOpensslDigestMethods', 'array'),
35
+ $this->getMetricFromCallback('openssl_cipher_methods', 'getOpensslCipherMethods', 'array'),
36
+ $this->getMetricFromCallback('openssl_version', 'getOpensslVersion'),
37
  $this->getMetric('timezone:php', date_default_timezone_get()),
38
  $this->getMetric('timezone:ini', ini_get('date.timezone')),
39
  );
40
  }
41
 
42
+ public function getExtensionVersion()
43
+ {
44
+ $config = Mage::app()->getConfig()->getModuleConfig('Yireo_Mpi');
45
+ return (string)$config->version;
46
+ }
47
+
48
  public function getIpAddress()
49
  {
50
  return $_SERVER['SERVER_ADDR'];
70
  return (bool) stristr($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate');
71
  }
72
 
73
+ public function getDnsHost()
74
+ {
75
+ return $this->dns_host;
76
+ }
77
+
78
  public function getDnsTime()
79
  {
80
+ $host = $this->dns_host;
81
  $dnsTimer = 0;
82
  for($i = 0; $i < 4; $i++) {
83
  $startTimer = microtime(true);
88
 
89
  return (float) round($dnsTimer / 4, 4);
90
  }
91
+
92
+ public function getOpensslDigestMethods()
93
+ {
94
+ if (function_exists('openssl_get_md_methods') == false)
95
+ {
96
+ return false;
97
+ }
98
+
99
+ return openssl_get_md_methods();
100
+ }
101
+
102
+ public function getOpensslCipherMethods()
103
+ {
104
+ if (function_exists('openssl_get_cipher_methods') == false)
105
+ {
106
+ return false;
107
+ }
108
+
109
+ return openssl_get_cipher_methods();
110
+ }
111
+
112
+ public function getOpensslVersion()
113
+ {
114
+ if (defined('OPENSSL_VERSION_TEXT'))
115
+ {
116
+ return OPENSSL_VERSION_TEXT;
117
+ }
118
+ }
119
  }
app/code/community/Yireo/Mpi/Model/Resource/Php/Basics.php CHANGED
@@ -32,6 +32,7 @@ class Yireo_Mpi_Model_Resource_Php_Basics extends Yireo_Mpi_Model_Resource_Abstr
32
  $result[] = $this->getMetric('resource_usage', $this->getResourceUsage(), 'array');
33
  $result[] = $this->getMetric('memory_usage', $this->getMemoryUsage(), 'bytes');
34
  $result[] = $this->getMetric('load_average', $this->getLoadAverage(), 'array');
 
35
 
36
  return $result;
37
  }
32
  $result[] = $this->getMetric('resource_usage', $this->getResourceUsage(), 'array');
33
  $result[] = $this->getMetric('memory_usage', $this->getMemoryUsage(), 'bytes');
34
  $result[] = $this->getMetric('load_average', $this->getLoadAverage(), 'array');
35
+ $result[] = $this->getMetric('date_default_timezone_get', date_default_timezone_get());
36
 
37
  return $result;
38
  }
app/code/community/Yireo/Mpi/Model/Resource/Php/Configuration.php CHANGED
@@ -66,7 +66,7 @@ class Yireo_Mpi_Model_Resource_Php_Configuration extends Yireo_Mpi_Model_Resourc
66
  'apc.shm_size' => 'bytes',
67
  'apc.stat' => 'bool',
68
  'opcache.enable' => 'bool',
69
- 'opcache.memory_consumption' => 'bytes',
70
  'opcache.revalidate_freq' => 'seconds',
71
  'opcache.validate_timestamps' => 'bool',
72
  'memcache.allow_failover' => 'bool',
@@ -82,6 +82,7 @@ class Yireo_Mpi_Model_Resource_Php_Configuration extends Yireo_Mpi_Model_Resourc
82
  'eaccelerator.check_mtime' => 'bool',
83
  'eaccelerator.shm_size' => 'bytes',
84
  'soap.wsdl_cache_enabled' => 'bool',
 
85
  );
86
  }
87
  }
66
  'apc.shm_size' => 'bytes',
67
  'apc.stat' => 'bool',
68
  'opcache.enable' => 'bool',
69
+ 'opcache.memory_consumption' => 'megabytes',
70
  'opcache.revalidate_freq' => 'seconds',
71
  'opcache.validate_timestamps' => 'bool',
72
  'memcache.allow_failover' => 'bool',
82
  'eaccelerator.check_mtime' => 'bool',
83
  'eaccelerator.shm_size' => 'bytes',
84
  'soap.wsdl_cache_enabled' => 'bool',
85
+ 'date.timezone' => 'string',
86
  );
87
  }
88
  }
app/code/community/Yireo/Mpi/Model/Resource/Security/Phpinfo.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Yireo Mpi for Magento
4
+ *
5
+ * @package Yireo_Mpi
6
+ * @author Yireo (http://www.yireo.com/)
7
+ * @copyright Copyright 2015 Yireo (http://www.yireo.com/)
8
+ * @license Open Source License (OSL v3)
9
+ */
10
+
11
+ /**
12
+ * Security check to check for possible phpinfo() files
13
+ */
14
+ class Yireo_Mpi_Model_Resource_Security_Phpinfo extends Yireo_Mpi_Model_Resource_Abstract
15
+ {
16
+ public function getData()
17
+ {
18
+ return array(
19
+ $this->getMetricFromCallback('phpinfo_files', 'scanPhpInfoFiles', 'array'),
20
+ );
21
+ }
22
+
23
+ public function scanPhpInfoFiles()
24
+ {
25
+ $phpInfoFiles = array();
26
+ $phpFiles = glob(BP.'/*.php');
27
+
28
+ foreach($phpFiles as $phpFile) {
29
+ $phpContents = file_get_contents($phpFile);
30
+ if (strstr($phpContents, 'phpinfo()')) {
31
+ $phpInfoFiles[] = $phpFile;
32
+ }
33
+ }
34
+
35
+ return $phpInfoFiles;
36
+ }
37
+ }
app/code/community/Yireo/Mpi/Model/Resource/Webserver/Basics.php CHANGED
@@ -23,7 +23,8 @@ class Yireo_Mpi_Model_Resource_Webserver_Basics extends Yireo_Mpi_Model_Resource
23
  $result = array();
24
 
25
  $result[] = $this->getMetric('sapi', $this->getSapi());
26
- $result[] = $this->getMetric('apache_version', $this->getApacheVersion());
 
27
  $result[] = $this->getMetric('system_memory', $this->getSystemMemory(), 'bytes');
28
 
29
  return $result;
@@ -34,7 +35,14 @@ class Yireo_Mpi_Model_Resource_Webserver_Basics extends Yireo_Mpi_Model_Resource
34
  return php_sapi_name();
35
  }
36
 
37
- protected function getApacheVersion()
 
 
 
 
 
 
 
38
  {
39
  if (function_exists('apache_get_version')) {
40
  return apache_get_version();
23
  $result = array();
24
 
25
  $result[] = $this->getMetric('sapi', $this->getSapi());
26
+ $result[] = $this->getMetric('webserver_type', $this->getWebserverType());
27
+ $result[] = $this->getMetric('webserver_version', $this->getWebserverVersion());
28
  $result[] = $this->getMetric('system_memory', $this->getSystemMemory(), 'bytes');
29
 
30
  return $result;
35
  return php_sapi_name();
36
  }
37
 
38
+ protected function getWebserverType()
39
+ {
40
+ if (isset($_SERVER['SERVER_SOFTWARE'])) {
41
+ return $_SERVER['SERVER_SOFTWARE'];
42
+ }
43
+ }
44
+
45
+ protected function getWebserverVersion()
46
  {
47
  if (function_exists('apache_get_version')) {
48
  return apache_get_version();
app/code/community/Yireo/Mpi/etc/config.xml CHANGED
@@ -13,12 +13,11 @@
13
 
14
  <modules>
15
  <Yireo_Mpi>
16
- <version>0.2.1</version>
17
  </Yireo_Mpi>
18
  </modules>
19
 
20
  <global>
21
-
22
  <blocks>
23
  <mpi>
24
  <class>Yireo_Mpi_Block</class>
@@ -36,7 +35,6 @@
36
  <class>Yireo_Mpi_Model</class>
37
  </mpi>
38
  </models>
39
-
40
  </global>
41
 
42
  <adminhtml>
13
 
14
  <modules>
15
  <Yireo_Mpi>
16
+ <version>0.2.4</version>
17
  </Yireo_Mpi>
18
  </modules>
19
 
20
  <global>
 
21
  <blocks>
22
  <mpi>
23
  <class>Yireo_Mpi_Block</class>
35
  <class>Yireo_Mpi_Model</class>
36
  </mpi>
37
  </models>
 
38
  </global>
39
 
40
  <adminhtml>
app/code/community/Yireo/Mpi/etc/system.xml CHANGED
@@ -21,7 +21,7 @@
21
  <label>Magento Performance Insights</label>
22
  <tab>yireo</tab>
23
  <frontend_type>text</frontend_type>
24
- <sort_order>1</sort_order>
25
  <show_in_default>1</show_in_default>
26
  <show_in_website>1</show_in_website>
27
  <show_in_store>1</show_in_store>
@@ -34,6 +34,15 @@
34
  <show_in_website>1</show_in_website>
35
  <show_in_store>1</show_in_store>
36
  <fields>
 
 
 
 
 
 
 
 
 
37
  <enabled translate="label">
38
  <label>Enable</label>
39
  <frontend_type>select</frontend_type>
21
  <label>Magento Performance Insights</label>
22
  <tab>yireo</tab>
23
  <frontend_type>text</frontend_type>
24
+ <sort_order>100</sort_order>
25
  <show_in_default>1</show_in_default>
26
  <show_in_website>1</show_in_website>
27
  <show_in_store>1</show_in_store>
34
  <show_in_website>1</show_in_website>
35
  <show_in_store>1</show_in_store>
36
  <fields>
37
+ <version translate="label">
38
+ <label>Version</label>
39
+ <frontend_type>text</frontend_type>
40
+ <frontend_model>mpi/system_config_form_field_version</frontend_model>
41
+ <sort_order>0</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ </version>
46
  <enabled translate="label">
47
  <label>Enable</label>
48
  <frontend_type>select</frontend_type>
package.xml CHANGED
@@ -1,2 +1,2 @@
1
  <?xml version="1.0"?>
2
- <package><name>Yireo_Mpi</name><version>0.2.1</version><stability>stable</stability><license>Open Source License</license><channel>community</channel><extends></extends><summary>No summary</summary><description>No description</description><notes>No notes</notes><authors><author><name>Yireo</name><user>yireo</user><email>info@yireo.com</email></author></authors><date>2015-09-05</date><time>3:13:26</time><compatible></compatible><dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><file name="yireo_mpi.php" hash="bb5c49394dabd9e50200b762776d70a3"/><dir name="app"><dir name="etc"><dir name="modules"><file name="Yireo_Mpi.xml" hash="2e4b22d73860a18fbe666da141734a54"/></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="mpi"><file name="menu.phtml" hash="dd51715d4ef2c04bdad992be151df793"/><file name="overview.phtml" hash="a56f2ab6086dfb77ae384ba28a4a2a12"/></dir></dir></dir></dir></dir></dir><dir name="code"><dir name="community"><dir name="Yireo"><dir name="Mpi"><dir name="etc"><file name="config.xml" hash="269c6a26ed21cb915c9e14618a0586d9"/><file name="system.xml" hash="7a00cf11f89a68142d9e37bd6ee763e4"/></dir><dir name="controllers"><file name="IndexController.php" hash="1bf39a8f1e5832bfb63993f50e0f4eb5"/><file name="MpiController.php" hash="5b9be0ce017f5249c142757c1b69cf84"/></dir><dir name="Model"><file name="Check.php" hash="7b2c6fae95ba46cb0715ae2d56f5a001"/><file name="Metric.php" hash="17fbdeb50425f8d1c3e2a010d7d17882"/><file name="Resource.php" hash="1521766bd0eb5c9b66e28d302bfa07d5"/><dir name="Resource"><file name="Abstract.php" hash="cf5677ed01658d94976cf698a820945c"/><file name="Test.php" hash="a88a9ccb6e7b083f7ee15e0ff056c9d9"/><dir name="Webserver"><file name="Advanced.php" hash="e7dd54e341f1bee882ccd45b3780c628"/><file name="Basics.php" hash="e96e9692f7a758af456ca925a42f665b"/></dir><dir name="Security"><file name="Addhandler.php" hash="7f454d7fdeedd5fbb2019d6612b40110"/><file name="Admin.php" hash="0b3a3f6ff9997d567bc745c76d9222c4"/><file name="Get.php" hash="3944bc667c4d5f577d6dc4cc9e627e58"/><file name="Shoplift.php" hash="2e9ca69f18fddbe1544459d56d838730"/><file name="Xmlrpc.php" hash="fc06937f8b03b8f00904a8ed2552a5c1"/></dir><dir name="Php"><file name="Basics.php" hash="efba5cdd43b07a85982125d944a91b17"/><file name="Configuration.php" hash="87a7e9838c5bdc36120284d86df582da"/><file name="Module.php" hash="4d97ae354f405b11458f1599f258ba43"/></dir><dir name="Environment"><file name="Basics.php" hash="beb5f1b28a015918890df493a3b2a754"/><file name="Log.php" hash="bf1decdbc7e2c825df4edf8e1adf725e"/><file name="Report.php" hash="07e3acbde52f416cd42369d470580fd4"/><file name="Session.php" hash="eb4986c14cb43b6f748b27fbb120b87a"/></dir><dir name="Database"><file name="Abstract.php" hash="c1b088a9f1c629d75aa231c25eb5cb4d"/><file name="Basics.php" hash="75f4e42388fa0f6cd312b6c0a025c82a"/><file name="Status.php" hash="892387946ab77756902f1a302e50ca1a"/><file name="Table.php" hash="60709eb8a5aeef4611ee0c14c5e88f17"/><file name="Variable.php" hash="ad2f908d77ea2de93a0b0b4aabd43ecd"/></dir><dir name="Core"><file name="Attribute.php" hash="ba202bbf05ca97793ab86b450d4de999"/><file name="Cache.php" hash="ba30d154382f46056fe9b840846c6780"/><file name="Catalog.php" hash="a6d0af0d22124a8f030d090bea85988f"/><file name="Compiler.php" hash="1c6ccbb511624d1644d249cf15ba5214"/><file name="Configuration.php" hash="33aa0351d4d2561f35192d839584c92c"/><file name="Customer.php" hash="482ad24019e1da6d54078f6b68d469b9"/><file name="Indexer.php" hash="c849098086375023d4158f87c5751796"/><file name="Module.php" hash="96314ec114c5e7031c782db8c03ae911"/><file name="Rules.php" hash="3ca63ef6b2b364ed01671db23cae7b8d"/><file name="Sales.php" hash="0ecd789810edac31a460797cc2f8e5d1"/><file name="Session.php" hash="23b193caa531a2b98f6f060f17e2cf9b"/><file name="Store.php" hash="6281137b79bc50defdd93ab119d1b288"/><file name="Version.php" hash="20801101ff1e064ad7148a09e813dfe8"/></dir></dir><dir name="Check"><file name="Abstract.php" hash="1ba6d0d8283d80f51371da3b25e94219"/><file name="Enabled.php" hash="0f21e750a87747dc5aef0c4a91119241"/><file name="EntryFile.php" hash="479ecb60fe22941b04a20fd093980f1f"/><file name="Secret.php" hash="0ad533697d9167e5a790b3ed70ee9d9b"/><file name="Version.php" hash="800cf91236295a4033c8e2618fafeefb"/></dir></dir><dir name="Helper"><file name="Data.php" hash="9b6f4db420478e84c4af528e10b02361"/></dir><dir name="Block"><file name="Menu.php" hash="615ee2d005267072ab06db70cc6f0e95"/><file name="Overview.php" hash="f2790ca6e95600d0d08e4aee63c7ce1e"/></dir></dir></dir></dir></dir></dir></target></contents></package>
1
  <?xml version="1.0"?>
2
+ <package><name>Yireo_Mpi</name><version>0.2.4</version><stability>stable</stability><license>Open Source License</license><channel>community</channel><extends></extends><summary>No summary</summary><description>No description</description><notes>No notes</notes><authors><author><name>Yireo</name><user>yireo</user><email>info@yireo.com</email></author></authors><date>2015-10-31</date><time>8:25:54</time><compatible></compatible><dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><file name="yireo_mpi.php" hash="68ce3db69f9c3b2ae4b4f9083b8b1c2f"/><dir name="app"><dir name="etc"><dir name="modules"><file name="Yireo_Mpi.xml" hash="2e4b22d73860a18fbe666da141734a54"/></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="mpi"><file name="menu.phtml" hash="dd51715d4ef2c04bdad992be151df793"/><file name="overview.phtml" hash="a56f2ab6086dfb77ae384ba28a4a2a12"/></dir></dir></dir></dir></dir></dir><dir name="code"><dir name="community"><dir name="Yireo"><dir name="Mpi"><dir name="etc"><file name="config.xml" hash="2c7817c6defbc37fb54d176b9fd96b43"/><file name="system.xml" hash="de046cbbd9b518168fa0c4c088a86dd1"/></dir><dir name="controllers"><file name="IndexController.php" hash="1bf39a8f1e5832bfb63993f50e0f4eb5"/><file name="MpiController.php" hash="5b9be0ce017f5249c142757c1b69cf84"/></dir><dir name="Model"><file name="Check.php" hash="7b2c6fae95ba46cb0715ae2d56f5a001"/><file name="Metric.php" hash="43bff7c27723222daef9e23e392112bc"/><file name="Resource.php" hash="55dd0b2d3f85267378d98ef0b0eeaa8a"/><dir name="Resource"><file name="Abstract.php" hash="cf5677ed01658d94976cf698a820945c"/><file name="Test.php" hash="a88a9ccb6e7b083f7ee15e0ff056c9d9"/><dir name="Webserver"><file name="Advanced.php" hash="e7dd54e341f1bee882ccd45b3780c628"/><file name="Basics.php" hash="5df164e688d330bf6c151088a0302900"/></dir><dir name="Security"><file name="Addhandler.php" hash="7f454d7fdeedd5fbb2019d6612b40110"/><file name="Admin.php" hash="0b3a3f6ff9997d567bc745c76d9222c4"/><file name="Get.php" hash="3944bc667c4d5f577d6dc4cc9e627e58"/><file name="Phpinfo.php" hash="18ec76b3f63b95f0d49371b5638947e8"/><file name="Shoplift.php" hash="2e9ca69f18fddbe1544459d56d838730"/><file name="Xmlrpc.php" hash="fc06937f8b03b8f00904a8ed2552a5c1"/></dir><dir name="Php"><file name="Basics.php" hash="1002b476bf1f6ce978fa4c271dc761fd"/><file name="Configuration.php" hash="7d812002ba2e5d879b35049b64be1a39"/><file name="Module.php" hash="4d97ae354f405b11458f1599f258ba43"/></dir><dir name="Environment"><file name="Basics.php" hash="da840438f2f33c33afbc5a62ad88c989"/><file name="Log.php" hash="bf1decdbc7e2c825df4edf8e1adf725e"/><file name="Report.php" hash="07e3acbde52f416cd42369d470580fd4"/><file name="Session.php" hash="eb4986c14cb43b6f748b27fbb120b87a"/></dir><dir name="Database"><file name="Abstract.php" hash="c1b088a9f1c629d75aa231c25eb5cb4d"/><file name="Basics.php" hash="75f4e42388fa0f6cd312b6c0a025c82a"/><file name="Status.php" hash="892387946ab77756902f1a302e50ca1a"/><file name="Table.php" hash="60709eb8a5aeef4611ee0c14c5e88f17"/><file name="Variable.php" hash="ad2f908d77ea2de93a0b0b4aabd43ecd"/></dir><dir name="Core"><file name="Attribute.php" hash="d6d31762055bd131ff5f2d3775836d82"/><file name="Cache.php" hash="ba30d154382f46056fe9b840846c6780"/><file name="Catalog.php" hash="a6d0af0d22124a8f030d090bea85988f"/><file name="Compiler.php" hash="1c6ccbb511624d1644d249cf15ba5214"/><file name="Configuration.php" hash="0311b6149aa969215f225e87e774e90d"/><file name="Customer.php" hash="482ad24019e1da6d54078f6b68d469b9"/><file name="Indexer.php" hash="c849098086375023d4158f87c5751796"/><file name="Module.php" hash="96314ec114c5e7031c782db8c03ae911"/><file name="Rules.php" hash="3ca63ef6b2b364ed01671db23cae7b8d"/><file name="Sales.php" hash="0ecd789810edac31a460797cc2f8e5d1"/><file name="Session.php" hash="23b193caa531a2b98f6f060f17e2cf9b"/><file name="Store.php" hash="6281137b79bc50defdd93ab119d1b288"/><file name="Version.php" hash="20801101ff1e064ad7148a09e813dfe8"/></dir><dir name="Attribute"><file name="Listing.php" hash="0121b3504c9e5fa3742beccab31e369b"/></dir></dir><dir name="Check"><file name="Abstract.php" hash="1ba6d0d8283d80f51371da3b25e94219"/><file name="Enabled.php" hash="0f21e750a87747dc5aef0c4a91119241"/><file name="EntryFile.php" hash="479ecb60fe22941b04a20fd093980f1f"/><file name="Secret.php" hash="0ad533697d9167e5a790b3ed70ee9d9b"/><file name="Version.php" hash="800cf91236295a4033c8e2618fafeefb"/></dir></dir><dir name="Helper"><file name="Data.php" hash="6976678779293e1556ead9e42c80afeb"/></dir><dir name="Block"><file name="Menu.php" hash="615ee2d005267072ab06db70cc6f0e95"/><file name="Overview.php" hash="f2790ca6e95600d0d08e4aee63c7ce1e"/><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Version.php" hash="7e2e032a6b84edfcfeaee2e9841f3617"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir></target></contents></package>
yireo_mpi.php CHANGED
@@ -72,9 +72,21 @@ class YireoMpi
72
 
73
  $data['init'] = $this->metrics;
74
 
75
- header('Content-Type: application/json', true);
76
- echo Mage::helper('core')->jsonEncode($data);
77
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
78
  }
79
 
80
  protected function getResponse()
72
 
73
  $data['init'] = $this->metrics;
74
 
75
+ $format = Mage::app()->getRequest()->getParam('format');
76
+ if (empty($format)) {
77
+ $format = 'json';
78
+ }
79
+
80
+ if ($format == 'json') {
81
+ header('Content-Type: application/json', true);
82
+ echo Mage::helper('core')->jsonEncode($data);
83
+ exit;
84
+
85
+ } elseif ($format == 'dump') {
86
+ Mage::app()->getResponse()->setHeader('Content-type', 'text/html', true);
87
+ ini_set('xdebug.var_display_max_children', 1024);
88
+ Zend_Debug::dump($data);
89
+ }
90
  }
91
 
92
  protected function getResponse()