Magespeedtest_Speedtest - Version 0.0.3

Version Notes

0.0.1 - initial release. Helps users create sitemap.xml and redirect to MageSpeedTest.com, pre-populating the required fields for easy testing.

0.0.2 - Released to Magento Connect

0.0.3 - Add basic monitoring API import.

Download this release

Release Info

Developer Magento Core Team
Extension Magespeedtest_Speedtest
Version 0.0.3
Comparing to
See all releases


Code changes from version 0.0.2 to 0.0.3

app/code/community/Magespeedtest/Speedtest/Block/View.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Ashley Schroder (aschroder.com)
4
+ * @copyright Copyright (c) 2010 Ashley Schroder
5
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
6
+ */
7
+
8
+ class Magespeedtest_Speedtest_Block_View extends Mage_Adminhtml_Block_Widget_Grid_Container {
9
+
10
+ /**
11
+ * Block constructor
12
+ */
13
+ public function __construct() {
14
+ $this->_blockGroup = 'magespeedtest';
15
+ $this->_controller = 'view';
16
+ $this->_headerText = Mage::helper('cms')->__('Performance Monitoring');
17
+ parent::__construct();
18
+
19
+ // Remove the add button
20
+ $this->_removeButton('add');
21
+ }
22
+ }
app/code/community/Magespeedtest/Speedtest/Block/View/Grid.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Ashley Schroder (aschroder.com)
5
+ * @copyright Copyright (c) 2010 Ashley Schroder
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+
9
+ class Magespeedtest_Speedtest_Block_View_Grid extends Mage_Adminhtml_Block_Widget_Grid {
10
+
11
+ const API_URL = 'admin/magespeedtest/apiurl';
12
+
13
+ public function __construct() {
14
+ parent::__construct();
15
+ $this->setId('performanceMonitoringGrid');
16
+ $this->setDefaultSort('time');
17
+ $this->setDefaultDir('ASC');
18
+
19
+ $this->setPagerVisibility(false);
20
+ $this->setFilterVisibility(false);
21
+ }
22
+
23
+ protected function _prepareCollection() {
24
+
25
+ // Start with an empty faux collection
26
+ $collection = new Magespeedtest_Speedtest_Model_Collection();
27
+
28
+ $url = Mage::getStoreConfig(self::API_URL);
29
+
30
+ if ($url) {
31
+ $xml = simplexml_load_file($url);
32
+ if ($xml) {
33
+ $results = $xml->results->result;
34
+
35
+ foreach ($results as $result) {
36
+
37
+ $obj = new Varien_Object();
38
+ $obj->setData('time', new Zend_Date(($result->timestamp/1000), Zend_Date::TIMESTAMP));
39
+ $obj->setData('alert', $result->alert->__toString());
40
+ $obj->setData('transPerSecond', $result->transPerSecond->__toString());
41
+ $obj->setData('secondsPerTrans', $result->secondsPerTrans->__toString());
42
+ $obj->setData('testUrl', $result->testUrl->__toString());
43
+ $collection->addItem($obj);
44
+ }
45
+ }
46
+
47
+ }
48
+
49
+ $this->setCollection($collection);
50
+ return parent::_prepareCollection();
51
+ }
52
+
53
+ protected function _prepareColumns() {
54
+ $this->addColumn('time', array(
55
+ 'header' => Mage::helper('adminhtml')->__('Time'),
56
+ 'width' => '80px',
57
+ 'index' => 'time',
58
+ 'sortable' => false,
59
+ 'filter' => false
60
+ ));
61
+ $this->addColumn('transPerSecond', array(
62
+ 'header' => Mage::helper('adminhtml')->__('Throughput (transactions/s)'),
63
+ 'width' => '40px',
64
+ 'index' => 'transPerSecond',
65
+ 'sortable' => false,
66
+ 'filter' => false
67
+ ));
68
+ $this->addColumn('secondsPerTrans', array(
69
+ 'header' => Mage::helper('adminhtml')->__('Time per transaction (s)'),
70
+ 'width' => '40px',
71
+ 'index' => 'secondsPerTrans',
72
+ 'sortable' => false,
73
+ 'filter' => false
74
+ ));
75
+ $this->addColumn('view', array(
76
+ 'header' => Mage::helper('adminhtml')->__('View'),
77
+ 'format' => '<a target="_blank" href="' . '$testUrl' .'">View</a> ',
78
+ 'index' => 'type',
79
+ 'width' => '20px',
80
+ 'sortable' => false,
81
+ 'filter' => false
82
+ ));
83
+
84
+ return parent::_prepareColumns();
85
+ }
86
+
87
+ public function getRowClass($_item) {
88
+ // Make alert rows class 'invalid'.
89
+ if ($_item && $_item['alert'] == "true") {
90
+ return "invalid";
91
+ } else {
92
+ return parent::getRowClass($_item);
93
+ }
94
+ }
95
+
96
+ public function getResetFilterButtonHtml() {
97
+ // no reset
98
+ }
99
+
100
+ public function getSearchButtonHtml() {
101
+ // no search
102
+ }
103
+
104
+ }
app/code/community/Magespeedtest/Speedtest/Model/Collection.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Ashley Schroder (aschroder.com)
5
+ * @copyright Copyright (c) 2010 Ashley Schroder
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ *
8
+ * Faux collection that wraps the XML response from the API.
9
+ */
10
+
11
+ class Magespeedtest_Speedtest_Model_Collection extends Varien_Data_Collection {
12
+
13
+ // This is just a little hack to get the collection working properly.
14
+ public function addItem(Varien_Object $item) {
15
+ parent::addItem($item);
16
+ $this->_totalRecords = $this->_totalRecords + 1;
17
+ }
18
+
19
+ }
app/code/community/Magespeedtest/Speedtest/controllers/PerformanceController.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Ashley Schroder (aschroder.com)
5
+ * @copyright Copyright (c) 2010 Ashley Schroder
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+
9
+ class Magespeedtest_Speedtest_PerformanceController
10
+ extends Mage_Adminhtml_Controller_Action {
11
+
12
+ protected function _initAction() {
13
+ // load layout, set active menu and breadcrumbs
14
+ $this->loadLayout()
15
+ ->_setActiveMenu('system/tools')
16
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('System'), Mage::helper('adminhtml')->__('System'))
17
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Tools'), Mage::helper('adminhtml')->__('Tools'))
18
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Performance Monitoring'), Mage::helper('adminhtml')->__('Performance Monitoring'));
19
+ return $this;
20
+ }
21
+
22
+ public function indexAction() {
23
+ $this->_initAction()
24
+ ->_addContent($this->getLayout()->createBlock('magespeedtest/view', 'view'))
25
+ ->renderLayout();
26
+ }
27
+
28
+ }
app/code/community/Magespeedtest/Speedtest/etc/config.xml CHANGED
@@ -10,7 +10,7 @@
10
  -->
