ice_import - Version 1.7.5

Version Notes

Release notes

Dashboard:
- Server setup requirements
- Statistic information
- Self problem detection
- Errors notification

New settings with Yes/No option:
- Hide empty category
- Sort categories in ASC order
- Remove old products
- Import new products
- Update URL key
- Update stock availability
- Update visibility
- Update status
- Update products category

New general settings:
- Batch size
- Tolerance of difference (%), If difference is greater than this value - remove process will be cancelled.

Bugfixes:
- Categories importing
- Removing old products

Download this release

Release Info

Developer IceShop
Extension ice_import
Version 1.7.5
Comparing to
See all releases


Code changes from version 1.6.0 to 1.7.5

Files changed (49) hide show
  1. app/code/community/ICEshop/Iceimport/Block/Adminhtml/Notifications.php +34 -0
  2. app/code/community/ICEshop/Iceimport/Helper/Data.php +132 -0
  3. app/code/community/ICEshop/Iceimport/Helper/Db.php +354 -0
  4. app/code/community/ICEshop/Iceimport/Helper/Format.php +251 -0
  5. app/code/community/ICEshop/Iceimport/Helper/System/System.php +461 -0
  6. app/code/community/ICEshop/Iceimport/Helper/System/Systemcheck.php +623 -0
  7. app/code/community/ICEshop/Iceimport/Model/Convert/Adapter/Product.php +1447 -0
  8. app/code/community/{Iceshop → ICEshop}/Iceimport/Model/Dataflow/Batch/Import.php +7 -6
  9. app/code/community/{Iceshop → ICEshop}/Iceimport/Model/Dataflow/Convert/Parser/Csv.php +44 -19
  10. app/code/community/ICEshop/Iceimport/Model/Observer.php +165 -0
  11. app/code/community/ICEshop/Iceimport/Model/System/Config/Checksystem.php +11 -0
  12. app/code/community/{Iceshop → ICEshop}/Iceimport/Model/System/Config/Defaulttax.php +1 -1
  13. app/code/community/ICEshop/Iceimport/Model/System/Config/Iceshoplink.php +11 -0
  14. app/code/community/{Iceshop/Iceimport/Model/System/Config/Importstock.php → ICEshop/Iceimport/Model/System/Config/Yesno.php} +1 -1
  15. app/code/community/ICEshop/Iceimport/controllers/Adminhtml/IceimportController.php +888 -0
  16. app/code/community/ICEshop/Iceimport/etc/adminhtml.xml +31 -0
  17. app/code/community/{Iceshop → ICEshop}/Iceimport/etc/config.xml +56 -36
  18. app/code/community/ICEshop/Iceimport/etc/system.xml +362 -0
  19. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-install-1.7.3.php +72 -0
  20. app/code/community/{Iceshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.4.0-1.5.0.php → ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-0.1.0-1.7.0.php} +7 -3
  21. app/code/community/{Iceshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-0.1.0-1.5.0.php → ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.4.0-1.7.0.php} +8 -2
  22. app/code/community/{Iceshop/Iceimport/sql/iceimport_setup/mysql4-install-1.5.0.php → ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.5.0-1.7.0.php} +35 -33
  23. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.6.0-1.7.0.php +67 -0
  24. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.0-1.7.5.php +86 -0
  25. app/code/community/{Iceshop → ICEshop}/Iceimport/sql/iceimport_setup/uninstall-old-version.php +1 -0
  26. app/code/community/Iceshop/Iceimport/Model/Convert/Adapter/Product.php +0 -1026
  27. app/code/community/Iceshop/Iceimport/Model/Observer.php +0 -225
  28. app/code/community/Iceshop/Iceimport/Model/System/Config/Categoryactivity.php +0 -15
  29. app/code/community/Iceshop/Iceimport/Model/System/Config/Imageimport.php +0 -15
  30. app/code/community/Iceshop/Iceimport/Model/System/Config/Importdeliveryeta.php +0 -15
  31. app/code/community/Iceshop/Iceimport/Model/System/Config/Importprices.php +0 -15
  32. app/code/community/Iceshop/Iceimport/Model/System/Config/Importproductbrand.php +0 -15
  33. app/code/community/Iceshop/Iceimport/Model/System/Config/Importproductdescription.php +0 -15
  34. app/code/community/Iceshop/Iceimport/Model/System/Config/Importproductean.php +0 -15
  35. app/code/community/Iceshop/Iceimport/Model/System/Config/Importproductmpn.php +0 -15
  36. app/code/community/Iceshop/Iceimport/Model/System/Config/Importproductname.php +0 -15
  37. app/code/community/Iceshop/Iceimport/Model/System/Config/Importproductshdescription.php +0 -15
  38. app/code/community/Iceshop/Iceimport/Model/System/Config/Importproductshsudescription.php +0 -15
  39. app/code/community/Iceshop/Iceimport/Model/System/Config/Importproductsudescription.php +0 -15
  40. app/code/community/Iceshop/Iceimport/Model/System/Config/Lockproddetails.php +0 -15
  41. app/code/community/Iceshop/Iceimport/etc/system.xml +0 -154
  42. app/design/adminhtml/default/default/layout/ICEshop_Iceimport.xml +18 -0
  43. app/design/adminhtml/default/default/template/iceshop/iceimport/notifications.phtml +10 -0
  44. app/etc/modules/{Iceshop_Iceimport.xml → ICEshop_Iceimport.xml} +2 -2
  45. js/ICEshop/Iceimport/jquery-1.9.1.min.js +4 -0
  46. js/ICEshop/Iceimport/script.js +247 -0
  47. package.xml +31 -11
  48. skin/adminhtml/default/default/iceshop/iceimport/images/iceshop_logo_small_16px.png +0 -0
  49. skin/adminhtml/default/default/iceshop/iceimport/styles.css +124 -0
