Thanks to visit codestin.com
Credit goes to github.com

Skip to content

unlink exception during utpdated files cleanup#49

Merged
thom4parisot merged 1 commit into
thom4parisot:masterfrom
Manvel:unlink-exception
Dec 6, 2013
Merged

unlink exception during utpdated files cleanup#49
thom4parisot merged 1 commit into
thom4parisot:masterfrom
Manvel:unlink-exception

Conversation

@Manvel

@Manvel Manvel commented Nov 26, 2013

Copy link
Copy Markdown
Contributor

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

Manvel commented Nov 26, 2013

Copy link
Copy Markdown
Contributor Author

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

jneslen commented Dec 6, 2013

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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.

3 participants