magento-hackathon / magento-composer-installer

Composer installer for Magento modules
210 stars 156 forks source link

Fixed recursive directory removing on Windows #86

Closed vovayatsyuk closed 10 years ago

vovayatsyuk commented 10 years ago

RecursiveIterator variable should be destroyed to make rmdir work instantly, before we will try to remove parentDir. Fixes [UnexpectedValueException] during composer update command on Windows system.

Flyingmana commented 10 years ago

sorry for not merging it yet. I currently have no windows environment to test your changes.

Anyway, thank you very much for your contribution

vovayatsyuk commented 10 years ago

Any news? It's really annoying, because I can't normally update existing installations.

The folder is really doesn't deleted after this line on Windows 7:

        // The specified directory is empty
        if (@rmdir($absoluteDir)) {
        // the folder is still visible with file manager, but not accessible (acces denied message)

The folder stays visible in file manager but not accessible, while script is running. After the exeption is thrown on the next step of recursion and script stopped, the folder is actually removed. Exception is thrown because the script is trying to delete the same folder again but this folder is not accessible anymore

If the unset($iterator); will be called before rmdir, the folder is actually removed from filesystem after the code above.

For now I have to run composer update command twice if some changes was done to magento-composer-installer and my patch is lost:

  1. composer update
  2. UnexpectedValueException with access denied message, while updating my module.
  3. Apply patch to DeploystrategyAbstract file
  4. composer update
  5. Success!
Flyingmana commented 10 years ago

you are right, community had enough time to test now. Thank you for your time and your contribution.

It still needs a few weeks till I do a new 1.x release, I hope its ok to use the master branch(or directly require the commit ID) till then.

vovayatsyuk commented 10 years ago

Thank you so much!