Merge pull request #1144 from anaggh/master

Fix bugs
This commit is contained in:
Diego Najar 2020-02-27 13:08:38 +01:00 committed by GitHub
commit 7e76de099d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -268,7 +268,7 @@ class Filesystem {
/** /**
* Get Size of file or directory in bytes * Get Size of file or directory in bytes
* @param [string] $fileOrDirectory * @param [string] $fileOrDirectory
* @return [int|bool [bytes or false on error] * @return [int|bool] [bytes or false on error]
*/ */
public static function getSize($fileOrDirectory) { public static function getSize($fileOrDirectory) {
// Files // Files
@ -278,8 +278,10 @@ class Filesystem {
// Directories // Directories
if (file_exists($fileOrDirectory)) { if (file_exists($fileOrDirectory)) {
$size = 0; $size = 0;
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($fileOrDirectory)) as $file){ foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($fileOrDirectory, FilesystemIterator::SKIP_DOTS)) as $file){
$size += $file->getSize(); if (file_exists($file)) {
$size += $file->getSize();
}
} }
return $size; return $size;
} }

View File

@ -116,7 +116,7 @@ class Text {
$characteres = "1234567890abcdefghijklmnopqrstuvwxyz!@#%^&*"; $characteres = "1234567890abcdefghijklmnopqrstuvwxyz!@#%^&*";
$text = ''; $text = '';
for($i=0; $i<$length; $i++) { for($i=0; $i<$length; $i++) {
$text .= $characteres{rand(0,41)}; $text .= $characteres[rand(0,41)];
} }
return $text; return $text;
} }