tzyganu / UMC1.9

New Ultimate Module Creator for Magento 1.7 +
MIT License
241 stars 88 forks source link

Fatal error: Call to undefined method Varien_Io_File::filePutContent() #49

Closed drolsen closed 10 years ago

drolsen commented 10 years ago

Magento ver. 1.9.0.1

Fatal error: Call to undefined method Varien_Io_File::filePutContent() in /home/box/public_html/dev/app/code/community/Ultimate/ModuleCreator/Model/Module.php on line 487

Unable to create or edit existing modules I've made with this before. Not sure it is related to a recent update I did on this extension or the moving around from sub-domain to main domain and back again with Mage install, but both main ans sub are now reporting this upon hitting save.

tzyganu commented 10 years ago

@devinrayolsen Thanks for reporting this. I'm not able to reproduce it, but here are some details about it. Maybe it helps.
In your case the error is generated by this line:
https://github.com/tzyganu/UMC1.9/blob/master/app/code/community/Ultimate/ModuleCreator/Model/Module.php#L487 and it says that in the class Varien_Io_File there is no method called filePutContent.
You say you are using Magento 1.9.0.1. Are you sure that's the correct version?
As you can see here: https://github.com/OpenMage/magento-mirror/blob/magento-1.9/lib/Varien/Io/File.php#L543 In the 1.9 version in the Varien_Io_File class there is a method called filePutContent. So this error should not appear.
So you are getting this error in 2 cases.

  1. you don't have the 1.8 version. The method filePutContent was added in version 1.8.1. That's why there is an if statement in my module when actually writing the files on the disk. https://github.com/tzyganu/UMC1.9/blob/master/app/code/community/Ultimate/ModuleCreator/Model/Module.php#L483. For versions older than 1.8.1 there used to be a method called write in the Varien_Io_File class. I use different methods to write on the disk depending on the magento version.
  2. You have in app/code/local an older version of the Varien_Io_File class and that one is used.
    Maybe you copied it some time ago and then upgraded to 1.9 and magento is still using the old version.

Long story short...check where the Varien_Io_File class is located in your instance and see if it contains a filePutContent method. If not, you can update it or you can just modify the module creator at the line where the error appears and replace filePutContent with write.

Let me know how it turns out.

drolsen commented 10 years ago

@tzyganu spot on sir! Upgrading the file to the correct version fixed this issue. Now if I could just figure out why my modules that allow backend file upload never writes to disk and or saves the record in the file attribute. But that's not related to this issue I feel, so will dig further.

Thanks, amazing work!

tzyganu commented 10 years ago

@devinrayolsen For your other problem, the one with the upload...if you cannot find a solutions send me the xml file generated by the UMC. It is located in var/modulecreator/package/[Namespace]_[Module.xml]. This way I can recreate the module on my side. Or you can send me the full module you created. Please also send a list of steps on how to reproduce the problem. If it's a problem with the created module I will fix it and deploy it in the next version.
You can send it at ultimate(dot)module(dot)creator(at)gmail(dot)com.

drolsen commented 10 years ago

Sent, thanks!