Skip to content

Commit 42dff9f

Browse files
maxmimaxmi
authored andcommitted
Log folder error handling
1 parent fc7a90a commit 42dff9f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/app/code/community/Zendesk/Zendesk/controllers/Adminhtml/ZendeskController.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,12 @@ public function logAction()
366366
$path = Mage::helper('zendesk/log')->getLogPath();
367367

368368
if(!file_exists($path)) {
369-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('zendesk')->__('The Zendesk log file has not been created. Check to see if logging has been enabled.'));
370-
file_put_contents(" ",$path);
369+
if (is_writable($path)) {
370+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('zendesk')->__('Creating a Zendesk log file.'));
371+
file_put_contents(" ",$path);
372+
} else {
373+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('zendesk')->__('Magento logging has been disabled or Magento log folder has incorrect permissions.'));
374+
}
371375
}
372376

373377
if(Mage::helper('zendesk/log')->isLogTooLarge()) {

0 commit comments

Comments
 (0)