11
  <modules>
12
  <Magespeedtest_Speedtest>
13
- <version>0.0.2</version>
14
  </Magespeedtest_Speedtest>
15
  </modules>
16
  <global>
@@ -24,7 +24,39 @@
24
  <class>Magespeedtest_Speedtest_Helper</class>
25
  </magespeedtest>
26
  </helpers>
 
 
 
 
 
27
  </global>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  <default>
29
  <magespeedtest>
30
  <settings>
10
  -->
11
  <modules>
12
  <Magespeedtest_Speedtest>
13
+ <version>0.0.3</version>
14
  </Magespeedtest_Speedtest>
15
  </modules>
16
  <global>
24
  <class>Magespeedtest_Speedtest_Helper</class>
25
  </magespeedtest>
26
  </helpers>
27
+ <blocks>
28
+ <magespeedtest>
29
+ <class>Magespeedtest_Speedtest_Block</class>
30
+ </magespeedtest>
31
+ </blocks>
32
  </global>
33
+ <admin>
34
+ <routers>
35
+ <magespeedtest>
36
+ <use>admin</use>
37
+ <args>
38
+ <module>Magespeedtest_Speedtest</module>
39
+ <frontName>magespeedtest</frontName>
40
+ </args>
41
+ </magespeedtest>
42
+ </routers>
43
+ </admin>
44
+ <adminhtml>
45
+ <menu>
46
+ <system>
47
+ <children>
48
+ <tools>
49
+ <children>
50
+ <magespeedtest translate="title" module="magespeedtest">
51
+ <title>Performance</title>
52
+ <action>magespeedtest/performance</action>
53
+ </magespeedtest>
54
+ </children>
55
+ </tools>
56
+ </children>
57
+ </system>
58
+ </menu>
59
+ </adminhtml>
60
  <default>
61
  <magespeedtest>
62
  <settings>
app/code/community/Magespeedtest/Speedtest/etc/system.xml CHANGED
@@ -36,6 +36,15 @@
36
  <show_in_website>0</show_in_website>
37
  <show_in_store>0</show_in_store>
38
  </test>
 
 
 
 
 
 
 
 
 
39
  </fields>
40
  </magespeedtest>
41
  </groups>
36
  <show_in_website>0</show_in_website>
37
  <show_in_store>0</show_in_store>
38
  </test>
