resolved https://github.com/ManiaControl/ManiaControl/issues/22 (added isHiddenFile method)
This commit is contained in:
@ -26,7 +26,7 @@ abstract class BackupUtil {
|
||||
}
|
||||
|
||||
$time = date('y-m-d_H-i-s');
|
||||
if(defined('PHP_UNIT_TEST')){
|
||||
if (defined('PHP_UNIT_TEST')) {
|
||||
$time = date('y-m-d_H-i');
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ abstract class BackupUtil {
|
||||
}
|
||||
$useBaseFileNames = !empty($baseFileNames);
|
||||
while (false !== ($file = readdir($folderHandle))) {
|
||||
if (substr($file, 0, 1) === '.') {
|
||||
if (FileUtil::isHiddenFile($file)) {
|
||||
// Skip such .files
|
||||
continue;
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ namespace ManiaControl\Files;
|
||||
|
||||
use ManiaControl\Logger;
|
||||
use ManiaControl\Utils\Formatter;
|
||||
use ManiaControl\Utils\SystemUtil;
|
||||
use ManiaControl\Utils\WebReader;
|
||||
|
||||
/**
|
||||
@ -131,7 +130,7 @@ abstract class FileUtil {
|
||||
foreach ($directories as $directory) {
|
||||
$dir = new \RecursiveDirectoryIterator(MANIACONTROL_PATH . $directory);
|
||||
foreach (new \RecursiveIteratorIterator($dir) as $fileName => $file) {
|
||||
if (substr($fileName, 0, 1) === '.') {
|
||||
if (self::isHiddenFile($fileName)) {
|
||||
continue;
|
||||
}
|
||||
if (!is_writable($fileName)) {
|
||||
@ -227,4 +226,14 @@ abstract class FileUtil {
|
||||
|
||||
return $className;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a File is Hidden
|
||||
*
|
||||
* @param $fileName
|
||||
* @return bool
|
||||
*/
|
||||
public static function isHiddenFile($fileName) {
|
||||
return (substr($fileName, 0, 1) === '.');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user