-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactored Downloadable Files Import #393
base: develop
Are you sure you want to change the base?
Refactored Downloadable Files Import #393
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a bit of test data, especially for new functionality would be great. Makes it a whole lot easier to reproduce and check.
Nevertheless great effort and work. Thanks Simon
|
||
$tmpDir = Mage::getConfig()->getOptions()->getMediaDir() . '/import'; | ||
$destDir = Mage::getModel('downloadable/link')->getBasePath(); | ||
if ( ! is_writable($destDir)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really what you want to do? Check if not writeable and then create it? I really have strong opinions against the usage of @
for error suppression like in this case. Either a correct check or a correct handling of the result of the check you already do would be the cleaner alternative.
$this->_downloadableUploader = Mage::getModel('fastsimpleimport/import_uploader_downloadable', null); | ||
$this->_downloadableUploader->init(); | ||
|
||
$tmpDir = Mage::getConfig()->getOptions()->getMediaDir() . '/import'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usage of DS
instead of /
for compatibility reasons.
if ( ! file_exists($tmpDir)) { | ||
@mkdir($tmpDir, 0777, true); | ||
} | ||
if ( ! $this->_downloadableUploader->setTmpDir($tmpDir)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you change the check for existence and writability you could supply better Exception messages.
Thanks for your review! Please see my last commits. I agree that the usage of Test data can be taken form here. I will try to write test scripts and/or update the wiki and/or the website as soon as my work on downloadable products is finished. |
@nhp Would you approve the changes after my updates? Thanks! |
@nhp would you have a short look again? Thanks! |
Mage_ImportExport_Model_Import_Uploader
/media/downloadable/files/links/f/i/file.pdf