39
+ <apiurl translate="label">
40
+ <label>Monitor API URL</label>
41
+ <comment>To enable performance monitoring, copy and paste your API url from the monitor page into this box.</comment>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>40</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>0</show_in_website>
46
+ <show_in_store>0</show_in_store>
47
+ </apiurl>
48
  </fields>
49
  </magespeedtest>
50
  </groups>
package.xml CHANGED
@@ -1,20 +1,24 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Magespeedtest_Speedtest</name>
4
- <version>0.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>MageSpeedTest.com is a free service to simulate multiple customers on your webstore and test the speed.</summary>
10
- <description>MageSpeedTest.com is a free service to simulate multiple customers on your webstore and test the speed. This extension will help you create your sitemap.xml file and run your first test.</description>
 
 
11
  <notes>0.0.1 - initial release. Helps users create sitemap.xml and redirect to MageSpeedTest.com, pre-populating the required fields for easy testing.&#xD;
12
  &#xD;
13
- 0.0.2 - Released to Magento Connect</notes>
 
 
14
  <authors><author><name>Ashley Schroder</name><user>auto-converted</user><email>ashley.schroder@gmail.com</email></author></authors>
15
- <date>2012-07-22</date>
16
- <time>05:43:10</time>
17
- <contents><target name="magecommunity"><dir name="Magespeedtest"><dir name="Speedtest"><dir name="Block"><dir name="Adminhtml"><file name="Test.php" hash="dd7669eac084481d58d2573751663dc3"/></dir></dir><dir name="Helper"><file name="Data.php" hash="4ddfb52f3b7ca6684169bbfdf86bb4c2"/></dir><dir name="etc"><file name="config.xml" hash="43bad2fb4cecbce257d92487b82c9052"/><file name="system.xml" hash="11fd7a35e80fcc4815fe458e736b91ce"/></dir><dir name="modules"><file name="Magespeedtest_Speedtest.xml" hash="ee97f56a9f80c45d8df8697290a6038c"/></dir><file name="modman" hash="01bf71ab8639ce99e35d4867b95dc579"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magespeedtest_Speedtest.xml" hash="ee97f56a9f80c45d8df8697290a6038c"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies/>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Magespeedtest_Speedtest</name>
4
+ <version>0.0.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>MageSpeedTest.com is a free service to simulate multiple customers on your webstore and test the speed.</summary>
10
+ <description>MageSpeedTest.com is a free service to simulate multiple customers on your webstore and test the speed. This extension will help you create your sitemap.xml file and run your first test.&#xD;
11
+ &#xD;
12
+ If you monitor your store performance you can import the results into your Magento dashboard using the monitoring API.</description>
13
  <notes>0.0.1 - initial release. Helps users create sitemap.xml and redirect to MageSpeedTest.com, pre-populating the required fields for easy testing.&#xD;
14
  &#xD;
15
+ 0.0.2 - Released to Magento Connect&#xD;
16
+ &#xD;
17
+ 0.0.3 - Add basic monitoring API import.</notes>
18
  <authors><author><name>Ashley Schroder</name><user>auto-converted</user><email>ashley.schroder@gmail.com</email></author></authors>
19
+ <date>2012-08-19</date>
20
+ <time>09:10:55</time>
21
+ <contents><target name="magecommunity"><dir name="Magespeedtest"><dir name="Speedtest"><dir name="Block"><dir name="Adminhtml"><file name="Test.php" hash="dd7669eac084481d58d2573751663dc3"/></dir><dir name="View"><file name="Grid.php" hash="bb9c1c6cbb9aad34156a484965d86fa1"/></dir><file name="View.php" hash="bc5c95ae336e5435224a7c8e7892bbb2"/></dir><dir name="Helper"><file name="Data.php" hash="4ddfb52f3b7ca6684169bbfdf86bb4c2"/></dir><dir name="Model"><file name="Collection.php" hash="f8a395832d80bee84ddcff1bfaf3e750"/></dir><dir name="controllers"><file name="PerformanceController.php" hash="da9c3cc4f6128354fc066dbcbd0c5f3e"/></dir><dir name="etc"><file name="config.xml" hash="ce0284a28b326c7b6268809641c485b5"/><file name="system.xml" hash="1063249fc8ce1aa4a224c0b8f4128316"/></dir><dir name="modules"><file name="Magespeedtest_Speedtest.xml" hash="ee97f56a9f80c45d8df8697290a6038c"/></dir><file name="modman" hash="01bf71ab8639ce99e35d4867b95dc579"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magespeedtest_Speedtest.xml" hash="ee97f56a9f80c45d8df8697290a6038c"/></dir></target></contents>
22
  <compatible/>
23
  <dependencies/>
24
  </package>