Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex

This commit is contained in:
Aaron Brock 2015-07-07 03:28:38 -04:00
commit 762772a079

View File

@ -0,0 +1,31 @@
<?php
namespace mineplex\plugin\util;
class UtilFile
{
public static function deleteDir($dirPath)
{
if (! is_dir($dirPath))
{
throw new InvalidArgumentException("$dirPath must be a directory");
}
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/')
{
$dirPath .= '/';
}
$files = glob($dirPath . '*', GLOB_MARK);
foreach ($files as $file)
{
if (is_dir($file))
{
self::deleteDir($file);
}
else
{
unlink($file);
}
}
rmdir($dirPath);
}
}