Skip to content
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

unlink exception during utpdated files cleanup #49

Merged
merged 1 commit into from Dec 6, 2013

Conversation

Manvel
Copy link
Contributor

@Manvel Manvel commented Nov 26, 2013

Hi,
I was using your plugin for a while and noticed some exceptions
ErrorException [ Warning ]: unlink(/var/www/darth/html/wp-content/uploads/wp-less/my-theme/..): Is a directory

/var/www/wordpress-site/html/wp-content/plugins/wp-less/lib/Garbagecollector.class.php [ 118 ]

113 * @param array $files
114 * @return array
115 */
116 protected function deleteFiles(array $files)
117 {
118 return array_map('unlink', $files);
119 }
120 }

I've fixed the Error by adding:
$dir->setFlags(RecursiveDirectoryIterator::SKIP_DOTS);
for RecursiveDirectoryIterator to skip the Dots during iteration.

@Manvel
Copy link
Contributor Author

Manvel commented Nov 26, 2013

Here is how you can debug the exception:
Change the code on line 33 with:

try
{
    $this->deleteFiles($outdated_files);
}
//catch exception
catch(Exception $e)
{
   print_r($e);
}

Also would like o thank you for the plugin.

@jneslen
Copy link

jneslen commented Dec 6, 2013

Yes, the unlink is causing an exception to be thrown because it cannot unlink the "." and ".." shortcuts on a unix based system.

@thom4parisot
Copy link
Owner

My bad, I missed it (wish you can add as unread some PR or a better clue on the dashboard)

thom4parisot pushed a commit that referenced this pull request Dec 6, 2013
unlink exception during utpdated files cleanup
@thom4parisot thom4parisot merged commit fbee960 into thom4parisot:master Dec 6, 2013
@thom4parisot
Copy link
Owner

Thanks for the fix :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants