Skip to content

Commit 1c81083

Browse files
committed
[TASK] Code style
1 parent 894f1b1 commit 1c81083

19 files changed

Lines changed: 69 additions & 49 deletions

File tree

src/app/code/community/FireGento/AdminMonitoring/Block/Adminhtml/History.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* @copyright 2014 FireGento Team (http://www.firegento.com)
1919
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
2020
*/
21+
2122
/**
2223
* Displays the logging history grid container
2324
*

src/app/code/community/FireGento/AdminMonitoring/Model/Clean.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* @copyright 2014 FireGento Team (http://www.firegento.com)
1919
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
2020
*/
21+
2122
/**
2223
* Cleans the history after a configurable amount of time.
2324
*
@@ -71,7 +72,7 @@ public function clean()
7172
->addFieldToFilter(
7273
'created_at',
7374
array(
74-
'lt' => new Zend_Db_Expr("DATE_SUB('" . now() . "', INTERVAL " . (int) $interval . " DAY)")
75+
'lt' => new Zend_Db_Expr("DATE_SUB('" . now() . "', INTERVAL " . (int)$interval . " DAY)")
7576
)
7677
);
7778

src/app/code/community/FireGento/AdminMonitoring/Model/History/Data.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* @copyright 2014 FireGento Team (http://www.firegento.com)
1919
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
2020
*/
21+
2122
/**
2223
* History Data Model
2324
*
@@ -96,6 +97,7 @@ protected function _filterObligatoryFields($data)
9697
public function getOrigContent()
9798
{
9899
$data = $this->_savedModel->getOrigData();
100+
99101
return $this->_filterObligatoryFields($data);
100102
}
101103

src/app/code/community/FireGento/AdminMonitoring/Model/History/Diff.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* @copyright 2014 FireGento Team (http://www.firegento.com)
1919
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
2020
*/
21+
2122
/**
2223
* History Diff Model
2324
*
@@ -86,6 +87,7 @@ private function getObjectDiff()
8687
public function getSerializedDiff()
8788
{
8889
$dataDiff = $this->getObjectDiff();
90+
8991
return json_encode($dataDiff);
9092
}
9193
}

src/app/code/community/FireGento/AdminMonitoring/Model/Observer/Log.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* @copyright 2014 FireGento Team (http://www.firegento.com)
1919
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
2020
*/
21+
2122
/**
2223
* Logging model
2324
*
@@ -37,16 +38,16 @@ public function log(Varien_Event_Observer $observer)
3738
/* @var $history FireGento_AdminMonitoring_Model_History */
3839
$history = Mage::getModel('firegento_adminmonitoring/history');
3940
$history->setData(array(
40-
'object_id' => $observer->getObjectId(),
41-
'object_type' => $observer->getObjectType(),
42-
'content' => $observer->getContent(),
43-
'content_diff' => $observer->getContentDiff(),
44-
'user_agent' => $this->getUserAgent(),
45-
'ip' => $this->getRemoteAddr(),
46-
'user_id' => $this->getUserId(),
47-
'user_name' => $this->getUserName(),
48-
'action' => $observer->getAction(),
49-
'created_at' => now(),
41+
'object_id' => $observer->getObjectId(),
42+
'object_type' => $observer->getObjectType(),
43+
'content' => $observer->getContent(),
44+
'content_diff' => $observer->getContentDiff(),
45+
'user_agent' => $this->getUserAgent(),
46+
'ip' => $this->getRemoteAddr(),
47+
'user_id' => $this->getUserId(),
48+
'user_name' => $this->getUserName(),
49+
'action' => $observer->getAction(),
50+
'created_at' => now(),
5051
));
5152

5253
$history->save();
@@ -93,6 +94,7 @@ public function getUser()
9394
{
9495
/* @var $session Mage_Admin_Model_Session */
9596
$session = Mage::getSingleton('admin/session');
97+
9698
return $session->getUser();
9799
}
98100

@@ -103,7 +105,7 @@ public function getUser()
103105
*/
104106
public function getUserAgent()
105107
{
106-
return (isset($_SERVER['HTTP_USER_AGENT']) ? (string) $_SERVER['HTTP_USER_AGENT'] : '');
108+
return (isset($_SERVER['HTTP_USER_AGENT']) ? (string)$_SERVER['HTTP_USER_AGENT'] : '');
107109
}
108110

109111
/**

src/app/code/community/FireGento/AdminMonitoring/Model/Observer/Login.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ protected function _saveLoginHistory($user, $failure = false, $message = '')
7070
{
7171
/* @var $history FireGento_AdminMonitoring_Model_History */
7272
$history = Mage::getModel('firegento_adminmonitoring/history');
73+
$history->setForcedLogging(true);
7374
$history->setData(array(
7475
'object_id' => $user->getId(),
7576
'object_type' => get_class($user),

src/app/code/community/FireGento/AdminMonitoring/Model/Observer/Model/Abstract.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* @copyright 2014 FireGento Team (http://www.firegento.com)
1919
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
2020
*/
21+
2122
/**
2223
* Abstract observer class; provides some common functions for subclasses
2324
*
@@ -96,11 +97,11 @@ protected function storeByObserver(Varien_Event_Observer $observer)
9697
private function createHistoryForModelAction()
9798
{
9899
$eventData = array(
99-
'object_id' => $this->_dataModel->getObjectId(),
100-
'object_type' => $this->_dataModel->getObjectType(),
101-
'content' => $this->_dataModel->getSerializedContent(),
102-
'content_diff' => $this->_diffModel->getSerializedDiff(),
103-
'action' => $this->getAction(),
100+
'object_id' => $this->_dataModel->getObjectId(),
101+
'object_type' => $this->_dataModel->getObjectType(),
102+
'content' => $this->_dataModel->getSerializedContent(),
103+
'content_diff' => $this->_diffModel->getSerializedDiff(),
104+
'action' => $this->getAction(),
104105
);
105106

106107
Mage::dispatchEvent('firegento_adminmonitoring_log', $eventData);

src/app/code/community/FireGento/AdminMonitoring/Model/Observer/Model/Delete.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* @copyright 2014 FireGento Team (http://www.firegento.com)
1919
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
2020
*/
21+
2122
/**
2223
* Observes Model Delete
2324
*

src/app/code/community/FireGento/AdminMonitoring/Model/Observer/Model/Save.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* @copyright 2014 FireGento Team (http://www.firegento.com)
1919
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
2020
*/
21+
2122
/**
2223
* Observes Model Save
2324
*
@@ -150,6 +151,7 @@ private function hasOrigData()
150151

151152
// unset website_ids as this is even on new entities set for catalog_product models
152153
unset($data['website_ids']);
153-
return (bool) $data;
154+
155+
return (bool)$data;
154156
}
155157
}

src/app/code/community/FireGento/AdminMonitoring/Model/Observer/Product/Attribute/Update.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* @copyright 2014 FireGento Team (http://www.firegento.com)
1919
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
2020
*/
21+
2122
/**
2223
* Observes the product attribute updates
2324
*
@@ -42,9 +43,6 @@ public function catalogProductAttributeUpdateBefore(Varien_Event_Observer $obser
4243
return;
4344
}
4445

45-
/* @var FireGento_AdminMonitoring_Model_History $history */
46-
$history = Mage::getModel('firegento_adminmonitoring/history');
47-
4846
$objectType = get_class(Mage::getModel('catalog/product'));
4947
$content = json_encode($observer->getEvent()->getAttributesData());
5048
$userAgent = $this->getUserAgent();
@@ -53,17 +51,19 @@ public function catalogProductAttributeUpdateBefore(Varien_Event_Observer $obser
5351
$userName = $this->getUserName();
5452

5553
foreach ($observer->getEvent()->getProductIds() as $productId) {
54+
/* @var FireGento_AdminMonitoring_Model_History $history */
55+
$history = Mage::getModel('firegento_adminmonitoring/history');
5656
$history->setData(array(
57-
'object_id' => $productId,
58-
'object_type' => $objectType,
59-
'content' => $content,
60-
'content_diff' => '{}',
61-
'user_agent' => $userAgent,
62-
'ip' => $ip,
63-
'user_id' => $userId,
64-
'user_name' => $userName,
65-
'action' => FireGento_AdminMonitoring_Helper_Data::ACTION_UPDATE,
66-
'created_at' => now(),
57+
'object_id' => $productId,
58+
'object_type' => $objectType,
59+
'content' => $content,
60+
'content_diff' => '{}',
61+
'user_agent' => $userAgent,
62+
'ip' => $ip,
63+
'user_id' => $userId,
64+
'user_name' => $userName,
65+
'action' => FireGento_AdminMonitoring_Helper_Data::ACTION_UPDATE,
66+
'created_at' => now(),
6767
));
6868

6969
$history->save();

0 commit comments

Comments
 (0)