app/code/community/ICEshop/Iceimport/Block/Adminhtml/Notifications.php ADDED
@@ -0,0 +1,34 @@
1
+ <?php
2
+
3
+ /**
4
+ * Class ICEshop_Iceimport_Block_Adminhtml_Notifications
5
+ */
6
+ class ICEshop_Iceimport_Block_Adminhtml_Notifications extends Mage_Adminhtml_Block_Template
7
+ {
8
+ /**
9
+ * @return array|string
10
+ */
11
+ public function getIceimportProblemsDigest()
12
+ {
13
+ $checker = Mage::helper('iceimport/system_systemcheck')->init();
14
+ $problems_digest = $checker->getExtensionProblemsDigest();
15
+ $response = array();
16
+ if ($problems_digest->getCount() != 0) {
17
+ $problems = $problems_digest->getProblems();
18
+ foreach ($problems as $problem_name => $problem_value) {
19
+ $response[] = array($problem_name => $problem_value);
20
+ }
21
+ }
22
+ return $response;
23
+ }
24
+
25
+ /**
26
+ * Get index management url
27
+ *
28
+ * @return string
29
+ */
30
+ public function getManageUrl()
31
+ {
32
+ return Mage::helper("adminhtml")->getUrl("*/system_config/edit", array('section' => 'iceimport_information'));
33
+ }
34
+ }
app/code/community/ICEshop/Iceimport/Helper/Data.php ADDED
@@ -0,0 +1,132 @@
1
+ <?php
2
+
3
+ class ICEshop_Iceimport_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ /**
7
+ * @param $extension_name
8
+ * @return bool
9
+ */
10
+ public function isExtensionInstalled($extension_name)
11
+ {
12
+ if (!empty($extension_name)) {
13
+ $modules = Mage::getConfig()->getNode('modules')->children();
14
+ $modules = (array)$modules;
15
+ if (array_key_exists($extension_name, (array)$modules)) {
16
+ return true;
17
+ }
18
+ }
19
+ return false;
20
+ }
21
+
22
+
23
+ /**
24
+ * @param bool $json_encoded
25
+ * @return array|string
26
+ */
27
+ public function getSystemInfo($json_encoded = false)
28
+ {
29
+ $results = array();
30
+ try {
31
+ $checker = Mage::helper('iceimport/system_systemcheck')->init();
32
+ if (!empty($checker)) {
33
+ $results['server'] = $checker->getSystem()->getServer()->getData();
34
+ //$results['system'] = $checker->getSystem()->getMagento()->getData();
35
+ //$results['php'] = $checker->getSystem()->getPhp()->getData();
36
+ //$results['mysql'] = $checker->getSystem()->getMysql()->getData();
37
+ //$results['requirements'] = $checker->getSystem()->getRequirements()->getData();
38
+ }
39
+ } catch (Exception $e) {
40
+ }
41
+
42
+ if ($json_encoded == true) {
43
+ return json_encode($results);
44
+ }
45
+ return $results;
46
+ }
47
+
48
+ protected function _getButtonSettings($settings)
49
+ {
50
+ $default_settings = array(
51
+ 'getBeforeHtml' => '',
52
+ 'getId' => '',
53
+ 'getElementName' => '',
54
+ 'getTitle' => '',
55
+ 'getType' => '',
56
+ 'getClass' => '',
57
+ 'getOnClick' => '',
58
+ 'getStyle' => '',
59
+ 'getValue' => '',
60
+ 'getDisabled' => '',
61
+ 'getLabel' => '',
62
+ 'getAfterHtml' => ''
63
+ );
64
+ if (!empty($settings) && is_array($settings)) {
65
+ foreach ($settings as $key => $setting) {
66
+ $camel_key = str_replace(' ', '', ucwords(str_replace('_', ' ', $key)));
67
+ $default_settings['get' . $camel_key] = $setting;
68
+ }
69
+ }
70
+ return $default_settings;
71
+ }
72
+
73
+ /**
74
+ * @param $settings
75
+ * @return string
76
+ */
77
+ public function getButtonHtml($settings)
78
+ {
79
+ $settings = $this->_getButtonSettings($settings);
80
+ $html = $settings['getBeforeHtml'] . '<button '
81
+ . ($settings['getId'] ? ' id="' . $settings['getId'] . '"' : '')
82
+ . ($settings['getElementName'] ? ' name="' . $settings['getElementName'] . '"' : '')
83
+ . ' title="'
84
+ . htmlspecialchars($settings['getTitle'] ? $settings['getTitle'] : $settings['getLabel'], ENT_QUOTES, null, false)
85
+ . '"'
86
+ . ' type="' . $settings['getType'] . '"'
87
+ . ' class="scalable ' . $settings['getClass'] . ($settings['getDisabled'] ? ' disabled' : '') . '"'
88
+ . ' onclick="' . $settings['getOnClick'] . '"'
89
+ . ' style="' . $settings['getStyle'] . '"'
90
+ . ($settings['getValue'] ? ' value="' . $settings['getValue'] . '"' : '')
91
+ . ($settings['getDisabled'] ? ' disabled="disabled"' : '')
92
+ . '><span><span><span>' . $settings['getLabel'] . '</span></span></span></button>' . $settings['getAfterHtml'];
93
+
94
+ return $html;
95
+ }
96
+
97
+ /**
98
+ * Sorts a multi-dimensional array with the given values
99
+ *
100
+ * Seen and modified from: http://www.firsttube.com/read/sorting-a-multi-dimensional-array-with-php/
101
+ *
102
+ * @param array $arr Array to sort
103
+ * @param string $key Field to sort
104
+ * @param string $dir Direction to sort
105
+ * @return array Sorted array
106
+ */
107
+ public function sortMultiDimArr($arr, $key, $dir = 'ASC')
108
+ {
109
+ foreach ($arr as $k => $v) {
110
+ $b[$k] = strtolower($v[$key]);
111
+ }
112
+
113
+ if ($dir == 'ASC') {
114
+ asort($b);
115
+ } else {
116
+ arsort($b);
117
+ }
118
+ foreach ($b as $key => $val) {
119
+ $c[] = $arr[$key];
120
+ }
121
+
122
+ return $c;
123
+ }
124
+
125
+ public function toCamelCase($str, $capitalise_first_char = false) {
126
+ if($capitalise_first_char) {
127
+ $str[0] = strtoupper($str[0]);
128
+ }
129
+ $func = create_function('$c', 'return strtoupper($c[1]);');
130
+ return preg_replace_callback('/_([a-z])/', $func, $str);
131
+ }
132
+ }
app/code/community/ICEshop/Iceimport/Helper/Db.php ADDED
@@ -0,0 +1,354 @@
1
+ <?php
2
+
3
+ /**
4
+ * Class ICEshop_Iceimport_Helper_Db
5
+ */
6
+ class ICEshop_Iceimport_Helper_Db extends Mage_Core_Helper_Abstract
7
+ {
8
+
9
+ /**
10
+ * @var object
11
+ */
12
+ private $_resource;
13
+
14
+ /**
15
+ * @var object
16
+ */
17
+ private $_reader;
18
+
19
+ /**
20
+ * @var object
21
+ */
22
+ private $_writer;
23
+
24
+ /**
25
+ * @var string
26
+ */
27
+ public $_prefix = '';
28
+
29
+ /**
30
+ * int
31
+ */
32
+ const LOG_ROWS_LIMIT = 500;
33
+
34
+ /**
35
+ * __construct
36
+ */
37
+ public function __construct()
38
+ {
39
+ try {
40
+ $this->_resource = Mage::getSingleton('core/resource');
41
+ $this->_writer = $this->_resource->getConnection('core_write');
42
+ $this->_reader = $this->_resource->getConnection('core_read');
43
+ $prefix = Mage::getConfig()->getTablePrefix();
44
+ if (!empty($prefix[0])) {
45
+ $this->_prefix = $prefix[0];
46
+ }
47
+ return true;
48
+ } catch (Exception $e) {
49
+ return false;
50
+ }
51
+ }
52
+
53
+ /**
54
+ * @param $table_name
55
+ * @param bool|array $conditions
56
+ * @return mixed
57
+ */
58
+ public function getRowsCount($table_name, $conditions = false)
59
+ {
60
+ $sql = "SELECT COUNT(*) AS `row_count` FROM `{$table_name}`";
61
+ if (!empty($conditions) && is_array($conditions)) {
62
+ $sql .= ' WHERE ';
63
+ foreach ($conditions as $key => $condition) {
64
+ if (is_array($condition)) {
65
+ if ($key > 0) {
66
+ $sql .= ' ' . $condition['conjunction'] . ' ';
67
+ }
68
+ $sql .= $condition['field'] . ' ' . $condition['comparison'] . ' ';
69
+ switch ($condition['value_type']) {
70
+ case 'num':
71
+ $sql .= $condition['value'];
72
+ break;
73
+ case 'str':
74
+ $sql .= '\'' . $condition['value'] . '\'';
75
+ break;
76
+ }
77
+ } elseif (is_string($condition)) {
78
+ $sql .= $condition;
79
+ }
80
+ }
81
+
82
+ } elseif (!empty($conditions) && is_string($conditions)) {
83
+ $sql .= $conditions;
84
+ }
85
+ $result = $this->_reader->fetchAll($sql);
86
+ $result = array_shift($result);
87
+ return $result['row_count'];
88
+ }
89
+
90
+ /**
91
+ * @param $table_name
92
+ * @param $field_name
93
+ * @param bool|string $before_group
94
+ * @param bool|string $after_group
95
+ * @return mixed
96
+ */
97
+ public function getRowCountByField($table_name, $field_name, $before_group = false, $after_group = false)
98
+ {
99
+ $approved_before_group = '';
100
+ if ($before_group != false && is_string($before_group)) {
101
+ $approved_before_group = $before_group;
102
+ }
103
+ $approved_after_group = '';
104
+ if ($after_group != false && is_string($after_group)) {
105
+ $approved_after_group = $after_group;
106
+ }
107
+ // select is_default, count(is_default) from icecat_products_images group by is_default;
108
+ $sql = "SELECT `{$field_name}`, COUNT(`{$field_name}`) as `row_count` FROM `{$table_name}`{$approved_before_group} GROUP BY `{$field_name}`{$approved_after_group}";
109
+ $result = $this->_reader->fetchAll($sql);
110
+ return $result;
111
+ }
112
+
113
+ /**
114
+ * @param $table_name
115
+ * @param $field_name
116
+ * @return bool
117
+ */
118
+ public function checkIsFieldExists($table_name, $field_name)
119
+ {
120
+ if (!$this->_checkProcedureExists('FIELD_EXISTS')) {
121
+ //recreate the procedure FIELD_EXISTS
122
+ $this->_recreateFieldExistsProcedure();
123
+ }
124
+ $sql = "CALL FIELD_EXISTS(@_exists, '{$table_name}', '{$field_name}', NULL);";
125
+ $this->_reader->query($sql);
126
+
127
+ $sql = "SELECT @_exists;";
128
+ $res = $this->_reader->fetchCol($sql);
129
+ if (!array_shift($res)) {
130
+ //field exists
131
+ return false;
132
+ }
133
+ return true;
134
+ }
135
+
136
+ /**
137
+ * @param $procedure_name
138
+ * @return bool
139
+ */
140
+ private function _checkProcedureExists($procedure_name)
141
+ {
142
+ $sql = "SET @_exists = (SELECT COUNT(ROUTINE_NAME) FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_TYPE = 'PROCEDURE' AND ROUTINE_SCHEMA = database() AND ROUTINE_NAME = '{$procedure_name}')";
143
+ $this->_reader->query($sql);
144
+
145
+ $sql = "SELECT @_exists;";
146
+ $res = $this->_reader->fetchCol($sql);
147
+ $res = array_shift($res);
148
+ if ($res > 0) {
149
+ //field exists
150
+ return true;
151
+ }
152
+ return false;
153
+ }
154
+
155
+ /**
156
+ *
157
+ */
158
+ private function _recreateFieldExistsProcedure()
159
+ {
160
+ $sql = "CREATE PROCEDURE FIELD_EXISTS(
161
+ OUT _exists BOOLEAN, -- return value
162
+ IN tableName CHAR(255), -- name of table to look for
163
+ IN columnName CHAR(255), -- name of column to look for
164
+ IN dbName CHAR(255) -- optional specific db
165
+ ) BEGIN
166
+ -- try to lookup db if none provided
167
+ SET @_dbName := IF(dbName IS NULL, database(), dbName);
168
+
169
+ IF CHAR_LENGTH(@_dbName) = 0
170
+ THEN -- no specific or current db to check against
171
+ SELECT
172
+ FALSE
173
+ INTO _exists;
174
+ ELSE -- we have a db to work with
175
+ SELECT
176
+ IF(count(*) > 0, TRUE, FALSE)
177
+ INTO _exists
178
+ FROM information_schema.COLUMNS c
179
+ WHERE
180
+ c.TABLE_SCHEMA = @_dbName
181
+ AND c.TABLE_NAME = tableName
182
+ AND c.COLUMN_NAME = columnName;
183
+ END IF;
184
+ END;";
185
+ $this->_writer->query($sql);
186
+ }
187
+
188
+ /**
189
+ * @param $sql
190
+ * @return bool
191
+ */
192
+ public function readQuery($sql)
193
+ {
194
+ if (!empty($sql) && is_string($sql)) {
195
+ return $this->_reader->fetchAll($sql);
196
+ }
197
+ return false;
198
+ }
199
+
200
+ /**
201
+ * @param $key
202
+ * @param $value
203
+ * @param string $type
204
+ * @return bool
205
+ */
206
+ public function insertLogEntry($key, $value, $type = 'info')
207
+ {
208
+ if ($type == 'error') {
209
+ $this->rotateLog();
210
+ }
211
+ if (!empty($key)) {
212
+ return $this->_writer->query("INSERT INTO `{$this->_prefix}iceshop_extensions_logs` (`log_key`, `log_value`, `log_type`)
213
+ VALUES ('{$key}', '{$value}', '{$type}')
214
+ ON DUPLICATE KEY UPDATE `log_value` = VALUES(`log_value`), `log_type` = VALUES(`log_type`)");
215
+ }
216
+ return false;
217
+ }
218
+
219
+ /**
220
+ * @param string $log_type
221
+ * @return bool
222
+ */
223
+ public function rotateLog($log_type = 'error')
224
+ {
225
+ $sql = "SELECT COUNT(*) AS row_amount
226
+ FROM `{$this->_prefix}iceshop_extensions_logs`
227
+ WHERE `log_type` = '{$log_type}';";
228
+ $value = $this->_reader->fetchAll($sql);
229
+ $row_amount = 0;
230
+ if (array_key_exists(0, $value)) {
231
+ $row_amount = $value[0]['row_amount'];
232
+ }
233
+ if ($row_amount > self::LOG_ROWS_LIMIT) {
234
+ $rows_to_delete = $row_amount - self::LOG_ROWS_LIMIT;
235
+ return $this->_writer->query("DELETE
236
+ FROM `{$this->_prefix}iceshop_extensions_logs`
237
+ WHERE `log_type` = '{$log_type}'
238
+ ORDER BY `log_id` ASC
239
+ LIMIT {$rows_to_delete}");
240
+ }
241
+ return false;
242
+ }
243
+
244
+ /**
245
+ * @param $key
246
+ * @return bool
247
+ */
248
+ public function getLogEntryByKey($key)
249
+ {
250
+ if (!empty($key)) {
251
+ $sql = "SELECT `log_value`, `log_type`
252
+ FROM `{$this->_prefix}iceshop_extensions_logs`
253
+ WHERE `log_key` = '{$key}'
254
+ ORDER BY `log_id` DESC
255
+ LIMIT 1;";
256
+ $value = $this->_reader->fetchAll($sql);
257
+ if (array_key_exists(0, $value)) {
258
+ return $value[0];
259
+ }
260
+ }
261
+ return false;
262
+ }
263
+
264
+ /**
265
+ * @param bool $type
266
+ * @param string $comparison
267
+ * @param int $limit
268
+ * @return array|bool
269
+ */
270
+ public function getLogByType($type = false, $comparison = 'eq', $limit = 10)
271
+ {
272
+ $comparison_whitelist = array('eq', 'neq');
273
+ if (!in_array($comparison, $comparison_whitelist)) {
274
+ $comparison = 'eq';
275
+ }
276
+ if (!empty($type)) {
277
+ if ($type == 'report') {
278
+ $result_arr = array();
279
+ $sql = "SELECT `log_value`, `timecol`
280
+ FROM `{$this->_prefix}iceshop_extensions_logs`
281
+ WHERE `log_type` = 'error'
282
+ AND (`timecol` > DATE_SUB(now(), INTERVAL 1 DAY))
283
+ ORDER BY `log_id` DESC;";
284
+ $results = $this->_reader->fetchAll($sql);
285
+ foreach ($results as $row) {
286
+ $result_arr[] = $row;
287
+ }
288
+ return (!empty($result_arr)) ? $result_arr : false;
289
+ } else {
290
+ switch($comparison) {
291
+ case 'eq':
292
+ $result_arr = array();
293
+ $sql = "SELECT `log_value`, `timecol`
294
+ FROM `{$this->_prefix}iceshop_extensions_logs`
295
+ WHERE `log_type` = '{$type}'
296
+ ORDER BY `log_id` DESC
297
+ LIMIT {$limit};";
298
+ $results = $this->_reader->fetchAll($sql);
299
+ foreach ($results as $row) {
300
+ $result_arr[] = $row;
301
+ }
302
+ return (!empty($result_arr)) ? $result_arr : false;
303
+ break;
304
+
305
+ case 'neq':
306
+ $result_arr = array();
307
+ $sql = "SELECT `log_value`, `timecol`
308
+ FROM `{$this->_prefix}iceshop_extensions_logs`
309
+ WHERE `log_type` <> '{$type}'
310
+ ORDER BY `log_id` DESC
311
+ LIMIT {$limit};";
312
+ $results = $this->_reader->fetchAll($sql);
313
+ foreach ($results as $row) {
314
+ $result_arr[] = $row;
315
+ }
316
+ return (!empty($result_arr)) ? $result_arr : false;
317
+ break;
318
+ }
319
+ }
320
+ } else {
321
+ $sql = "SELECT `log_value`, `log_type`, `timecol`
322
+ FROM `{$this->_prefix}iceshop_extensions_logs`
323
+ ORDER BY `log_id` DESC
324
+ LIMIT {$limit};";
325
+ return $this->_reader->fetchAll($sql);
326
+ }
327
+ }
328
+
329
+ /**
330
+ * @param $key
331
+ * @return bool
332
+ */
333
+ public function deleteLogEntry($key)
334
+ {
335
+ if (!empty($key)) {
336
+ return $this->_writer->query("DELETE
337
+ FROM `{$this->_prefix}iceshop_extensions_logs`
338
+ WHERE `log_key` = '{$key}';");
339
+ }
340
+ return false;
341
+ }
342
+
343
+ /**
344
+ * @param $table_name
345
+ * @return bool
346
+ */
347
+ public function getTableName($table_name)
348
+ {
349
+ if (!empty($table_name) && is_string($table_name)) {
350
+ return $this->_resource->getTableName($table_name);
351
+ }
352
+ return false;
353
+ }
354
+ }
app/code/community/ICEshop/Iceimport/Helper/Format.php ADDED
@@ -0,0 +1,251 @@
1
+ <?php
2
+ /******************************************************************************
3
+ * Copyright (c) 2010 Jevon Wright and others.
4
+ * All rights reserved. This program and the accompanying materials
5
+ * are made available under the terms of the Eclipse Public License v1.0
6
+ * which accompanies this distribution, and is available at
7
+ * http://www.eclipse.org/legal/epl-v10.html
8
+ *
9
+ * Contributors:
10
+ * Jevon Wright - initial API and implementation
11
+ ****************************************************************************/
12
+
13
+ /**
14
+ * Tries to convert the given HTML into a plain text format - best suited for
15
+ * e-mail display, etc.
16
+ *
17
+ * <p>In particular, it tries to maintain the following features:
18
+ * <ul>
19
+ * <li>Links are maintained, with the 'href' copied over
20
+ * <li>Information in the &lt;head&gt; is lost
21
+ * </ul>
22
+ *
23
+ * @param html the input HTML
24
+ * @return the HTML converted, as best as possible, to text
25
+ */
26
+ class ICEshop_Iceimport_Helper_Format extends Mage_Core_Helper_Abstract
27
+ {
28
+ /**
29
+ * @param $html
30
+ * @return mixed|string
31
+ */
32
+ public function convert_html_to_text($html)
33
+ {
34
+ $html = $this->fix_newlines($html);
35
+
36
+ $doc = new DOMDocument();
37
+ if (!$doc->loadHTML($html))
38
+ return "Could not load HTML - badly formed?";
39
+
40
+ $output = $this->iterate_over_node($doc);
41
+
42
+ // remove leading and trailing spaces on each line
43
+ $output = preg_replace("/[ \t]*\n[ \t]*/im", "\n", $output);
44
+
45
+ // remove leading and trailing whitespace
46
+ $output = trim($output);
47
+
48
+ return $output;
49
+ }
50
+
51
+ /**
52
+ * Unify newlines; in particular, \r\n becomes \n, and
53
+ * then \r becomes \n. This means that all newlines (Unix, Windows, Mac)
54
+ * all become \ns.
55
+ *
56
+ * @param text text with any number of \r, \r\n and \n combinations
57
+ * @return the fixed text
58
+ */
59
+ private function fix_newlines($text)
60
+ {
61
+ // replace \r\n to \n
62
+ $text = str_replace("\r\n", "\n", $text);
63
+ // remove \rs
64
+ $text = str_replace("\r", "\n", $text);
65
+
66
+ return $text;
67
+ }
68
+
69
+ /**
70
+ * @param $node
71
+ * @return null|string
72
+ */
73
+ private function next_child_name($node)
74
+ {
75
+ // get the next child
76
+ $nextNode = $node->nextSibling;
77
+ while ($nextNode != null) {
78
+ if ($nextNode instanceof DOMElement) {
79
+ break;
80
+ }
81
+ $nextNode = $nextNode->nextSibling;
82
+ }
83
+ $nextName = null;
84
+ if ($nextNode instanceof DOMElement && $nextNode != null) {
85
+ $nextName = strtolower($nextNode->nodeName);
86
+ }
87
+
88
+ return $nextName;
89
+ }
90
+
91
+ /**
92
+ * @param $node
93
+ * @return null|string
94
+ */
95
+ private function prev_child_name($node)
96
+ {
97
+ // get the previous child
98
+ $nextNode = $node->previousSibling;
99
+ while ($nextNode != null) {
100
+ if ($nextNode instanceof DOMElement) {
101
+ break;
102
+ }
103
+ $nextNode = $nextNode->previousSibling;
104
+ }
105
+ $nextName = null;
106
+ if ($nextNode instanceof DOMElement && $nextNode != null) {
107
+ $nextName = strtolower($nextNode->nodeName);
108
+ }
109
+
110
+ return $nextName;
111
+ }
112
+
113
+ /**
114
+ * @param $node
115
+ * @return mixed|string
116
+ */
117
+ private function iterate_over_node($node)
118
+ {
119
+ if ($node instanceof DOMText) {
120
+ return preg_replace("/\\s+/im", " ", $node->wholeText);
121
+ }
122
+ if ($node instanceof DOMDocumentType) {
123
+ // ignore
124
+ return "";
125
+ }
126
+
127
+ $nextName = $this->next_child_name($node);
128
+ $prevName = $this->prev_child_name($node);
129
+
130
+ $name = strtolower($node->nodeName);
131
+
132
+ // start whitespace
133
+ switch ($name) {
134
+ case "hr":
135
+ return "------\n";
136
+
137
+ case "style":
138
+ case "head":
139
+ case "title":
140
+ case "meta":
141
+ case "script":
142
+ // ignore these tags
143
+ return "";
144
+
145
+ case "h1":
146
+ case "h2":
147
+ case "h3":
148
+ case "h4":
149
+ case "h5":
150
+ case "h6":
151
+ // add two newlines
152
+ $output = "\n";
153
+ break;
154
+
155
+ case "p":
156
+ case "div":
157
+ // add one line
158
+ $output = "\n";
159
+ break;
160
+
161
+ default:
162
+ // print out contents of unknown tags
163
+ $output = "";
164
+ break;
165
+ }
166
+
167
+ // debug
168
+ //$output .= "[$name,$nextName]";
169
+
170
+ for ($i = 0; $i < $node->childNodes->length; $i++) {
171
+ $n = $node->childNodes->item($i);
172
+
173
+ $text = $this->iterate_over_node($n);
174
+
175
+ $output .= $text;
176
+ }
177
+
178
+ // end whitespace
179
+ switch ($name) {
180
+ case "style":
181
+ case "head":
182
+ case "title":
183
+ case "meta":
184
+ case "script":
185
+ // ignore these tags
186
+ return "";
187
+
188
+ case "tr":
189
+ case "h1":
190
+ case "h2":
191
+ case "h3":
192
+ case "h4":
193
+ case "h5":
194
+ case "h6":
195
+ $output .= "\n";
196
+ break;
197
+
198
+ case "td":
199
+ $output .= "\t";
200
+ break;
201
+
202
+ case "p":
203
+ case "br":
204
+ // add one line
205
+ if ($nextName != "div")
206
+ $output .= "\n";
207
+ break;
208
+
209
+ case "div":
210
+ // add one line only if the next child isn't a div
211
+ if ($nextName != "div" && $nextName != null)
212
+ $output .= "\n";
213
+ break;
214
+
215
+ case "a":
216
+ // links are returned in [text](link) format
217
+ $href = $node->getAttribute("href");
218
+ if ($href == null) {
219
+ // it doesn't link anywhere
220
+ if ($node->getAttribute("name") != null) {
221
+ $output = "[$output]";
222
+ }
223
+ } else {
224
+ if ($href == $output) {
225
+ // link to the same address: just use link
226
+ $output;
227
+ } else {
228
+ // replace it
229
+ $output = "[$output]($href)";
230
+ }
231
+ }
232
+
233
+ // does the next node require additional whitespace?
234
+ switch ($nextName) {
235
+ case "h1":
236
+ case "h2":
237
+ case "h3":
238
+ case "h4":
239
+ case "h5":
240
+ case "h6":
241
+ $output .= "\n";
242
+ break;
243
+ }
244
+
245
+ default:
246
+ // do nothing
247
+ }
248
+
249
+ return $output;
250
+ }
251
+ }
app/code/community/ICEshop/Iceimport/Helper/System/System.php ADDED
@@ -0,0 +1,461 @@
1
+ <?php
2
+
3
+ /**
4
+ * Class Iceshop_Iceimport_Helper_System_System
5
+ */
6
+ class Iceshop_Iceimport_Helper_System_System extends Mage_Core_Helper_Abstract
7
+ {
8
+ /**
9
+ * Sorts a multi-dimensional array with the given values
10
+ *
11
+ * Seen and modified from: http://www.firsttube.com/read/sorting-a-multi-dimensional-array-with-php/
12
+ *
13
+ * @param array $arr Array to sort
14
+ * @param string $key Field to sort
15
+ * @param string $dir Direction to sort
16
+ * @return array Sorted array
17
+ */
18
+ public function sortMultiDimArr($arr, $key, $dir = 'ASC')
19
+ {
20
+ foreach ($arr as $k => $v) {
21
+ $b[$k] = strtolower($v[$key]);
22
+ }
23
+
24
+ if ($dir == 'ASC') {
25
+ asort($b);
26
+ } else {
27
+ arsort($b);
28
+ }
29
+ foreach ($b as $key => $val) {
30
+ $c[] = $arr[$key];
31
+ }
32
+
33
+ return $c;
34
+ }
35
+
36
+ /**
37
+ * Activate/Deactivate a Magento module
38
+ *
39
+ * @param string $name
40
+ * @return string
41
+ */
42
+ public function deactivateModule($name)
43
+ {
44
+ $isDeactivationPossible = true;
45
+ foreach (Mage::getConfig()->getNode('modules')->children() as $moduleName => $item) {
46
+ if ($moduleName == $name) {
47
+ continue;
48
+ }
49
+ if ($item->depends) {
50
+ foreach ($item->depends->children() as $depend) {
51
+ if ($depend->getName() == $name) {
52
+ if ((string)Mage::getConfig()->getModuleConfig($moduleName)->is('active', 'true')) {
53
+ $isDeactivationPossible = false;
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
59
+
60
+ if ($isDeactivationPossible) {
61
+ $xmlPath = Mage::getBaseDir() . DS . 'app' . DS . 'etc' . DS . 'modules' . DS . $name . '.xml';
62
+ if (file_exists($xmlPath)) {
63
+ $xmlObj = new Varien_Simplexml_Config($xmlPath);
64
+
65
+ $currentValue = (string)$xmlObj->getNode('modules/' . $name . '/active');
66
+ if ($currentValue == 'true') {
67
+ $value = false;
68
+ } else {
69
+ $value = true;
70
+ }
71
+
72
+ $xmlObj->setNode(
73
+ 'modules/' . $name . '/active',
74
+ $value ? 'true' : 'false'
75
+ );
76
+
77
+ if (is_writable($xmlPath)) {
78
+ $xmlData = $xmlObj->getNode()->asNiceXml();
79
+ @file_put_contents($xmlPath, $xmlData);
80
+ Mage::app()->getCacheInstance()->clean();
81
+ if ($value) {
82
+ $status = $this->__('The module "%s" has been successfully activated.', $name);
83
+ } else {
84
+ $status = $this->__('The module "%s" has been successfully deactivated.', $name);
85
+ }
86
+ } else {
87
+ $status = $this->__('File %s is not writable.', $xmlPath);
88
+ }
89
+ } else {
90
+ $status = $this->__(
91
+ 'Module %s is probably not installed. File %s does not exist.',
92
+ $name,
93
+ $xmlPath
94
+ );
95
+ }
96
+ } else {
97
+ $status = $this->__('Module can\'t be deactivated because it is a dependency of another module which is still active.');
98
+ }
99
+
100
+ return $status;
101
+ }
102
+
103
+ /**
104
+ * Retrieve a collection of all rewrites
105
+ *
106
+ * @return Varien_Data_Collection Collection
107
+ */
108
+ public function getRewriteCollection()
109
+ {
110
+ $collection = new Varien_Data_Collection();
111
+ $rewrites = $this->_loadRewrites();
112
+
113
+ foreach ($rewrites as $rewriteNodes) {
114
+ foreach ($rewriteNodes as $n) {
115
+ $nParent = $n->xpath('..');
116
+ $module = (string)$nParent[0]->getName();
117
+ $nSubParent = $nParent[0]->xpath('..');
118
+ $component = (string)$nSubParent[0]->getName();
119
+
120
+ if (!in_array($component, array('blocks', 'helpers', 'models'))) {
121
+ continue;
122
+ }
123
+
124
+ $pathNodes = $n->children();
125
+ foreach ($pathNodes as $pathNode) {
126
+ $path = (string)$pathNode->getName();
127
+ $completePath = $module . '/' . $path;
128
+
129
+ $rewriteClassName = (string)$pathNode;
130
+
131
+ $instance = Mage::getConfig()->getGroupedClassName(
132
+ substr($component, 0, -1),
133
+ $completePath
134
+ );
135
+
136
+ $collection->addItem(
137
+ new Varien_Object(
138
+ array(
139
+ 'path' => $completePath,
140
+ 'rewrite_class' => $rewriteClassName,
141
+ 'active_class' => $instance,
142
+ 'status' => ($instance == $rewriteClassName)
143
+ )
144
+ )
145
+ );
146
+ }
147
+ }
148
+ }
149
+
150
+ return $collection;
151
+ }
152
+
153
+ /**
154
+ * Return all rewrites
155
+ *
156
+ * @return array All rwrites
157
+ */
158
+ protected function _loadRewrites()
159
+ {
160
+ $fileName = 'config.xml';
161
+ $modules = Mage::getConfig()->getNode('modules')->children();
162
+
163
+ $return = array();
164
+ foreach ($modules as $modName => $module) {
165
+ if ($module->is('active')) {
166
+ $configFile = Mage::getConfig()->getModuleDir('etc', $modName) . DS . $fileName;
167
+ if (file_exists($configFile)) {
168
+ $xml = file_get_contents($configFile);
169
+ $xml = simplexml_load_string($xml);
170
+
171
+ if ($xml instanceof SimpleXMLElement) {
172
+ $return[$modName] = $xml->xpath('//rewrite');
173
+ }
174
+ }
175
+ }
176
+ }
177
+
178
+ return $return;
179
+ }
180
+
181
+ /**
182
+ * Retrieve a collection of all modules
183
+ *
184
+ * @return Varien_Data_Collection Collection
185
+ */
186
+ public function getModulesCollection()
187
+ {
188
+ $sortValue = Mage::app()->getRequest()->getParam('sort', 'name');
189
+ $sortValue = strtolower($sortValue);
190
+
191
+ $sortDir = Mage::app()->getRequest()->getParam('dir', 'ASC');
192
+ $sortDir = strtoupper($sortDir);
193
+
194
+ $modules = $this->_loadModules();
195
+ $modules = $this->sortMultiDimArr($modules, $sortValue, $sortDir);
196
+
197
+ $collection = new Varien_Data_Collection();
198
+ foreach ($modules as $val) {
199
+ $item = new Varien_Object($val);
200
+ $collection->addItem($item);
201
+ }
202
+
203
+ return $collection;
204
+ }
205
+
206
+ /**
207
+ * Loads the module configurations and checks for some criteria and
208
+ * returns an array with the current modules in the Magento instance.
209
+ *
210
+ * @return array Modules
211
+ */
212
+ protected function _loadModules()
213
+ {
214
+ $modules = array();
215
+ $config = Mage::getConfig();
216
+ foreach ($config->getNode('modules')->children() as $item) {
217
+ $active = ($item->active == 'true') ? true : false;
218
+ $codePool = (string)$config->getModuleConfig($item->getName())->codePool;
219
+ $path = $config->getOptions()->getCodeDir() . DS . $codePool . DS . uc_words($item->getName(), DS);
220
+ $pathExists = file_exists($path);
221
+ $pathExists = $pathExists ? true : false;
222
+ $configExists = file_exists($path . '/etc/config.xml');
223
+ $configExists = $configExists ? true : false;
224
+ $version = (string)$config->getModuleConfig($item->getName())->version;
225
+
226
+ $dependencies = '-';
227
+ if ($item->depends) {
228
+ $depends = array();
229
+ foreach ($item->depends->children() as $depend) {
230
+ $depends[] = $depend->getName();
231
+ }
232
+ if (is_array($depends) && count($depends) > 0) {
233
+ asort($depends);
234
+ $dependencies = implode("\n", $depends);
235
+ }
236
+ }
237
+
238
+ $modules[$item->getName()] = array(
239
+ 'name' => $item->getName(),
240
+ 'active' => $active,
241
+ 'code_pool' => $codePool,
242
+ 'path' => $path,
243
+ 'path_exists' => $pathExists,
244
+ 'config_exists' => $configExists,
245
+ 'version' => $version,
246
+ 'dependencies' => $dependencies
247
+ );
248
+ }
249
+
250
+ return $modules;
251
+ }
252
+
253
+ /**
254
+ * Retrieve a collection of all events
255
+ *
256
+ * @return Varien_Data_Collection Collection
257
+ */
258
+ public function getEventsCollection()
259
+ {
260
+ $sortValue = Mage::app()->getRequest()->getParam('sort', 'event');
261
+ $sortValue = strtolower($sortValue);
262
+
263
+ $sortDir = Mage::app()->getRequest()->getParam('dir', 'ASC');
264
+ $sortDir = strtoupper($sortDir);
265
+
266
+ $events = $this->_loadEvents();
267
+ $events = $this->sortMultiDimArr($events, $sortValue, $sortDir);
268
+
269
+ $collection = new Varien_Data_Collection();
270
+ foreach ($events as $item) {
271
+ $values = $item['children'];
272
+ if (is_array($values)) {
273
+ asort($values);
274
+ }
275
+
276
+ $val = array(
277
+ 'event' => $item['event'],
278
+ 'location' => implode("\n", $values)
279
+ );
280
+
281
+ $item = new Varien_Object($val);
282
+ $collection->addItem($item);
283
+ }
284
+
285
+ return $collection;
286
+ }
287
+
288
+ /**
289
+ * Return all events
290
+ *
291
+ * @return array All events
292
+ */
293
+ protected function _loadEvents()
294
+ {
295
+ $fileName = 'config.xml';
296
+ $modules = Mage::getConfig()->getNode('modules')->children();
297
+
298
+ $events = array();
299
+ foreach ($modules as $modName => $module) {
300
+ if ($module->is('active')) {
301
+ $configFile = Mage::getConfig()->getModuleDir('etc', $modName) . DS . $fileName;
302
+ if (file_exists($configFile)) {
303
+ $xml = file_get_contents($configFile);
304
+ $xml = simplexml_load_string($xml);
305
+
306
+ if ($xml instanceof SimpleXMLElement) {
307
+ $events[$modName] = $xml->xpath('//events');
308
+ }
309
+ }
310
+ }
311
+ }
312
+
313
+ $return = array();
314
+ foreach ($events as $eventNodes) {
315
+ foreach ($eventNodes as $n) {
316
+ $pathNodes = $n->children();
317
+
318
+ foreach ($pathNodes as $pathNode) {
319
+ $eventName = (string)$pathNode->getName();
320
+ $instance = $pathNode->xpath('observers/node()/class');
321
+ $instance = (string)current($instance);
322
+ $instance = Mage::getConfig()->getModelClassName($instance);
323
+
324
+ if (!array_key_exists($eventName, $return)) {
325
+ $return[$eventName] = array(
326
+ 'event' => $eventName,
327
+ 'children' => array()
328
+ );
329
+ }
330
+ if (!in_array($instance, $return[$eventName])) {
331
+ $return[$eventName]['children'][] = $instance;
332
+ }
333
+ }
334
+ }
335
+ }
336
+
337
+ return $return;
338
+ }
339
+
340
+ /**
341
+ * Checks if one or more caches are active
342
+ *
343
+ * @return string Cache Message
344
+ */
345
+ public function checkCaches()
346
+ {
347
+ $active = 0;
348
+ $inactive = 0;
349
+ foreach (Mage::app()->getCacheInstance()->getTypes() as $type) {
350
+ $tmp = $type->getData();
351
+ if ($tmp['status']) {
352
+ $active++;
353
+ } else {
354
+ $inactive++;
355
+ }
356
+ }
357
+
358
+ return $this->__(
359
+ '%s caches active, %s caches inactive',
360
+ $active,
361
+ $inactive
362
+ );
363
+ }
364
+
365
+ /**
366
+ * Checks if all indexes are up-to-date
367
+ *
368
+ * @return string Indexes Message
369
+ */
370
+ public function checkIndizes()
371
+ {
372
+ $ready = 0;
373
+ $processing = 0;
374
+ $reindex = 0;
375
+
376
+ $collection = Mage::getResourceModel('index/process_collection');
377
+ foreach ($collection as $item) {
378
+ $tmp = $item->getData();
379
+ if ($tmp['status'] == 'pending') {
380
+ $ready++;
381
+ } elseif ($tmp['status'] == 'working') {
382
+ $processing++;
383
+ } else {
384
+ $reindex++;
385
+ }
386
+ }
387
+
388
+ return $this->__(
389
+ '%s indexes are ready, %s indexes are working, %s indexes need reindex',
390
+ $ready,
391
+ $processing,
392
+ $reindex
393
+ );
394
+ }
395
+
396
+ /**
397
+ * Returns a small system check report with some essential properties
398
+ *
399
+ * @return array Extension Check Result
400
+ */
401
+ public function checkSystem()
402
+ {
403
+ return $this->_extensionCheck(
404
+ array(
405
+ 'curl',
406
+ 'dom',
407
+ 'gd',
408
+ 'hash',
409
+ 'iconv',
410
+ 'mcrypt',
411
+ 'pcre',
412
+ 'pdo',
413
+ 'pdo_mysql',
414
+ 'simplexml'
415
+ )
416
+ );
417
+ }
418
+
419
+ /**
420
+ * Checks some kind of essential properties
421
+ *
422
+ * @param string $extensions Extensions to check
423
+ * @return array Array with failed and passed checks
424
+ */
425
+ protected function _extensionCheck($extensions)
426
+ {
427
+ $fail = array();
428
+ $pass = array();
429
+
430
+ if (version_compare(phpversion(), '5.2.0', '<')) {
431
+ $fail[] = 'You need <strong>PHP 5.2.0</strong> (or greater)';
432
+ } else {
433
+ $pass[] = 'You have <strong>PHP 5.2.0</strong> (or greater)';
434
+ }
435
+
436
+ if (!ini_get('safe_mode')) {
437
+ $pass[] = 'Safe Mode is <strong>off</strong>';
438
+
439
+ $con = Mage::getSingleton('core/resource')->getConnection('core_read');
440
+ $version = $con->getServerVersion();
441
+
442
+ if (version_compare($version, '4.1.20', '<')) {
443
+ $fail[] = 'You need <strong>MySQL 4.1.20</strong> (or greater)';
444
+ } else {
445
+ $pass[] = 'You have <strong>MySQL 4.1.20</strong> (or greater)';
446
+ }
447
+ } else {
448
+ $fail[] = 'Safe Mode is <strong>on</strong>';
449
+ }
450
+
451
+ foreach ($extensions as $extension) {
452
+ if (!extension_loaded($extension)) {
453
+ $fail[] = 'You are missing the <strong>' . $extension . '</strong> extension';
454
+ } else {
455
+ $pass[] = 'You have the <strong>' . $extension . '</strong> extension';
456
+ }
457
+ }
458
+
459
+ return array('pass' => $pass, 'fail' => $fail);
460
+ }
461
+ }
app/code/community/ICEshop/Iceimport/Helper/System/Systemcheck.php ADDED
@@ -0,0 +1,623 @@
1
+ <?php
2
+
3
+ /**
4
+ * Class ICEshop_Iceimport_Helper_System_Systemcheck
5
+ */
6
+ class ICEshop_Iceimport_Helper_System_Systemcheck extends Mage_Core_Helper_Abstract
7
+ {
8
+ /**
9
+ * @var Varien_Object
10
+ */
11
+ protected $_system;
12
+
13
+ protected function _getHelper()
14
+ {
15
+ return Mage::helper('iceimport/system_system');
16
+ }
17
+
18
+ /**
19
+ * @return Varien_Db_Adapter_Pdo_Mysql
20
+ */
21
+ protected function _getDb()
22
+ {
23
+ return Mage::getSingleton('core/resource')->getConnection('core_read');
24
+ }
25
+
26
+ /**
27
+ * @return $this
28
+ */
29
+ public function init()
30
+ {
31
+ $system = new Varien_Object();
32
+
33
+ /*
34
+ * MAGENTO
35
+ */
36
+ $magento = array(
37
+ 'edition' => (method_exists('Mage', 'getEdition')) ? Mage::getEdition() : '',
38
+ 'version' => (method_exists('Mage', 'getVersion')) ? Mage::getVersion() : '',
39
+ 'developer_mode' => (method_exists('Mage', 'getIsDeveloperMode')) ? Mage::getIsDeveloperMode() : '',
40
+ 'secret_key' => (method_exists('Mage', 'getStoreConfigFlag')) ? Mage::getStoreConfigFlag('admin/security/use_form_key') : '',
41
+ 'flat_catalog_category' => (method_exists('Mage', 'getStoreConfigFlag')) ? Mage::getStoreConfigFlag('catalog/frontend/flat_catalog_category') : '',
42
+ 'flat_catalog_product' => (method_exists('Mage', 'getStoreConfigFlag')) ? Mage::getStoreConfigFlag('catalog/frontend/flat_catalog_product') : ''
43
+ );
44
+ try {
45
+ $magento['cache_status'] = $this->_getHelper()->checkCaches();
46
+ $magento['index_status'] = $this->_getHelper()->checkIndizes();
47
+ } catch (Exception $e) {
48
+ $magento['exception'][] = array(
49
+ 'line' => $e->getLine(),
50
+ 'file' => $e->getFile(),
51
+ 'message' => $e->getMessage()
52
+ );
53
+ }
54
+ $system->setData('magento', new Varien_Object($magento));
55
+
56
+ /*
57
+ * SERVER
58
+ */
59
+
60
+ $server = array(
61
+ 'domain' => isset($_SERVER['HTTP_HOST']) ? str_replace('www.', '', $_SERVER['HTTP_HOST']) : null,
62
+ 'ip' => isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : (isset($_SERVER['LOCAL_ADDR']) ? $_SERVER['LOCAL_ADDR'] : ''),
63
+ 'dir' => (method_exists('Mage', 'getBaseDir')) ? Mage::getBaseDir() : '',
64
+ 'info' => php_uname(),
65
+
66
+ );
67
+ $system->setData('server', new Varien_Object($server));
68
+
69
+ /*
70
+ * PHP
71
+ */
72
+
73
+ $php = array(
74
+ 'version' => @phpversion(),
75
+ 'server_api' => @php_sapi_name(),
76
+ 'memory_limit' => @ini_get('memory_limit'),
77
+ 'max_execution_time' => @ini_get('max_execution_time')
78
+ );
79
+ $system->setData('php', new Varien_Object($php));
80
+
81
+ /*
82
+ * MySQL
83
+ */
84
+
85
+ // Get MySQL Server API
86
+ $connection = $this->_getDb()->getConnection();
87
+ if ($connection instanceof PDO) {
88
+ $mysqlServerApi = $connection->getAttribute(PDO::ATTR_CLIENT_VERSION);
89
+ } else {
90
+ $mysqlServerApi = 'n/a';
91
+ }
92
+
93
+ // Get table prefix
94
+ $tablePrefix = (string)Mage::getConfig()->getTablePrefix();
95
+ if (empty($tablePrefix)) {
96
+ $tablePrefix = $this->__('Disabled');
97
+ }
98
+
99
+ // Get MySQL vars
100
+ $sqlQuery = "SHOW VARIABLES;";
101
+ $sqlResult = $this->_getDb()->fetchAll($sqlQuery);
102
+ $mysqlVars = array();
103
+ foreach ($sqlResult as $mysqlVar) {
104
+ $mysqlVars[$mysqlVar['Variable_name']] = $mysqlVar['Value'];
105
+ }
106
+
107
+ $mysql = array(
108
+ 'version' => $this->_getDb()->getServerVersion(),
109
+ 'server_api' => $mysqlServerApi,
110
+ 'database_name' => (string)Mage::getConfig()->getNode('global/resources/default_setup/connection/dbname'),
111
+ 'database_tables' => count($this->_getDb()->listTables()),
112
+ 'table_prefix' => $tablePrefix,
113
+ 'connection_timeout' => $mysqlVars['connect_timeout'] . ' sec.',
114
+ 'wait_timeout' => $mysqlVars['wait_timeout'] . ' sec.',
115
+ 'max_allowed_packet' => array(
116
+ 'current_value' => $mysqlVars['max_allowed_packet'] . ' bytes',
117
+ 'recommended_value' => '>= ' . (16 * 1024 * 1024),
118
+ 'result' => ($mysqlVars['max_allowed_packet'] >= (16 * 1024 * 1024)),
119
+ 'label' => 'Max Allowed Packet',
120
+ 'advice' => array(
121
+ 'label' => $this->__('The maximum size of one packet or any generated/intermediate string.'),
122
+ 'link' => 'https://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_max_allowed_packet'
123
+ )
124
+ ),
125
+ 'thread_stack' => array(
126
+ 'current_value' => $mysqlVars['thread_stack'] . ' bytes',
127
+ 'recommended_value' => '>= ' . (192 * 1024),
128
+ 'result' => ($mysqlVars['thread_stack'] >= (192 * 1024)),
129
+ 'label' => 'Thread Stack',
130
+ 'advice' => array(
131
+ 'label' => $this->__('The stack size for each thread.'),
132
+ 'link' => 'https://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_thread_stack'
133
+ )
134
+ )
135
+ );
136
+ $system->setData('mysql', new Varien_Object($mysql));
137
+ $system->setData('mysql_vars', new Varien_Object($mysqlVars));
138
+
139
+ /*
140
+ * System Requirements
141
+ */
142
+
143
+ if (version_compare($php['version'], '5.3.0', '>=')) {
144
+ $safeMode['current_value'] = 'Deprecated';
145
+ $safeMode['result'] = false;
146
+ } else {
147
+ $safeMode['result'] = (@ini_get('safe_mode')) ? true : false;
148
+ $safeMode['current_value'] = $this->renderBooleanField($safeMode['result']);
149
+ }
150
+ $memoryLimit = $php['memory_limit'];
151
+ $memoryLimit = substr($memoryLimit, 0, strlen($memoryLimit) - 1);
152
+ $phpCurl = @extension_loaded('curl');
153
+ $phpDom = @extension_loaded('dom');
154
+ $phpGd = @extension_loaded('gd');
155
+ $phpHash = @extension_loaded('hash');
156
+ $phpIconv = @extension_loaded('iconv');
157
+ $phpMcrypt = @extension_loaded('mcrypt');
158
+ $phpPcre = @extension_loaded('pcre');
159
+ $phpPdo = @extension_loaded('pdo');
160
+ $phpPdoMysql = @extension_loaded('pdo_mysql');
161
+ $phpSimplexml = @extension_loaded('simplexml');
162
+
163
+ $requirements = array(
164
+ 'php_version' => array(
165
+ 'label' => 'PHP Version',
166
+ 'recommended_value' => '>= 5.3.0',
167
+ 'current_value' => $php['version'],
168
+ 'result' => version_compare($php['version'], '5.3.0', '>='),
169
+ 'advice' => array(
170
+ 'label' => $this->__('PHP version at least 5.3.0 required, recommended to use latest stable release.'),
171
+ 'link' => 'http://php.net/downloads.php'
172
+ )
173
+ ),
174
+ 'mysql_version' => array(
175
+ 'label' => 'MySQL Version',
176
+ 'recommended_value' => '>= 4.1.20',
177
+ 'current_value' => $mysql['version'],
178
+ 'result' => version_compare($mysql['version'], '4.1.20', '>='),
179
+ 'advice' => array(
180
+ 'label' => $this->__('MySQL version at least 4.1.20 required, recommended to use latest stable release.'),
181
+ 'link' => 'http://dev.mysql.com/downloads/mysql/'
182
+ )
183
+ ),
184
+ 'safe_mode' => array(
185
+ 'label' => 'Safe Mode',
186
+ 'recommended_value' => $this->renderBooleanField(false),
187
+ 'current_value' => $safeMode['current_value'],
188
+ 'result' => !$safeMode['result'],
189
+ 'advice' => array(
190
+ 'label' => $this->__('The PHP safe mode is an attempt to solve the shared-server security problem. Deprecated since PHP 5.3.0'),
191
+ 'link' => 'http://www.php.net/manual/en/features.safe-mode.php'
192
+ )
193
+ ),
194
+ 'memory_limit' => array(
195
+ 'label' => 'Memory Limit',
196
+ 'recommended_value' => '>= 512M',
197
+ 'current_value' => $php['memory_limit'],
198
+ 'result' => ($memoryLimit >= 512),
199
+ 'advice' => array(
200
+ 'label' => $this->__('Maximum amount of memory in bytes that a script is allowed to allocate.'),
201
+ 'link' => 'http://ua2.php.net/manual/en/ini.core.php#ini.memory-limit'
202
+ )
203
+ ),
204
+ 'max_execution_time' => array(
205
+ 'label' => 'Max. Execution Time',
206
+ 'recommended_value' => '>= 360 sec.',
207
+ 'current_value' => $php['max_execution_time'],
208
+ 'result' => ($php['max_execution_time'] >= 360),
209
+ 'advice' => array(
210
+ 'label' => $this->__('This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser.'),
211
+ 'link' => 'http://ua2.php.net/manual/en/info.configuration.php#ini.max-execution-time'
212
+ )
213
+ ),
214
+ 'curl' => array(
215
+ 'label' => 'curl',
216
+ 'recommended_value' => $this->renderBooleanField(true),
217
+ 'current_value' => $this->renderBooleanField($phpCurl),
218
+ 'result' => $phpCurl,
219
+ 'advice' => array(
220
+ 'label' => $this->__('CURL is a library that allows to connect and communicate via a variety of different protocols such as HTTP, HTTPS, FTP, Telnet etc.'),
221
+ 'link' => 'http://www.tomjepson.co.uk/enabling-curl-in-php-php-ini-wamp-xamp-ubuntu/'
222
+ )
223
+ ),
224
+ 'dom' => array(
225
+ 'label' => 'dom',
226
+ 'recommended_value' => $this->renderBooleanField(true),
227
+ 'current_value' => $this->renderBooleanField($phpDom),
228
+ 'result' => $phpDom,
229
+ 'advice' => array(
230
+ 'label' => $this->__('The DOM extension allows to operate on XML documents through the DOM API with PHP 5.'),
231
+ 'link' => 'http://www.php.net/manual/en/dom.setup.php'
232
+ )
233
+ ),
234
+ 'gd' => array(
235
+ 'label' => 'gd',
236
+ 'recommended_value' => $this->renderBooleanField(true),
237
+ 'current_value' => $this->renderBooleanField($phpGd),
238
+ 'result' => $phpGd,
239
+ 'advice' => array(
240
+ 'label' => $this->__('GD is a library which supports a variety of formats, below is a list of formats supported by GD and notes to their availability including read/write support.'),
241
+ 'link' => 'http://www.php.net/manual/en/image.installation.php'
242
+ )
243
+ ),
244
+ 'hash' => array(
245
+ 'label' => 'hash',
246
+ 'recommended_value' => $this->renderBooleanField(true),
247
+ 'current_value' => $this->renderBooleanField($phpHash),
248
+ 'result' => $phpHash,
249
+ 'advice' => array(
250
+ 'label' => $this->__('Hash is a library which allows direct or incremental processing of arbitrary length messages using a variety of hashing algorithms.'),
251
+ 'link' => 'http://www.php.net/manual/en/hash.setup.php'
252
+ )
253
+ ),
254
+ 'iconv' => array(
255
+ 'label' => 'iconv',
256
+ 'recommended_value' => $this->renderBooleanField(true),
257
+ 'current_value' => $this->renderBooleanField($phpIconv),
258
+ 'result' => $phpIconv,
259
+ 'advice' => array(
260
+ 'label' => $this->__('Iconv is a module which contains an interface to iconv character set conversion facility.'),
261
+ 'link' => 'http://ua1.php.net/manual/en/iconv.installation.php'
262
+ )
263
+ ),
264
+ 'mcrypt' => array(
265
+ 'label' => 'mcrypt',
266
+ 'recommended_value' => $this->renderBooleanField(true),
267
+ 'current_value' => $this->renderBooleanField($phpMcrypt),
268
+ 'result' => $phpMcrypt,
269
+ 'advice' => array(
270
+ 'label' => $this->__('Mcrypt library supports a wide variety of block algorithms such as DES, TripleDES, Blowfish (default), 3-WAY, SAFER-SK64, SAFER-SK128, TWOFISH, TEA, RC2 and GOST in CBC, OFB, CFB and ECB cipher modes.'),
271
+ 'link' => 'http://www.php.net/manual/en/mcrypt.installation.php'
272
+ )
273
+ ),
274
+ 'pcre' => array(
275
+ 'label' => 'pcre',
276
+ 'recommended_value' => $this->renderBooleanField(true),
277
+ 'current_value' => $this->renderBooleanField($phpPcre),
278
+ 'result' => $phpPcre,
279
+ 'advice' => array(
280
+ 'label' => $this->__('The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5, with just a few differences.'),
281
+ 'link' => 'http://www.php.net/manual/en/pcre.installation.php'
282
+ )
283
+ ),
284
+ 'pdo' => array(
285
+ 'label' => 'pdo',
286
+ 'recommended_value' => $this->renderBooleanField(true),
287
+ 'current_value' => $this->renderBooleanField($phpPdo),
288
+ 'result' => $phpPdo,
289
+ 'advice' => array(
290
+ 'label' => $this->__('The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP.'),
291
+ 'link' => 'http://www.php.net/manual/en/pdo.installation.php'
292
+ )
293
+ ),
294
+ 'pdo_mysql' => array(
295
+ 'label' => 'pdo_mysql',
296
+ 'recommended_value' => $this->renderBooleanField(true),
297
+ 'current_value' => $this->renderBooleanField($phpPdoMysql),
298
+ 'result' => $phpPdoMysql,
299
+ 'advice' => array(
300
+ 'label' => $this->__('PDO_MYSQL is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to MySQL 3.x, 4.x and 5.x databases.'),
301
+ 'link' => 'http://ua1.php.net/pdo_mysql#ref.pdo-mysql.installation'
302
+ )
303
+ ),
304
+ 'simplexml' => array(
305
+ 'label' => 'simplexml',
306
+ 'recommended_value' => $this->renderBooleanField(true),
307
+ 'current_value' => $this->renderBooleanField($phpSimplexml),
308
+ 'result' => $phpSimplexml,
309
+ 'advice' => array(
310
+ 'label' => $this->__('The SimpleXML extension provides a very simple and easily usable toolset to convert XML to an object that can be processed with normal property selectors and array iterators.'),
311
+ 'link' => 'http://www.php.net/manual/en/simplexml.installation.php'
312
+ )
313
+ )
314
+ );
315
+ $system->setData('requirements', new Varien_Object($requirements));
316
+
317
+ $magento_api = array();
318
+ $magento_api['charset'] = Mage::getStoreConfig("api/config/charset");
319
+ $magento_api_session_timeout = Mage::getStoreConfig('api/config/session_timeout');
320
+ $magento_api['session_timeout'] = array(
321
+ 'result' => ($magento_api_session_timeout >= 3600),
322
+ 'current_value' => $magento_api_session_timeout,
323
+ 'label' => 'Client Session Timeout (sec.)',
324
+ 'recommended_value' => '>= 3600',
325
+ 'advice' => array(
326
+ 'label' => $this->__('This sets the maximum time in seconds a script is allowed to use Magento Core API using one session ID.'),
327
+ 'link' => 'http://www.magentocommerce.com/boards/viewthread/19445/'
328
+ )
329
+ );
330
+ $magento_api['compliance_wsi'] = Mage::getStoreConfig(Mage_Api_Helper_Data::XML_PATH_API_WSI);;
331
+ $magento_api['wsdl_cache_enabled'] = Mage::getStoreConfig('api/config/wsdl_cache_enabled');
332
+ $system->setData('magento_api', new Varien_Object($magento_api));
333
+
334
+ $this->_system = $system;
335
+
336
+ return $this;
337
+ }
338
+
339
+ /**
340
+ * @return Varien_Object
341
+ */
342
+ public function getSystem()
343
+ {
344
+ return $this->_system;
345
+ }
346
+
347
+ /**
348
+ * @param boolean $value
349
+ * @return string
350
+ */
351
+ public function renderBooleanField($value)
352
+ {
353
+ if ($value) {
354
+ return $this->__('Enabled');
355
+ }
356
+ return $this->__('Disabled');
357
+ }
358
+
359
+ /**
360
+ * @param $result
361
+ * @return string
362
+ */
363
+ public function renderRequirementValue($result)
364
+ {
365
+ if ($result) {
366
+ return 'requirement-passed';
367
+ }
368
+ return 'requirement-failed';
369
+ }
370
+
371
+ /**
372
+ * @param $result
373
+ * @return string
374
+ */
375
+ public function renderStatusField($value)
376
+ {
377
+ if ($value) {
378
+ return $this->__('Ok');
379
+ }
380
+ return $this->__('Error');
381
+ }
382
+
383
+ public function renderAdvice($value)
384
+ {
385
+ if (!empty($value) && !empty($value['advice'])) {
386
+ return '<a ' . (!empty($value['advice']['link']) ? 'href="' . $value['advice']['link'] . '" target="_blank"' : 'href="#"') . '" class="iceimport-advice" title="' . $value['advice']['label'] . '"></a>';
387
+ }
388
+ return '';
389
+ }
390
+
391
+ /**
392
+ * Retrieve a collection of all modules
393
+ *
394
+ * @return Varien_Data_Collection Collection
395
+ */
396
+ public function getModulesCollection($exact = false)
397
+ {
398
+ $sortValue = Mage::app()->getRequest()->getParam('sort', 'name');
399
+ $sortValue = strtolower($sortValue);
400
+
401
+ $sortDir = Mage::app()->getRequest()->getParam('dir', 'ASC');
402
+ $sortDir = strtoupper($sortDir);
403
+
404
+ $modules = $this->_loadModules($exact);
405
+ $modules = Mage::helper('iceimport')->sortMultiDimArr($modules, $sortValue, $sortDir);
406
+
407
+ $collection = new Varien_Data_Collection();
408
+ foreach ($modules as $key => $val) {
409
+ $item = new Varien_Object($val);
410
+ $collection->addItem($item);
411
+ }
412
+
413
+ return $collection;
414
+ }
415
+
416
+ /**
417
+ * Loads the module configurations and checks for some criteria and
418
+ * returns an array with the current modules in the Magento instance.
419
+ *
420
+ * @return array Modules
421
+ */
422
+ protected function _loadModules($exact = false)
423
+ {
424
+ $modules = array();
425
+ $config = Mage::getConfig();
426
+ foreach ($config->getNode('modules')->children() as $moduleName => $item) {
427
+ if (!empty($exact) && strlen($exact) != 0) {
428
+ if (strpos(strtolower($moduleName), strtolower($exact)) === false) {
429
+ continue;
430
+ }
431
+ }
432
+ $active = ($item->active == 'true') ? true : false;
433
+ $codePool = (string)$config->getModuleConfig($item->getName())->codePool;
434
+ $path = $config->getOptions()->getCodeDir() . DS . $codePool . DS . uc_words($item->getName(), DS);
435
+ $pathExists = file_exists($path);
436
+ $pathExists = $pathExists ? true : false;
437
+ $configExists = file_exists($path . '/etc/config.xml');
438
+ $configExists = $configExists ? true : false;
439
+ $version = (string)$config->getModuleConfig($item->getName())->version;
440
+ $dependencies = '-';
441
+ if ($item->depends) {
442
+ $depends = array();
443
+ foreach ($item->depends->children() as $depend) {
444
+ $depends[] = $depend->getName();
445
+ }
446
+ if (is_array($depends) && count($depends) > 0) {
447
+ asort($depends);
448
+ $dependencies = implode("\n", $depends);
449
+ }
450
+ }
451
+
452
+ $modules[$item->getName()] = array(
453
+ 'name' => $item->getName(),
454
+ 'active' => $active,
455
+ 'code_pool' => $codePool,
456
+ 'path' => $path,
457
+ 'path_exists' => $pathExists,
458
+ 'config_exists' => $configExists,
459
+ 'version' => $version,
460
+ 'dependencies' => $dependencies
461
+ );
462
+ }
463
+
464
+ return $modules;
465
+ }
466
+
467
+
468
+ /**
469
+ * Retrieve a collection of all rewrites
470
+ *
471
+ * @return Varien_Data_Collection Collection
472
+ */
473
+ public function getRewriteCollection($exact = false)
474
+ {
475
+ $collection = new Varien_Data_Collection();
476
+ $rewrites = $this->_loadRewrites();
477
+
478
+ foreach ($rewrites as $rewriteNodes) {
479
+ foreach ($rewriteNodes as $n) {
480
+ $nParent = $n->xpath('..');
481
+ $module = (string)$nParent[0]->getName();
482
+ $nSubParent = $nParent[0]->xpath('..');
483
+ $component = (string)$nSubParent[0]->getName();
484
+
485
+ if (!in_array($component, array('blocks', 'helpers', 'models'))) {
486
+ continue;
487
+ }
488
+
489
+ $pathNodes = $n->children();
490
+ foreach ($pathNodes as $pathNode) {
491
+ $path = (string)$pathNode->getName();
492
+ $completePath = $module . '/' . $path;
493
+ $rewriteClassName = (string)$pathNode;
494
+
495
+ if (!empty($exact) && strlen($exact) != 0) {
496
+ if ((strpos(strtolower($completePath), strtolower($exact)) === false)
497
+ && (strpos(strtolower($rewriteClassName), strtolower($exact)) === false)
498
+ ) {
499
+ continue;
500
+ }
501
+ }
502
+
503
+ $instance = Mage::getConfig()->getGroupedClassName(
504
+ substr($component, 0, -1),
505
+ $completePath
506
+ );
507
+
508
+ $collection->addItem(
509
+ new Varien_Object(
510
+ array(
511
+ 'path' => $completePath,
512
+ 'rewrite_class' => $rewriteClassName,
513
+ 'active_class' => $instance,
514
+ 'status' => ($instance == $rewriteClassName)
515
+ )
516
+ )
517
+ );
518
+ }
519
+ }
520
+ }
521
+
522
+ return $collection;
523
+ }
524
+
525
+ /**
526
+ * Return all rewrites
527
+ *
528
+ * @return array All rwrites
529
+ */
530
+ protected function _loadRewrites()
531
+ {
532
+ $fileName = 'config.xml';
533
+ $modules = Mage::getConfig()->getNode('modules')->children();
534
+
535
+ $return = array();
536
+ foreach ($modules as $modName => $module) {
537
+ if ($module->is('active')) {
538
+ $configFile = Mage::getConfig()->getModuleDir('etc', $modName) . DS . $fileName;
539
+ if (file_exists($configFile)) {
540
+ $xml = file_get_contents($configFile);
541
+ $xml = simplexml_load_string($xml);
542
+
543
+ if ($xml instanceof SimpleXMLElement) {
544
+ $return[$modName] = $xml->xpath('//rewrite');
545
+ }
546
+ }
547
+ }
548
+ }
549
+
550
+ return $return;
551
+ }
552
+
553
+ /**
554
+ * @return Varien_Object
555
+ */
556
+ public function getExtensionProblemsDigest()
557
+ {
558
+ $problems = array();
559
+ $count = 0;
560
+ //extension problems
561
+ $check_module = $this->getModulesCollection('ICEshop_Iceimport');
562
+ $check_module = $check_module->getLastItem()->getData();
563
+
564
+ if ($check_module['path_exists'] == 0) {
565
+ $problems['extension']['path_exists'] = $check_module['path_exists'];
566
+ $count++;
567
+ }
568
+ if ($check_module['config_exists'] == 0) {
569
+ $problems['extension']['config_exists'] = $check_module['config_exists'];
570
+ $count++;
571
+ }
572
+
573
+ //extension rewrites problems
574
+ $check_rewrites = $this->getRewriteCollection('ICEshop_Iceimport');
575
+ foreach ($check_rewrites as $rewrite) {
576
+ if (!$rewrite['status']) {
577
+ $problems['rewrite'][] = $rewrite;
578
+ $count++;
579
+ }
580
+ }
581
+
582
+ //system requirements (for magento/extension)
583
+ $requirements = $this->getSystem()->getRequirements()->getData();
584
+ foreach ($requirements as $requirement) {
585
+ if (!$requirement['result']) {
586
+ $problems['requirement'][] = $requirement;
587
+ $count++;
588
+ }
589
+ }
590
+
591
+ //magento API problems
592
+ $magento_api_session_timeout = $this->getSystem()->getMagentoApi()->getSessionTimeout();
593
+ if (!$magento_api_session_timeout['result']) {
594
+ $problems['api']['timeout'] = $magento_api_session_timeout;
595
+ $count++;
596
+ }
597
+
598
+ $mysql = $this->getSystem()->getMysql()->getData();
599
+ foreach ($mysql as $mysql_param_name => $mysql_param_value) {
600
+ if (is_array($mysql_param_value) && !$mysql_param_value['result']) {
601
+ $problems['mysql'][$mysql_param_name] = $mysql_param_value;
602
+ $count++;
603
+ }
604
+ }
605
+
606
+ $DB_logger = Mage::helper('iceimport/db');
607
+ $log_feed = $DB_logger->getLogByType('report');
608
+ if (!empty($log_feed) && count($log_feed) > 0) {
609
+ foreach($log_feed as $log_entry) {
610
+ $problems['iceimport_log'][] = array(
611
+ 'label' => 'Iceimport Error',
612
+ 'current_value' => $log_entry['log_value']
613
+ );
614
+ $count++;
615
+ }
616
+ }
617
+
618
+ $problems_digest = new Varien_Object();
619
+ $problems_digest->setData('problems', $problems);
620
+ $problems_digest->setData('count', $count);
621
+ return $problems_digest;
622
+ }
623
+ }
app/code/community/ICEshop/Iceimport/Model/Convert/Adapter/Product.php ADDED
@@ -0,0 +1,1447 @@