pocketarc / git-deploy-php

git-deploy-php is a simple php-based tool that deploys your Git repositories to FTP/SFTP servers, and keeps them updated automatically.
http://brunodebarros.github.io/git-deploy-php
291 stars 45 forks source link

Fixed clean_directories recursive double path #33

Closed jessedobbelaere closed 10 years ago

jessedobbelaere commented 10 years ago

I noticed that the directories I specified with clean_directories[] are not cleaned up after uploading. I got the following error:

Warning: Invalid argument supplied for foreach() in /.../git-deploy on line 516

I tried to debug the problem. By logging the $file variable during the different steps in the recursive_remove function, I found out that all the files were successfully read from the directory. But when they reach the foreach loop, the recursive function adds the path a second time to the files, resulting in a false path like: frontend/cache/compiled_templates//frontend/cache/compiled_templates/test.txt

The $file variable normally already contains the path, so it shouldn't be added once more I think. This commit fixed issue #32. All the files I created in my FTP folder, as well as the subdirectories and their files were successfully removed after deployment.

Is this problem only occurring on my servers? People have used the clean_directories option before with success right?

pocketarc commented 10 years ago

Absolutely; this bug must've been introduced recently, when I rewrote git-deploy to add a few additional features and make it more extensible. Thanks for catching and fixing it! I'll merge this in now.