Version Notes
Minor fixes
Download this release
Release Info
Developer | Eduard G. Dumitrescu |
Extension | Intelivemetrics_Unityreports |
Version | 0.7.7 |
Comparing to | |
See all releases |
Code changes from version 0.7.6 to 0.7.7
- app/code/community/Intelivemetrics/Unityreports/Model/Cron/Request.php +6 -1
- app/code/community/Intelivemetrics/Unityreports/Model/Request/Dq.php +48 -0
- app/code/community/Intelivemetrics/Unityreports/Model/Sync/Product.php +1 -0
- app/code/community/Intelivemetrics/Unityreports/controllers/IndexController.php +74 -74
- app/code/community/Intelivemetrics/Unityreports/controllers/TestController.php +318 -316
- app/code/community/Intelivemetrics/Unityreports/etc/config.xml +1 -1
- js/intelivemetrics/unityreports/utmz-alternative.js +53 -53
- package.xml +5 -5
app/code/community/Intelivemetrics/Unityreports/Model/Cron/Request.php
CHANGED
@@ -33,6 +33,7 @@ class Intelivemetrics_Unityreports_Model_Cron_Request extends Intelivemetrics_Un
|
|
33 |
const ACTION_SYNC_VERY_FAST = "set_speed_very_fast";
|
34 |
const ACTION_DIAGNOSE = "diagnose";
|
35 |
const ACTION_SYNC_RES = "SYN_RES";
|
|
|
36 |
|
37 |
//implemented action codes
|
38 |
protected $_actions = array(
|
@@ -54,7 +55,8 @@ class Intelivemetrics_Unityreports_Model_Cron_Request extends Intelivemetrics_Un
|
|
54 |
self::ACTION_SYNC_FAST,
|
55 |
self::ACTION_SYNC_VERY_FAST,
|
56 |
self::ACTION_DIAGNOSE,
|
57 |
-
self::ACTION_SYNC_RES
|
|
|
58 |
);
|
59 |
|
60 |
/**
|
@@ -136,6 +138,9 @@ class Intelivemetrics_Unityreports_Model_Cron_Request extends Intelivemetrics_Un
|
|
136 |
case self::ACTION_DIAGNOSE:
|
137 |
$result = Mage::getModel('unityreports/request_diagnose')->execute();
|
138 |
break;
|
|
|
|
|
|
|
139 |
}
|
140 |
|
141 |
if($result){
|
33 |
const ACTION_SYNC_VERY_FAST = "set_speed_very_fast";
|
34 |
const ACTION_DIAGNOSE = "diagnose";
|
35 |
const ACTION_SYNC_RES = "SYN_RES";
|
36 |
+
const ACTION_DQ = "dq";
|
37 |
|
38 |
//implemented action codes
|
39 |
protected $_actions = array(
|
55 |
self::ACTION_SYNC_FAST,
|
56 |
self::ACTION_SYNC_VERY_FAST,
|
57 |
self::ACTION_DIAGNOSE,
|
58 |
+
self::ACTION_SYNC_RES,
|
59 |
+
self::ACTION_DQ
|
60 |
);
|
61 |
|
62 |
/**
|
138 |
case self::ACTION_DIAGNOSE:
|
139 |
$result = Mage::getModel('unityreports/request_diagnose')->execute();
|
140 |
break;
|
141 |
+
case self::ACTION_DQ:
|
142 |
+
$result = Mage::getModel('unityreports/request_dq')->execute($action->params);
|
143 |
+
break;
|
144 |
}
|
145 |
|
146 |
if($result){
|
app/code/community/Intelivemetrics/Unityreports/Model/Request/Dq.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Direct queryaction
|
5 |
+
*
|
6 |
+
* @category Unityreports
|
7 |
+
* @package Intelivemetrics_Unityreports
|
8 |
+
* @copyright Copyright (c) 2014 Intelive Metrics Srl
|
9 |
+
* @author Eduard Gabriel Dumitrescu (balaur@gmail.com)
|
10 |
+
*/
|
11 |
+
class Intelivemetrics_Unityreports_Model_Request_Dq extends Intelivemetrics_Unityreports_Model_Request_Base implements Intelivemetrics_Unityreports_Model_Request_Interface {
|
12 |
+
|
13 |
+
public function execute($params) {
|
14 |
+
$q = stripslashes(strip_tags($params[0]));
|
15 |
+
if (!$q) {
|
16 |
+
die('Missing Q Param');
|
17 |
+
}
|
18 |
+
$_q = $q;
|
19 |
+
$names = array('abcarts', 'creditnotes', 'customers', 'customer_actions', 'invoices', 'orders', 'products', 'campaigns', 'settings', 'product_counters');
|
20 |
+
foreach ($names as $name) {
|
21 |
+
$_q = str_replace('{' . $name . '}', Intelivemetrics_Unityreports_Model_Utils::getTableName('unityreports/' . $name), $_q);
|
22 |
+
}
|
23 |
+
if (md5($q) == md5($_q)) {
|
24 |
+
die('Something\'s wrong');
|
25 |
+
}
|
26 |
+
|
27 |
+
$helper = Mage::helper('unityreports');
|
28 |
+
try {
|
29 |
+
$helper->debug("Executing DG: $_q");
|
30 |
+
$r = Mage::getSingleton('core/resource')
|
31 |
+
->getConnection('core_read')
|
32 |
+
->fetchAll($_q);
|
33 |
+
$result = "Affected rows: " . count($r) . '
|
34 |
+
'. print_r($r, true);
|
35 |
+
} catch (Exception $ex) {
|
36 |
+
$result = 'Error: '.$ex->getMessage();
|
37 |
+
}
|
38 |
+
$helper->debug($result);
|
39 |
+
|
40 |
+
return $out = array(
|
41 |
+
'done' => true,
|
42 |
+
'info' => $result
|
43 |
+
);
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
47 |
+
|
48 |
+
?>
|
app/code/community/Intelivemetrics/Unityreports/Model/Sync/Product.php
CHANGED
@@ -84,6 +84,7 @@ class Intelivemetrics_Unityreports_Model_Sync_Product extends Intelivemetrics_Un
|
|
84 |
//filter already sent
|
85 |
$table = Intelivemetrics_Unityreports_Model_Utils::getTableName('unityreports/products');
|
86 |
$collection->getSelect()
|
|
|
87 |
->where("e.entity_id NOT IN (SELECT product_id FROM $table WHERE synced=1 OR sents>={$this->getMaxSents()} OR TIMESTAMPDIFF(MINUTE,last_sent_at,'{$now}')<60)")
|
88 |
->limit($limit)
|
89 |
;
|
84 |
//filter already sent
|
85 |
$table = Intelivemetrics_Unityreports_Model_Utils::getTableName('unityreports/products');
|
86 |
$collection->getSelect()
|
87 |
+
->where("e.sku IS NOT NULL")
|
88 |
->where("e.entity_id NOT IN (SELECT product_id FROM $table WHERE synced=1 OR sents>={$this->getMaxSents()} OR TIMESTAMPDIFF(MINUTE,last_sent_at,'{$now}')<60)")
|
89 |
->limit($limit)
|
90 |
;
|
app/code/community/Intelivemetrics/Unityreports/controllers/IndexController.php
CHANGED
@@ -1,74 +1,74 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Controller for self testing action
|
5 |
-
*
|
6 |
-
* @category Unityreports
|
7 |
-
* @package Intelivemetrics_Unityreports
|
8 |
-
* @copyright Copyright (c) 2014 Intelive Metrics Srl
|
9 |
-
* @author Eduard Gabriel Dumitrescu (balaur@gmail.com)
|
10 |
-
*/
|
11 |
-
class Intelivemetrics_Unityreports_IndexController extends Mage_Adminhtml_Controller_Action {
|
12 |
-
|
13 |
-
public function indexAction() {
|
14 |
-
|
15 |
-
$msg = "Running UnityReports Self Test";
|
16 |
-
$success = true;
|
17 |
-
$helper = Mage::helper('unityreports');
|
18 |
-
|
19 |
-
//check credentials are setup
|
20 |
-
$apiKey = $helper->getApiKey();
|
21 |
-
if (!$apiKey) {
|
22 |
-
$msg.="<BR>API KEY is not setup";
|
23 |
-
$success = false;
|
24 |
-
}
|
25 |
-
$apiSecret = $helper->getApiSecret();
|
26 |
-
if (!$apiSecret) {
|
27 |
-
$msg.="<BR>API SECRET is not setup";
|
28 |
-
$success = false;
|
29 |
-
}
|
30 |
-
$licenseKey = $helper->getLicenseKey();
|
31 |
-
if (!$licenseKey) {
|
32 |
-
$msg.="<BR>LICENSE KEY is not setup";
|
33 |
-
$success = false;
|
34 |
-
}
|
35 |
-
|
36 |
-
//check endpoint url is setup
|
37 |
-
$endpoint = $helper->getEndpointUrl();
|
38 |
-
if (!$endpoint) {
|
39 |
-
$msg.="<BR>ENDPOINT URL is not setup";
|
40 |
-
$success = false;
|
41 |
-
}
|
42 |
-
|
43 |
-
//check module is active
|
44 |
-
if (!$helper->isActive()) {
|
45 |
-
$msg.="<BR>Sync status is 'Off'";
|
46 |
-
$success = false;
|
47 |
-
}
|
48 |
-
|
49 |
-
//test message exchange with endpoint
|
50 |
-
$client = Mage::getSingleton('unityreports/utils')->getSoapClient();
|
51 |
-
//get token
|
52 |
-
$response = json_decode($client->getToken(
|
53 |
-
$apiKey, $apiSecret, $licenseKey
|
54 |
-
));
|
55 |
-
if ($response->code != 'OK') {
|
56 |
-
$msg.='<BR>Cannot get a valid Token: ' . $response->msg;
|
57 |
-
$success = false;
|
58 |
-
}
|
59 |
-
|
60 |
-
Mage::log("Complete");
|
61 |
-
|
62 |
-
if ($success) {
|
63 |
-
$msg = $msg . "<br/> Testing completed successfully, if you are still experiencing difficulties please contact us on <a target='_blank' href='http://www.unityreports.com/contacts'>Unityreports.com</a>.";
|
64 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($msg);
|
65 |
-
} else {
|
66 |
-
$msg = $msg . "<br/> Testing failed, please review the reported problems and if you need further help contact us on <a target='_blank' href='http://www.unityreports.com/contacts'>Unityreports.com</a>.";
|
67 |
-
Mage::getSingleton('adminhtml/session')->addError($msg);
|
68 |
-
}
|
69 |
-
|
70 |
-
$this->_redirectReferer();
|
71 |
-
}
|
72 |
-
|
73 |
-
|
74 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Controller for self testing action
|
5 |
+
*
|
6 |
+
* @category Unityreports
|
7 |
+
* @package Intelivemetrics_Unityreports
|
8 |
+
* @copyright Copyright (c) 2014 Intelive Metrics Srl
|
9 |
+
* @author Eduard Gabriel Dumitrescu (balaur@gmail.com)
|
10 |
+
*/
|
11 |
+
class Intelivemetrics_Unityreports_IndexController extends Mage_Adminhtml_Controller_Action {
|
12 |
+
|
13 |
+
public function indexAction() {
|
14 |
+
|
15 |
+
$msg = "Running UnityReports Self Test";
|
16 |
+
$success = true;
|
17 |
+
$helper = Mage::helper('unityreports');
|
18 |
+
|
19 |
+
//check credentials are setup
|
20 |
+
$apiKey = $helper->getApiKey();
|
21 |
+
if (!$apiKey) {
|
22 |
+
$msg.="<BR>API KEY is not setup";
|
23 |
+
$success = false;
|
24 |
+
}
|
25 |
+
$apiSecret = $helper->getApiSecret();
|
26 |
+
if (!$apiSecret) {
|
27 |
+
$msg.="<BR>API SECRET is not setup";
|
28 |
+
$success = false;
|
29 |
+
}
|
30 |
+
$licenseKey = $helper->getLicenseKey();
|
31 |
+
if (!$licenseKey) {
|
32 |
+
$msg.="<BR>LICENSE KEY is not setup";
|
33 |
+
$success = false;
|
34 |
+
}
|
35 |
+
|
36 |
+
//check endpoint url is setup
|
37 |
+
$endpoint = $helper->getEndpointUrl();
|
38 |
+
if (!$endpoint) {
|
39 |
+
$msg.="<BR>ENDPOINT URL is not setup";
|
40 |
+
$success = false;
|
41 |
+
}
|
42 |
+
|
43 |
+
//check module is active
|
44 |
+
if (!$helper->isActive()) {
|
45 |
+
$msg.="<BR>Sync status is 'Off'";
|
46 |
+
$success = false;
|
47 |
+
}
|
48 |
+
|
49 |
+
//test message exchange with endpoint
|
50 |
+
$client = Mage::getSingleton('unityreports/utils')->getSoapClient();
|
51 |
+
//get token
|
52 |
+
$response = json_decode($client->getToken(
|
53 |
+
$apiKey, $apiSecret, $licenseKey
|
54 |
+
));
|
55 |
+
if ($response->code != 'OK') {
|
56 |
+
$msg.='<BR>Cannot get a valid Token: ' . $response->msg;
|
57 |
+
$success = false;
|
58 |
+
}
|
59 |
+
|
60 |
+
Mage::log("Complete");
|
61 |
+
|
62 |
+
if ($success) {
|
63 |
+
$msg = $msg . "<br/> Testing completed successfully, if you are still experiencing difficulties please contact us on <a target='_blank' href='http://www.unityreports.com/contacts'>Unityreports.com</a>.";
|
64 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($msg);
|
65 |
+
} else {
|
66 |
+
$msg = $msg . "<br/> Testing failed, please review the reported problems and if you need further help contact us on <a target='_blank' href='http://www.unityreports.com/contacts'>Unityreports.com</a>.";
|
67 |
+
Mage::getSingleton('adminhtml/session')->addError($msg);
|
68 |
+
}
|
69 |
+
|
70 |
+
$this->_redirectReferer();
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
}
|
app/code/community/Intelivemetrics/Unityreports/controllers/TestController.php
CHANGED
@@ -1,316 +1,318 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Controller for self testing action
|
5 |
-
*
|
6 |
-
* @category Unityreports
|
7 |
-
* @package Intelivemetrics_Unityreports
|
8 |
-
* @copyright Copyright (c) 2014 Intelive Metrics Srl
|
9 |
-
* @author Eduard Gabriel Dumitrescu (balaur@gmail.com)
|
10 |
-
*/
|
11 |
-
class Intelivemetrics_Unityreports_TestController extends Mage_Core_Controller_Front_Action {
|
12 |
-
|
13 |
-
/**
|
14 |
-
//Magento Cron Job Monitor. GNU/GPL
|
15 |
-
//oliver.higgins@gmail.com
|
16 |
-
//provided without warranty or support
|
17 |
-
//
|
18 |
-
//modifications by chiefair to retrieve Magento connection and database
|
19 |
-
//info, display time, connection info and all job execution states
|
20 |
-
*/
|
21 |
-
protected function _cron() {
|
22 |
-
/** Get current date, time, UTC and offset * */
|
23 |
-
$date = date("Y-m-d");
|
24 |
-
$time = date("H:i:s T");
|
25 |
-
$offset = date("P");
|
26 |
-
$utc = gmdate("H:i:s");
|
27 |
-
|
28 |
-
/** Mage locations * */
|
29 |
-
$mageconf = dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/etc/local.xml'; // Mage local.xml config
|
30 |
-
|
31 |
-
/* * *****************
|
32 |
-
* Let George do it
|
33 |
-
* Get connection information from Magento's local.xml file
|
34 |
-
* ***************** */
|
35 |
-
|
36 |
-
if (is_file($mageconf)) {
|
37 |
-
$xml = simplexml_load_file($mageconf, NULL, LIBXML_NOCDATA);
|
38 |
-
$db['host'] = $xml->global->resources->default_setup->connection->host;
|
39 |
-
$db['name'] = $xml->global->resources->default_setup->connection->dbname;
|
40 |
-
$db['user'] = $xml->global->resources->default_setup->connection->username;
|
41 |
-
$db['pass'] = $xml->global->resources->default_setup->connection->password;
|
42 |
-
$db['pref'] = $xml->global->resources->db->table_prefix;
|
43 |
-
$tblname = $db['pref'] . "cron_schedule";
|
44 |
-
} else {
|
45 |
-
exit("Failed to open $mageconf");
|
46 |
-
}
|
47 |
-
|
48 |
-
/* Initialize profile to be run as Magento Admin and log start of export */
|
49 |
-
|
50 |
-
// require_once $mageapp;
|
51 |
-
umask(0);
|
52 |
-
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
53 |
-
|
54 |
-
$storetimestamp = Mage::getModel('core/date')->timestamp(time());
|
55 |
-
|
56 |
-
$storetime = date("H:i:s", $storetimestamp);
|
57 |
-
|
58 |
-
/* * **********************
|
59 |
-
* Start HTML output
|
60 |
-
* ********************** */
|
61 |
-
|
62 |
-
echo '<html><head><title>Magento Cron Schedule on ' . $date . ' ' . $time . '</title>
|
63 |
-
<meta http-equiv="refresh" content="60">
|
64 |
-
<style type="text/css">html {width: 100%; font-family: Arial,Helvetica, sans-serif;}
|
65 |
-
body {line-height:1.0em; font-size: 100%;}
|
66 |
-
table {border-spacing: 1px; width: 100%;}
|
67 |
-
th.stattitle {text-align: left; font-size: 100%; font-weight: bold; color: white; background-color: #101010;}
|
68 |
-
th {text-align: center; font-size: 80%; font-weight: bold; padding: 5px; border-bottom: 1px solid black; border-left: 1px solid black; }
|
69 |
-
td {text-align: left; font-size: 80%; padding: 4px; border-bottom: 1px solid black; border-left: 1px solid black;}
|
70 |
-
</style>
|
71 |
-
</head><body>';
|
72 |
-
|
73 |
-
/** Output title, connection info and cron job monitor runtime * */
|
74 |
-
echo "<h2>Magento Cron Schedule Report</h2><h3>Connection: " . $db['user'] . "@" . $db['host'] . " – Database: " . $db['name'] . " – Table: " . $tblname . "</h3>";
|
75 |
-
echo "<h4>Runtime: " . $date . " Server: " . $time . " Store: " . $storetime . " Zulu: " . $utc . " UTC</h4>";
|
76 |
-
echo "<h4>Note: All logged times are UTC, your server timezone offset is " . $offset . " hours from UTC</h4>";
|
77 |
-
|
78 |
-
/** Connect to database * */
|
79 |
-
$conn = mysql_connect($db['host'], $db['user'], $db['pass']);
|
80 |
-
@mysql_select_db($db['name']) or die(mysql_error());
|
81 |
-
|
82 |
-
//================================================================
|
83 |
-
//Pending jobs
|
84 |
-
|
85 |
-
$query = 'SELECT * FROM ' . $tblname . ' WHERE status ="pending" ORDER BY scheduled_at DESC';
|
86 |
-
$result = mysql_query($query);
|
87 |
-
$num = mysql_numrows($result);
|
88 |
-
echo '<table><tbody><tr><th class="stattitle" colspan="5">Jobs Pending: ' . $num . '</th></tr>';
|
89 |
-
echo "<tr><th>ID</th><th>Job Code</th><th>Status</th><th>Created At</th><th>Scheduled At</th>";
|
90 |
-
$i = 0;
|
91 |
-
while ($i < $num) {
|
92 |
-
|
93 |
-
$schedule_id = mysql_result($result, $i, "schedule_id");
|
94 |
-
$job_code = mysql_result($result, $i, "job_code");
|
95 |
-
$status = mysql_result($result, $i, "status");
|
96 |
-
$created_at = mysql_result($result, $i, "created_at");
|
97 |
-
$scheduled_at = mysql_result($result, $i, "scheduled_at");
|
98 |
-
$executed_at = mysql_result($result, $i, "executed_at");
|
99 |
-
$finished_at = mysql_result($result, $i, "finished_at");
|
100 |
-
|
101 |
-
//output html
|
102 |
-
echo "<tr>";
|
103 |
-
echo "<td>" . $schedule_id . "</td>";
|
104 |
-
echo '<td>' . $job_code . "</td>";
|
105 |
-
echo '<td style="color: red;">' . $status . "</td>";
|
106 |
-
echo "<td>" . $created_at . "</td>";
|
107 |
-
echo "<td>" . $scheduled_at . "</td>";
|
108 |
-
echo "</tr>";
|
109 |
-
$i++;
|
110 |
-
}
|
111 |
-
echo "</tbody></table><hr>";
|
112 |
-
|
113 |
-
//================================================================
|
114 |
-
//Running jobs
|
115 |
-
|
116 |
-
$query = 'SELECT * FROM ' . $tblname . ' WHERE status ="running" ORDER BY executed_at DESC';
|
117 |
-
$result = mysql_query($query);
|
118 |
-
$num = mysql_numrows($result);
|
119 |
-
echo '<table><tbody><th class="stattitle" colspan="7">Jobs Running: ' . $num . '</th></tr>';
|
120 |
-
echo "<tr><th>ID</th><th>Job Code</th><th>Status</th><th>Created At</th><th>Scheduled At</th>";
|
121 |
-
echo "<th>Executed At</th><th>Finished At</th></tr>";
|
122 |
-
$i = 0;
|
123 |
-
while ($i < $num) {
|
124 |
-
|
125 |
-
$schedule_id = mysql_result($result, $i, "schedule_id");
|
126 |
-
$job_code = mysql_result($result, $i, "job_code");
|
127 |
-
$status = mysql_result($result, $i, "status");
|
128 |
-
$created_at = mysql_result($result, $i, "created_at");
|
129 |
-
$scheduled_at = mysql_result($result, $i, "scheduled_at");
|
130 |
-
$executed_at = mysql_result($result, $i, "executed_at");
|
131 |
-
$finished_at = mysql_result($result, $i, "finished_at");
|
132 |
-
|
133 |
-
//output html
|
134 |
-
echo "<tr>";
|
135 |
-
echo "<td>" . $schedule_id . "</td>";
|
136 |
-
echo "<td>" . $job_code . "</td>";
|
137 |
-
echo "<td>" . $status . "</td>";
|
138 |
-
echo "<td>" . $created_at . "</td>";
|
139 |
-
echo "<td>" . $scheduled_at . "</td>";
|
140 |
-
echo "<td>" . $executed_at . "</td>";
|
141 |
-
echo "<td>" . $finished_at . "</td>";
|
142 |
-
echo "</tr>";
|
143 |
-
$i++;
|
144 |
-
}
|
145 |
-
echo "</tbody>";
|
146 |
-
|
147 |
-
//================================================================
|
148 |
-
//Succsessful jobs
|
149 |
-
|
150 |
-
$query = 'SELECT * FROM ' . $tblname . ' WHERE status ="success" ORDER BY executed_at DESC';
|
151 |
-
$result = mysql_query($query);
|
152 |
-
$num = mysql_numrows($result);
|
153 |
-
echo '<tbody><tr><th class="stattitle" colspan="7">Jobs Successful: ' . $num . '</th></tr>';
|
154 |
-
echo "<tr><th>ID</th><th>Job Code</th><th>Status</th><th>Created At</th><th>Scheduled At</th>";
|
155 |
-
echo "<th>Executed At</th><th>Finished At</th></tr>";
|
156 |
-
$i = 0;
|
157 |
-
while ($i < $num) {
|
158 |
-
|
159 |
-
$schedule_id = mysql_result($result, $i, "schedule_id");
|
160 |
-
$job_code = mysql_result($result, $i, "job_code");
|
161 |
-
$status = mysql_result($result, $i, "status");
|
162 |
-
$created_at = mysql_result($result, $i, "created_at");
|
163 |
-
$scheduled_at = mysql_result($result, $i, "scheduled_at");
|
164 |
-
$executed_at = mysql_result($result, $i, "executed_at");
|
165 |
-
$finished_at = mysql_result($result, $i, "finished_at");
|
166 |
-
|
167 |
-
//output html
|
168 |
-
echo "<tr>";
|
169 |
-
echo "<td>" . $schedule_id . "</td>";
|
170 |
-
echo "<td>" . $job_code . "</td>";
|
171 |
-
echo "<td>" . $status . "</td>";
|
172 |
-
echo "<td>" . $created_at . "</td>";
|
173 |
-
echo "<td>" . $scheduled_at . "</td>";
|
174 |
-
echo "<td>" . $executed_at . "</td>";
|
175 |
-
echo "<td>" . $finished_at . "</td>";
|
176 |
-
echo "</tr>";
|
177 |
-
$i++;
|
178 |
-
}
|
179 |
-
echo "</tbody>";
|
180 |
-
|
181 |
-
//================================================================
|
182 |
-
//Missed jobs
|
183 |
-
|
184 |
-
$query = 'SELECT * FROM ' . $tblname . ' WHERE status ="missed" ORDER BY executed_at DESC';
|
185 |
-
$result = mysql_query($query);
|
186 |
-
$num = mysql_numrows($result);
|
187 |
-
echo '<tbody><tr><th class="stattitle" colspan="7">Jobs Missed: ' . $num . '</th></tr>';
|
188 |
-
echo "<tr><th>ID</th><th>Job Code</th><th>Status</th><th>Created At</th><th>Scheduled At</th>";
|
189 |
-
echo "<th>Executed At</th><th>Finished At</th></tr>";
|
190 |
-
$i = 0;
|
191 |
-
while ($i < $num) {
|
192 |
-
|
193 |
-
$schedule_id = mysql_result($result, $i, "schedule_id");
|
194 |
-
$job_code = mysql_result($result, $i, "job_code");
|
195 |
-
$status = mysql_result($result, $i, "status");
|
196 |
-
$created_at = mysql_result($result, $i, "created_at");
|
197 |
-
$scheduled_at = mysql_result($result, $i, "scheduled_at");
|
198 |
-
$executed_at = mysql_result($result, $i, "executed_at");
|
199 |
-
$finished_at = mysql_result($result, $i, "finished_at");
|
200 |
-
|
201 |
-
//output html
|
202 |
-
echo "<tr>";
|
203 |
-
echo "<td>" . $schedule_id . "</td>";
|
204 |
-
echo "<td>" . $job_code . "</td>";
|
205 |
-
echo "<td>" . $status . "</td>";
|
206 |
-
echo "<td>" . $created_at . "</td>";
|
207 |
-
echo "<td>" . $scheduled_at . "</td>";
|
208 |
-
echo "<td>" . $executed_at . "</td>";
|
209 |
-
echo "<td>" . $finished_at . "</td>";
|
210 |
-
echo "</tr>";
|
211 |
-
$i++;
|
212 |
-
}
|
213 |
-
echo "</tbody>";
|
214 |
-
|
215 |
-
//================================================================
|
216 |
-
//Failed jobs
|
217 |
-
|
218 |
-
$query = 'SELECT * FROM ' . $tblname . ' WHERE status ="error" ORDER BY executed_at DESC';
|
219 |
-
$result = mysql_query($query);
|
220 |
-
$num = mysql_numrows($result);
|
221 |
-
echo '<tbody><tr><th class="stattitle" colspan="7">Jobs Failed: ' . $num . '</th></tr>';
|
222 |
-
echo "<tr><th>ID</th><th>Job Code</th><th>Status</th><th>Created At</th><th>Scheduled At</th>";
|
223 |
-
echo "<th>Executed At</th><th>Finished At</th></tr>";
|
224 |
-
$i = 0;
|
225 |
-
while ($i < $num) {
|
226 |
-
|
227 |
-
$schedule_id = mysql_result($result, $i, "schedule_id");
|
228 |
-
$job_code = mysql_result($result, $i, "job_code");
|
229 |
-
$status = mysql_result($result, $i, "status");
|
230 |
-
$created_at = mysql_result($result, $i, "created_at");
|
231 |
-
$scheduled_at = mysql_result($result, $i, "scheduled_at");
|
232 |
-
$executed_at = mysql_result($result, $i, "executed_at");
|
233 |
-
$finished_at = mysql_result($result, $i, "finished_at");
|
234 |
-
|
235 |
-
//output html
|
236 |
-
echo "<tr>";
|
237 |
-
echo "<td>" . $schedule_id . "</td>";
|
238 |
-
echo "<td>" . $job_code . "</td>";
|
239 |
-
echo "<td>" . $status . "</td>";
|
240 |
-
echo "<td>" . $created_at . "</td>";
|
241 |
-
echo "<td>" . $scheduled_at . "</td>";
|
242 |
-
echo "<td>" . $executed_at . "</td>";
|
243 |
-
echo "<td>" . $finished_at . "</td>";
|
244 |
-
echo "</tr>";
|
245 |
-
$i++;
|
246 |
-
}
|
247 |
-
echo "</tbody></table></body></html>";
|
248 |
-
|
249 |
-
//================================================================
|
250 |
-
// End of report
|
251 |
-
|
252 |
-
mysql_close($conn);
|
253 |
-
}
|
254 |
-
|
255 |
-
protected function _sync() {
|
256 |
-
Mage::getModel('unityreports/cron_sync')->runSync();
|
257 |
-
}
|
258 |
-
protected function _request() {
|
259 |
-
Mage::getModel('unityreports/cron_request')->check();
|
260 |
-
}
|
261 |
-
protected function _abcarts() {
|
262 |
-
Mage::getModel('unityreports/sync_abcart')->runSync();
|
263 |
-
}
|
264 |
-
protected function _customers() {
|
265 |
-
Mage::getModel('unityreports/sync_customer')->runSync();
|
266 |
-
}
|
267 |
-
protected function _actions() {
|
268 |
-
Mage::getModel('unityreports/sync_customerAction')->runSync();
|
269 |
-
}
|
270 |
-
protected function _invoices() {
|
271 |
-
Mage::getModel('unityreports/sync_invoice')->runSync();
|
272 |
-
}
|
273 |
-
protected function _orders() {
|
274 |
-
Mage::getModel('unityreports/sync_order')->runSync();
|
275 |
-
}
|
276 |
-
protected function _returns() {
|
277 |
-
Mage::getModel('unityreports/sync_creditnote')->runSync();
|
278 |
-
}
|
279 |
-
protected function _products() {
|
280 |
-
Mage::getModel('unityreports/sync_product')->runSync();
|
281 |
-
}
|
282 |
-
protected function _counters() {
|
283 |
-
Mage::getModel('unityreports/cron_count')->runSync();
|
284 |
-
}
|
285 |
-
protected function _variations() {
|
286 |
-
Mage::getModel('unityreports/sync_productVariation')->runSync();
|
287 |
-
}
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
}
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
}
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Controller for self testing action
|
5 |
+
*
|
6 |
+
* @category Unityreports
|
7 |
+
* @package Intelivemetrics_Unityreports
|
8 |
+
* @copyright Copyright (c) 2014 Intelive Metrics Srl
|
9 |
+
* @author Eduard Gabriel Dumitrescu (balaur@gmail.com)
|
10 |
+
*/
|
11 |
+
class Intelivemetrics_Unityreports_TestController extends Mage_Core_Controller_Front_Action {
|
12 |
+
|
13 |
+
/**
|
14 |
+
//Magento Cron Job Monitor. GNU/GPL
|
15 |
+
//oliver.higgins@gmail.com
|
16 |
+
//provided without warranty or support
|
17 |
+
//
|
18 |
+
//modifications by chiefair to retrieve Magento connection and database
|
19 |
+
//info, display time, connection info and all job execution states
|
20 |
+
*/
|
21 |
+
protected function _cron() {
|
22 |
+
/** Get current date, time, UTC and offset * */
|
23 |
+
$date = date("Y-m-d");
|
24 |
+
$time = date("H:i:s T");
|
25 |
+
$offset = date("P");
|
26 |
+
$utc = gmdate("H:i:s");
|
27 |
+
|
28 |
+
/** Mage locations * */
|
29 |
+
$mageconf = dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/etc/local.xml'; // Mage local.xml config
|
30 |
+
|
31 |
+
/* * *****************
|
32 |
+
* Let George do it
|
33 |
+
* Get connection information from Magento's local.xml file
|
34 |
+
* ***************** */
|
35 |
+
|
36 |
+
if (is_file($mageconf)) {
|
37 |
+
$xml = simplexml_load_file($mageconf, NULL, LIBXML_NOCDATA);
|
38 |
+
$db['host'] = $xml->global->resources->default_setup->connection->host;
|
39 |
+
$db['name'] = $xml->global->resources->default_setup->connection->dbname;
|
40 |
+
$db['user'] = $xml->global->resources->default_setup->connection->username;
|
41 |
+
$db['pass'] = $xml->global->resources->default_setup->connection->password;
|
42 |
+
$db['pref'] = $xml->global->resources->db->table_prefix;
|
43 |
+
$tblname = $db['pref'] . "cron_schedule";
|
44 |
+
} else {
|
45 |
+
exit("Failed to open $mageconf");
|
46 |
+
}
|
47 |
+
|
48 |
+
/* Initialize profile to be run as Magento Admin and log start of export */
|
49 |
+
|
50 |
+
// require_once $mageapp;
|
51 |
+
umask(0);
|
52 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
53 |
+
|
54 |
+
$storetimestamp = Mage::getModel('core/date')->timestamp(time());
|
55 |
+
|
56 |
+
$storetime = date("H:i:s", $storetimestamp);
|
57 |
+
|
58 |
+
/* * **********************
|
59 |
+
* Start HTML output
|
60 |
+
* ********************** */
|
61 |
+
|
62 |
+
echo '<html><head><title>Magento Cron Schedule on ' . $date . ' ' . $time . '</title>
|
63 |
+
<meta http-equiv="refresh" content="60">
|
64 |
+
<style type="text/css">html {width: 100%; font-family: Arial,Helvetica, sans-serif;}
|
65 |
+
body {line-height:1.0em; font-size: 100%;}
|
66 |
+
table {border-spacing: 1px; width: 100%;}
|
67 |
+
th.stattitle {text-align: left; font-size: 100%; font-weight: bold; color: white; background-color: #101010;}
|
68 |
+
th {text-align: center; font-size: 80%; font-weight: bold; padding: 5px; border-bottom: 1px solid black; border-left: 1px solid black; }
|
69 |
+
td {text-align: left; font-size: 80%; padding: 4px; border-bottom: 1px solid black; border-left: 1px solid black;}
|
70 |
+
</style>
|
71 |
+
</head><body>';
|
72 |
+
|
73 |
+
/** Output title, connection info and cron job monitor runtime * */
|
74 |
+
echo "<h2>Magento Cron Schedule Report</h2><h3>Connection: " . $db['user'] . "@" . $db['host'] . " – Database: " . $db['name'] . " – Table: " . $tblname . "</h3>";
|
75 |
+
echo "<h4>Runtime: " . $date . " Server: " . $time . " Store: " . $storetime . " Zulu: " . $utc . " UTC</h4>";
|
76 |
+
echo "<h4>Note: All logged times are UTC, your server timezone offset is " . $offset . " hours from UTC</h4>";
|
77 |
+
|
78 |
+
/** Connect to database * */
|
79 |
+
$conn = mysql_connect($db['host'], $db['user'], $db['pass']);
|
80 |
+
@mysql_select_db($db['name']) or die(mysql_error());
|
81 |
+
|
82 |
+
//================================================================
|
83 |
+
//Pending jobs
|
84 |
+
|
85 |
+
$query = 'SELECT * FROM ' . $tblname . ' WHERE status ="pending" ORDER BY scheduled_at DESC';
|
86 |
+
$result = mysql_query($query);
|
87 |
+
$num = mysql_numrows($result);
|
88 |
+
echo '<table><tbody><tr><th class="stattitle" colspan="5">Jobs Pending: ' . $num . '</th></tr>';
|
89 |
+
echo "<tr><th>ID</th><th>Job Code</th><th>Status</th><th>Created At</th><th>Scheduled At</th>";
|
90 |
+
$i = 0;
|
91 |
+
while ($i < $num) {
|
92 |
+
|
93 |
+
$schedule_id = mysql_result($result, $i, "schedule_id");
|
94 |
+
$job_code = mysql_result($result, $i, "job_code");
|
95 |
+
$status = mysql_result($result, $i, "status");
|
96 |
+
$created_at = mysql_result($result, $i, "created_at");
|
97 |
+
$scheduled_at = mysql_result($result, $i, "scheduled_at");
|
98 |
+
$executed_at = mysql_result($result, $i, "executed_at");
|
99 |
+
$finished_at = mysql_result($result, $i, "finished_at");
|
100 |
+
|
101 |
+
//output html
|
102 |
+
echo "<tr>";
|
103 |
+
echo "<td>" . $schedule_id . "</td>";
|
104 |
+
echo '<td>' . $job_code . "</td>";
|
105 |
+
echo '<td style="color: red;">' . $status . "</td>";
|
106 |
+
echo "<td>" . $created_at . "</td>";
|
107 |
+
echo "<td>" . $scheduled_at . "</td>";
|
108 |
+
echo "</tr>";
|
109 |
+
$i++;
|
110 |
+
}
|
111 |
+
echo "</tbody></table><hr>";
|
112 |
+
|
113 |
+
//================================================================
|
114 |
+
//Running jobs
|
115 |
+
|
116 |
+
$query = 'SELECT * FROM ' . $tblname . ' WHERE status ="running" ORDER BY executed_at DESC';
|
117 |
+
$result = mysql_query($query);
|
118 |
+
$num = mysql_numrows($result);
|
119 |
+
echo '<table><tbody><th class="stattitle" colspan="7">Jobs Running: ' . $num . '</th></tr>';
|
120 |
+
echo "<tr><th>ID</th><th>Job Code</th><th>Status</th><th>Created At</th><th>Scheduled At</th>";
|
121 |
+
echo "<th>Executed At</th><th>Finished At</th></tr>";
|
122 |
+
$i = 0;
|
123 |
+
while ($i < $num) {
|
124 |
+
|
125 |
+
$schedule_id = mysql_result($result, $i, "schedule_id");
|
126 |
+
$job_code = mysql_result($result, $i, "job_code");
|
127 |
+
$status = mysql_result($result, $i, "status");
|
128 |
+
$created_at = mysql_result($result, $i, "created_at");
|
129 |
+
$scheduled_at = mysql_result($result, $i, "scheduled_at");
|
130 |
+
$executed_at = mysql_result($result, $i, "executed_at");
|
131 |
+
$finished_at = mysql_result($result, $i, "finished_at");
|
132 |
+
|
133 |
+
//output html
|
134 |
+
echo "<tr>";
|
135 |
+
echo "<td>" . $schedule_id . "</td>";
|
136 |
+
echo "<td>" . $job_code . "</td>";
|
137 |
+
echo "<td>" . $status . "</td>";
|
138 |
+
echo "<td>" . $created_at . "</td>";
|
139 |
+
echo "<td>" . $scheduled_at . "</td>";
|
140 |
+
echo "<td>" . $executed_at . "</td>";
|
141 |
+
echo "<td>" . $finished_at . "</td>";
|
142 |
+
echo "</tr>";
|
143 |
+
$i++;
|
144 |
+
}
|
145 |
+
echo "</tbody>";
|
146 |
+
|
147 |
+
//================================================================
|
148 |
+
//Succsessful jobs
|
149 |
+
|
150 |
+
$query = 'SELECT * FROM ' . $tblname . ' WHERE status ="success" ORDER BY executed_at DESC';
|
151 |
+
$result = mysql_query($query);
|
152 |
+
$num = mysql_numrows($result);
|
153 |
+
echo '<tbody><tr><th class="stattitle" colspan="7">Jobs Successful: ' . $num . '</th></tr>';
|
154 |
+
echo "<tr><th>ID</th><th>Job Code</th><th>Status</th><th>Created At</th><th>Scheduled At</th>";
|
155 |
+
echo "<th>Executed At</th><th>Finished At</th></tr>";
|
156 |
+
$i = 0;
|
157 |
+
while ($i < $num) {
|
158 |
+
|
159 |
+
$schedule_id = mysql_result($result, $i, "schedule_id");
|
160 |
+
$job_code = mysql_result($result, $i, "job_code");
|
161 |
+
$status = mysql_result($result, $i, "status");
|
162 |
+
$created_at = mysql_result($result, $i, "created_at");
|
163 |
+
$scheduled_at = mysql_result($result, $i, "scheduled_at");
|
164 |
+
$executed_at = mysql_result($result, $i, "executed_at");
|
165 |
+
$finished_at = mysql_result($result, $i, "finished_at");
|
166 |
+
|
167 |
+
//output html
|
168 |
+
echo "<tr>";
|
169 |
+
echo "<td>" . $schedule_id . "</td>";
|
170 |
+
echo "<td>" . $job_code . "</td>";
|
171 |
+
echo "<td>" . $status . "</td>";
|
172 |
+
echo "<td>" . $created_at . "</td>";
|
173 |
+
echo "<td>" . $scheduled_at . "</td>";
|
174 |
+
echo "<td>" . $executed_at . "</td>";
|
175 |
+
echo "<td>" . $finished_at . "</td>";
|
176 |
+
echo "</tr>";
|
177 |
+
$i++;
|
178 |
+
}
|
179 |
+
echo "</tbody>";
|
180 |
+
|
181 |
+
//================================================================
|
182 |
+
//Missed jobs
|
183 |
+
|
184 |
+
$query = 'SELECT * FROM ' . $tblname . ' WHERE status ="missed" ORDER BY executed_at DESC';
|
185 |
+
$result = mysql_query($query);
|
186 |
+
$num = mysql_numrows($result);
|
187 |
+
echo '<tbody><tr><th class="stattitle" colspan="7">Jobs Missed: ' . $num . '</th></tr>';
|
188 |
+
echo "<tr><th>ID</th><th>Job Code</th><th>Status</th><th>Created At</th><th>Scheduled At</th>";
|
189 |
+
echo "<th>Executed At</th><th>Finished At</th></tr>";
|
190 |
+
$i = 0;
|
191 |
+
while ($i < $num) {
|
192 |
+
|
193 |
+
$schedule_id = mysql_result($result, $i, "schedule_id");
|
194 |
+
$job_code = mysql_result($result, $i, "job_code");
|
195 |
+
$status = mysql_result($result, $i, "status");
|
196 |
+
$created_at = mysql_result($result, $i, "created_at");
|
197 |
+
$scheduled_at = mysql_result($result, $i, "scheduled_at");
|
198 |
+
$executed_at = mysql_result($result, $i, "executed_at");
|
199 |
+
$finished_at = mysql_result($result, $i, "finished_at");
|
200 |
+
|
201 |
+
//output html
|
202 |
+
echo "<tr>";
|
203 |
+
echo "<td>" . $schedule_id . "</td>";
|
204 |
+
echo "<td>" . $job_code . "</td>";
|
205 |
+
echo "<td>" . $status . "</td>";
|
206 |
+
echo "<td>" . $created_at . "</td>";
|
207 |
+
echo "<td>" . $scheduled_at . "</td>";
|
208 |
+
echo "<td>" . $executed_at . "</td>";
|
209 |
+
echo "<td>" . $finished_at . "</td>";
|
210 |
+
echo "</tr>";
|
211 |
+
$i++;
|
212 |
+
}
|
213 |
+
echo "</tbody>";
|
214 |
+
|
215 |
+
//================================================================
|
216 |
+
//Failed jobs
|
217 |
+
|
218 |
+
$query = 'SELECT * FROM ' . $tblname . ' WHERE status ="error" ORDER BY executed_at DESC';
|
219 |
+
$result = mysql_query($query);
|
220 |
+
$num = mysql_numrows($result);
|
221 |
+
echo '<tbody><tr><th class="stattitle" colspan="7">Jobs Failed: ' . $num . '</th></tr>';
|
222 |
+
echo "<tr><th>ID</th><th>Job Code</th><th>Status</th><th>Created At</th><th>Scheduled At</th>";
|
223 |
+
echo "<th>Executed At</th><th>Finished At</th></tr>";
|
224 |
+
$i = 0;
|
225 |
+
while ($i < $num) {
|
226 |
+
|
227 |
+
$schedule_id = mysql_result($result, $i, "schedule_id");
|
228 |
+
$job_code = mysql_result($result, $i, "job_code");
|
229 |
+
$status = mysql_result($result, $i, "status");
|
230 |
+
$created_at = mysql_result($result, $i, "created_at");
|
231 |
+
$scheduled_at = mysql_result($result, $i, "scheduled_at");
|
232 |
+
$executed_at = mysql_result($result, $i, "executed_at");
|
233 |
+
$finished_at = mysql_result($result, $i, "finished_at");
|
234 |
+
|
235 |
+
//output html
|
236 |
+
echo "<tr>";
|
237 |
+
echo "<td>" . $schedule_id . "</td>";
|
238 |
+
echo "<td>" . $job_code . "</td>";
|
239 |
+
echo "<td>" . $status . "</td>";
|
240 |
+
echo "<td>" . $created_at . "</td>";
|
241 |
+
echo "<td>" . $scheduled_at . "</td>";
|
242 |
+
echo "<td>" . $executed_at . "</td>";
|
243 |
+
echo "<td>" . $finished_at . "</td>";
|
244 |
+
echo "</tr>";
|
245 |
+
$i++;
|
246 |
+
}
|
247 |
+
echo "</tbody></table></body></html>";
|
248 |
+
|
249 |
+
//================================================================
|
250 |
+
// End of report
|
251 |
+
|
252 |
+
mysql_close($conn);
|
253 |
+
}
|
254 |
+
|
255 |
+
protected function _sync() {
|
256 |
+
Mage::getModel('unityreports/cron_sync')->runSync();
|
257 |
+
}
|
258 |
+
protected function _request() {
|
259 |
+
Mage::getModel('unityreports/cron_request')->check();
|
260 |
+
}
|
261 |
+
protected function _abcarts() {
|
262 |
+
Mage::getModel('unityreports/sync_abcart')->runSync();
|
263 |
+
}
|
264 |
+
protected function _customers() {
|
265 |
+
Mage::getModel('unityreports/sync_customer')->runSync();
|
266 |
+
}
|
267 |
+
protected function _actions() {
|
268 |
+
Mage::getModel('unityreports/sync_customerAction')->runSync();
|
269 |
+
}
|
270 |
+
protected function _invoices() {
|
271 |
+
Mage::getModel('unityreports/sync_invoice')->runSync();
|
272 |
+
}
|
273 |
+
protected function _orders() {
|
274 |
+
Mage::getModel('unityreports/sync_order')->runSync();
|
275 |
+
}
|
276 |
+
protected function _returns() {
|
277 |
+
Mage::getModel('unityreports/sync_creditnote')->runSync();
|
278 |
+
}
|
279 |
+
protected function _products() {
|
280 |
+
Mage::getModel('unityreports/sync_product')->runSync();
|
281 |
+
}
|
282 |
+
protected function _counters() {
|
283 |
+
Mage::getModel('unityreports/cron_count')->runSync();
|
284 |
+
}
|
285 |
+
protected function _variations() {
|
286 |
+
Mage::getModel('unityreports/sync_productVariation')->runSync();
|
287 |
+
}
|
288 |
+
protected function _fix() {
|
289 |
+
}
|
290 |
+
|
291 |
+
public function indexAction() {
|
292 |
+
define('APPLICATION_ENV', 'testing');
|
293 |
+
$helper = Mage::helper('unityreports');
|
294 |
+
$key = strip_tags($this->getRequest()->getParam('key'));
|
295 |
+
//check we have key
|
296 |
+
if (!$key) {
|
297 |
+
die('Missing Key Param');
|
298 |
+
}
|
299 |
+
$test = strip_tags($this->getRequest()->getParam('test'));
|
300 |
+
//check we have test name
|
301 |
+
if (!$test) {
|
302 |
+
die('Missing Test Name Param');
|
303 |
+
}
|
304 |
+
//check hey is ok
|
305 |
+
if ($key != $helper->getApiKey()) {
|
306 |
+
die('Key is Wrong');
|
307 |
+
}
|
308 |
+
|
309 |
+
echo "<pre>";
|
310 |
+
try {
|
311 |
+
$this->{'_' . $test}();
|
312 |
+
} catch (Exception $ex) {
|
313 |
+
echo $ex;
|
314 |
+
}
|
315 |
+
echo "</pre>";
|
316 |
+
}
|
317 |
+
|
318 |
+
}
|
app/code/community/Intelivemetrics/Unityreports/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Intelivemetrics_Unityreports>
|
5 |
-
<version>0.7.
|
6 |
</Intelivemetrics_Unityreports>
|
7 |
</modules>
|
8 |
<global>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Intelivemetrics_Unityreports>
|
5 |
+
<version>0.7.7</version>
|
6 |
</Intelivemetrics_Unityreports>
|
7 |
</modules>
|
8 |
<global>
|
js/intelivemetrics/unityreports/utmz-alternative.js
CHANGED
@@ -1,53 +1,53 @@
|
|
1 |
-
/**
|
2 |
-
* This script provides an alternative method for creating an _utmz cookie
|
3 |
-
* when switching to universal analytics
|
4 |
-
*
|
5 |
-
* @category Unityreports
|
6 |
-
* @package Intelivemetrics_Unityreports
|
7 |
-
* @copyright Copyright (c) 2014 Intelive Metrics Srl
|
8 |
-
* @author Eduard Gabriel Dumitrescu (balaur@gmail.com)
|
9 |
-
*/
|
10 |
-
var Qs = function () {
|
11 |
-
// This function is anonymous, is executed immediately and
|
12 |
-
// the return value is assigned to QueryString!
|
13 |
-
var query_string = {};
|
14 |
-
var query = window.location.search.substring(1);
|
15 |
-
var vars = query.split("&");
|
16 |
-
for (var i = 0; i < vars.length; i++) {
|
17 |
-
var pair = vars[i].split("=");
|
18 |
-
// If first entry with this name
|
19 |
-
if (typeof query_string[pair[0]] === "undefined") {
|
20 |
-
query_string[pair[0]] = pair[1];
|
21 |
-
// If second entry with this name
|
22 |
-
} else if (typeof query_string[pair[0]] === "string") {
|
23 |
-
var arr = [query_string[pair[0]], pair[1]];
|
24 |
-
query_string[pair[0]] = arr;
|
25 |
-
// If third or later entry with this name
|
26 |
-
} else {
|
27 |
-
query_string[pair[0]].push(pair[1]);
|
28 |
-
}
|
29 |
-
}
|
30 |
-
return query_string;
|
31 |
-
}();
|
32 |
-
|
33 |
-
//utm_campaign=app_listing&utm_medium=referral&utm_source=ga_partner_gallery
|
34 |
-
var Utmza = function (domain) {
|
35 |
-
var c = Qs.utm_campaign || null,
|
36 |
-
s = Qs.utm_source || null,
|
37 |
-
m = Qs.utm_medium || null,
|
38 |
-
j = [],
|
39 |
-
expires = new Date(),
|
40 |
-
cookie = '__utmza'
|
41 |
-
;
|
42 |
-
domain = domain || window.location.hostname;
|
43 |
-
|
44 |
-
if (c) j.push('c=' + c);
|
45 |
-
if (s) j.push('s=' + s);
|
46 |
-
if (m) j.push('m=' + m);
|
47 |
-
|
48 |
-
if(j.length > 0){
|
49 |
-
//create top level cookie
|
50 |
-
expires.setTime(expires.getTime() + 1000*60*60*24*365); // (1 years)
|
51 |
-
document.cookie = cookie + "=" + j.join('|') + "; expires=" + expires.toGMTString() + "; domain=" + domain + "; path=/";
|
52 |
-
}
|
53 |
-
}();
|
1 |
+
/**
|
2 |
+
* This script provides an alternative method for creating an _utmz cookie
|
3 |
+
* when switching to universal analytics
|
4 |
+
*
|
5 |
+
* @category Unityreports
|
6 |
+
* @package Intelivemetrics_Unityreports
|
7 |
+
* @copyright Copyright (c) 2014 Intelive Metrics Srl
|
8 |
+
* @author Eduard Gabriel Dumitrescu (balaur@gmail.com)
|
9 |
+
*/
|
10 |
+
var Qs = function () {
|
11 |
+
// This function is anonymous, is executed immediately and
|
12 |
+
// the return value is assigned to QueryString!
|
13 |
+
var query_string = {};
|
14 |
+
var query = window.location.search.substring(1);
|
15 |
+
var vars = query.split("&");
|
16 |
+
for (var i = 0; i < vars.length; i++) {
|
17 |
+
var pair = vars[i].split("=");
|
18 |
+
// If first entry with this name
|
19 |
+
if (typeof query_string[pair[0]] === "undefined") {
|
20 |
+
query_string[pair[0]] = pair[1];
|
21 |
+
// If second entry with this name
|
22 |
+
} else if (typeof query_string[pair[0]] === "string") {
|
23 |
+
var arr = [query_string[pair[0]], pair[1]];
|
24 |
+
query_string[pair[0]] = arr;
|
25 |
+
// If third or later entry with this name
|
26 |
+
} else {
|
27 |
+
query_string[pair[0]].push(pair[1]);
|
28 |
+
}
|
29 |
+
}
|
30 |
+
return query_string;
|
31 |
+
}();
|
32 |
+
|
33 |
+
//utm_campaign=app_listing&utm_medium=referral&utm_source=ga_partner_gallery
|
34 |
+
var Utmza = function (domain) {
|
35 |
+
var c = Qs.utm_campaign || null,
|
36 |
+
s = Qs.utm_source || null,
|
37 |
+
m = Qs.utm_medium || null,
|
38 |
+
j = [],
|
39 |
+
expires = new Date(),
|
40 |
+
cookie = '__utmza'
|
41 |
+
;
|
42 |
+
domain = domain || window.location.hostname;
|
43 |
+
|
44 |
+
if (c) j.push('c=' + c);
|
45 |
+
if (s) j.push('s=' + s);
|
46 |
+
if (m) j.push('m=' + m);
|
47 |
+
|
48 |
+
if(j.length > 0){
|
49 |
+
//create top level cookie
|
50 |
+
expires.setTime(expires.getTime() + 1000*60*60*24*365); // (1 years)
|
51 |
+
document.cookie = cookie + "=" + j.join('|') + "; expires=" + expires.toGMTString() + "; domain=" + domain + "; path=/";
|
52 |
+
}
|
53 |
+
}();
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Intelivemetrics_Unityreports</name>
|
4 |
-
<version>0.7.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://choosealicense.com/licenses/apache-2.0/">APACHE</license>
|
7 |
<channel>community</channel>
|
@@ -10,11 +10,11 @@
|
|
10 |
<description>Unityreports brings powerful e-commerce analytics by combining Magento, Google Analytics and Google Adwords data.
|
11 |
http://www.unityreports.com
|
12 |
</description>
|
13 |
-
<notes>
|
14 |
<authors><author><name>Eduard G. Dumitrescu</name><user>bregoiu</user><email>eddie.dumitrescu@gmail.com</email></author></authors>
|
15 |
-
<date>2015-
|
16 |
-
<time>
|
17 |
-
<contents><target name="magecommunity"><dir name="Intelivemetrics"><dir name="Unityreports"><dir name="Block"><dir name="Adminhtml"><dir name="Button"><file name="Test.php" hash="f23e261d8cf7ef8314f121978b3b03d3"/></dir><dir name="Label"><file name="Renderer.php" hash="89a6ec5dddca5fcf86fbe85b83d87650"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="28ec3fc4be05e608c27da2722b75d2d1"/></dir><dir name="Model"><dir name="Admin"><dir name="Status"><file name="Active.php" hash="28d46ddb38425dcdddf34a694fcbcd84"/><dir name="Cron"><file name="Count.php" hash="8f8de0b781e5889c63b508dcba24532b"/><file name="GlobalCounters.php" hash="7b89f230d9a4fbd65bbf1dd87fd2d196"/><file name="Mage.php" hash="922159223ba73f6ecb4cb019595009f4"/><file name="Stat.php" hash="64e4b605214a0a966adada181d413d79"/><file name="Sync.php" hash="ab2313a6949823565001b9787a1a255a"/></dir><file name="Cron.php" hash="2f5e7a78dcdf1f593d239851316787cf"/></dir></dir><file name="Config.php" hash="590dd9e3939f58560d9b004763d48c05"/><dir name="Cron"><file name="Count.php" hash="e9fb746dabb7a9e2c8433f43fa723df8"/><file name="GlobalCounters.php" hash="c55ce27f8ea8c9a22b22053ae3715bff"/><file name="Request.php" hash="
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.1.0</min><max>7.0.0</max></php></required></dependencies>
|
20 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Intelivemetrics_Unityreports</name>
|
4 |
+
<version>0.7.7</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://choosealicense.com/licenses/apache-2.0/">APACHE</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Unityreports brings powerful e-commerce analytics by combining Magento, Google Analytics and Google Adwords data.
|
11 |
http://www.unityreports.com
|
12 |
</description>
|
13 |
+
<notes>Minor fixes</notes>
|
14 |
<authors><author><name>Eduard G. Dumitrescu</name><user>bregoiu</user><email>eddie.dumitrescu@gmail.com</email></author></authors>
|
15 |
+
<date>2015-04-07</date>
|
16 |
+
<time>08:31:51</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="Intelivemetrics"><dir name="Unityreports"><dir name="Block"><dir name="Adminhtml"><dir name="Button"><file name="Test.php" hash="f23e261d8cf7ef8314f121978b3b03d3"/></dir><dir name="Label"><file name="Renderer.php" hash="89a6ec5dddca5fcf86fbe85b83d87650"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="28ec3fc4be05e608c27da2722b75d2d1"/></dir><dir name="Model"><dir name="Admin"><dir name="Status"><file name="Active.php" hash="28d46ddb38425dcdddf34a694fcbcd84"/><dir name="Cron"><file name="Count.php" hash="8f8de0b781e5889c63b508dcba24532b"/><file name="GlobalCounters.php" hash="7b89f230d9a4fbd65bbf1dd87fd2d196"/><file name="Mage.php" hash="922159223ba73f6ecb4cb019595009f4"/><file name="Stat.php" hash="64e4b605214a0a966adada181d413d79"/><file name="Sync.php" hash="ab2313a6949823565001b9787a1a255a"/></dir><file name="Cron.php" hash="2f5e7a78dcdf1f593d239851316787cf"/></dir></dir><file name="Config.php" hash="590dd9e3939f58560d9b004763d48c05"/><dir name="Cron"><file name="Count.php" hash="e9fb746dabb7a9e2c8433f43fa723df8"/><file name="GlobalCounters.php" hash="c55ce27f8ea8c9a22b22053ae3715bff"/><file name="Request.php" hash="d0d5c8e1b3ba294ef4a628148f4eff3f"/><file name="Sync.php" hash="7bae69af328b6aae62bc3a9dc23462e3"/></dir><file name="Cron.php" hash="51f800a9c3c0ab0acdcda3aa9ba51104"/><file name="Customer.php" hash="c99b23d2ec6ffd8acdcc11cf7ed6421e"/><file name="Observer.php" hash="6d29e3b6e3b740f8fcdbaf8f78feabba"/><dir name="Request"><file name="Base.php" hash="2c3fea1af836bedb205786d67465b97d"/><file name="Diagnose.php" hash="5e8525e5392c705660e800faf9b3e057"/><file name="Dq.php" hash="813628e7a57c45f37f83024cce909bdb"/><file name="GetCounters.php" hash="58350a26c70f552349a1eac4a29bb729"/><file name="HandShake.php" hash="8c1fb4cfef7fd9c7fb91ccc2c9503260"/><file name="Interface.php" hash="680707fa0a26ecd7237d116bc0b0a3da"/><file name="ResetAbcarts.php" hash="facdc1c2486398a2a62db126c8518174"/><file name="ResetAll.php" hash="b2533da935c5c66f741490f7f082c8df"/><file name="ResetCreditmemos.php" hash="a199f6f07c67e219d85990a3a08454cc"/><file name="ResetCustomers.php" hash="570aff03d862608cea5e09ded7e7fd9b"/><file name="ResetInvoices.php" hash="7c62cfe07c089b6ca64e32c9f4667297"/><file name="ResetOrders.php" hash="b73a88a0b1bd908c9e9e1d386f23087f"/><file name="ResetProductCounters.php" hash="e84ea87e8c2dcf28189e870c84118317"/><file name="ResetProducts.php" hash="9cfbc9b3f2a1388ef61f0af516ea8e02"/><file name="SetSpeed.php" hash="48496a1971c80fdaa689e0d65d0acd16"/><file name="StartSync.php" hash="30d94be6608c4bce5cebb114ad241fdb"/><file name="StopSync.php" hash="61fb6758c1600eed20c40e4ec28fcef1"/><file name="SyncResult.php" hash="c2f9893e2a083f9c792bc43a212196e4"/></dir><dir name="Resource"><dir name="Config"><file name="Collection.php" hash="dc7cc10daf7e597be061d7bf841d0f66"/></dir><file name="Config.php" hash="e3f733d66219ffc946a1b3cd5eca980d"/><file name="Setup.php" hash="2f7cb85c64bd6103faf9208c7d5f451f"/></dir><dir name="Sync"><file name="Abcart.php" hash="9c4132a0d377a5b8ea5b20d2a3f3fb3b"/><file name="Creditnote.php" hash="6485779bff48de00a9ba0960c906cf9f"/><file name="Customer.php" hash="b49c41bf3a310a1b874f0498b4863af7"/><file name="CustomerAction.php" hash="160ace0a2e9fa8e28ce522f0d03db25d"/><file name="Interface.php" hash="d74a42d2d34c34ce8ec3379bb220127f"/><file name="Invoice.php" hash="3fd8fd3caa22f3202facb9c1c002ee32"/><file name="Order.php" hash="62d3a2e30cbe00b38773a0a6279ee11e"/><file name="Product.php" hash="ac1a6cd15f3fc1858e11170accf5145c"/><file name="ProductVariation.php" hash="c3042550b9849335c1af13cc26d61504"/></dir><file name="Sync.php" hash="3b17b54554140f94b95dcf98970a5fe1"/><file name="Utils.php" hash="911a0d029646f3c6ed69c812b472afe4"/><file name="Utmz.php" hash="b3b1d805e042142f8d713e253836b1b1"/></dir><dir name="controllers"><file name="IndexController.php" hash="afb64dd80de3245288c73dcf98ba8b90"/><file name="TestController.php" hash="f9394956fe1befcc5ce2c4830eae0149"/></dir><dir name="etc"><file name="adminhtml.xml" hash="aab2ef0e4aedb050d8b60937a085537c"/><file name="config.xml" hash="fe50df73d2f0d0316f958795f9ef9d11"/><file name="system.xml" hash="dd6cee8070b16c894b64f1b7d84a4571"/></dir><dir name="sql"><dir name="unityreports_setup"><file name="mysql4-install-0.7.2.php" hash="54f2cbb15d70806b1756c6196d9b3ec1"/><file name="mysql4-install-0.7.3.php" hash="54f2cbb15d70806b1756c6196d9b3ec1"/><file name="mysql4-upgrade-0.6.2-0.7.2.php" hash="7c1abd7bed806f811ffedf9cdb2c0cc0"/><file name="mysql4-upgrade-0.7.2-0.7.3.php" hash="fcbc4f1c8b216548ee212855142857f8"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Intelivemetrics_Unityreports.xml" hash="ccb9d92196bbc626b5552746ac3ad08b"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="unityreports.xml" hash="1378f49dd55356156426785b3d1e3eab"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="intelivemetrics"><dir name="unityreports"><file name="utmz-alternative.js" hash="69ff8d64ffcf9996d7c26061037a93c5"/></dir></dir></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.1.0</min><max>7.0.0</max></php></required></dependencies>
|
20 |
</package>
|