Skip to content

Commit ab4f6b4

Browse files
committed
Bug-fix.
Changelog excerpt: - Wrong number of files reported when recursively scanning through directories; Fixed.
1 parent 5ac1c51 commit ab4f6b4

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

Changelog.md

+6
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,9 @@ __*Why "v3.0.0" instead of "v1.0.0?"*__ Prior to phpMussel v3, the "phpMussel Co
1111
[2020.08.05; Maikuolan]: Addressed a potential compatibility problem with some specific kinds of symlinked installations.
1212

1313
[2020.10.01; Bug-fix; Maikuolan]: Discovered that the image chameleon attack detection could generate false positives against Mac OS X thumbnails; Fixed. *Refer [#223](https://github.com/phpMussel/phpMussel/issues/223).*
14+
15+
### v3.0.2
16+
17+
[2020.10.01; Bug-fix; v10mthibault]: Typo in Loader.php; Trying to call function sprint instead of sprintf which leads to an error; Fixed.
18+
19+
[2020.10.15; Bug-fix; Maikuolan]: Wrong number of files reported when recursively scanning through directories; Fixed. *Refer [#225](https://github.com/phpMussel/phpMussel/issues/225).*

src/Loader.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* License: GNU/GPLv2
99
* @see LICENSE.txt
1010
*
11-
* This file: The loader (last modified: 2020.10.01).
11+
* This file: The loader (last modified: 2020.10.15).
1212
*/
1313

1414
namespace phpMussel\Core;
@@ -83,7 +83,7 @@ class Loader
8383
/**
8484
* @var string phpMussel version number (SemVer).
8585
*/
86-
public $ScriptVersion = '3.0.1';
86+
public $ScriptVersion = '3.0.2';
8787

8888
/**
8989
* @var string phpMussel version identifier (complete notation).

src/Scanner.php

+6-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* License: GNU/GPLv2
99
* @see LICENSE.txt
1010
*
11-
* This file: The scanner (last modified: 2020.10.01).
11+
* This file: The scanner (last modified: 2020.10.15).
1212
*/
1313

1414
namespace phpMussel\Core;
@@ -345,8 +345,6 @@ private function recursor($Files = '', int $Depth = -1)
345345
} elseif ($SizeOfDir > 1) {
346346
if ($this->Loader->InstanceCache['ThisScanTotal'] === 0) {
347347
$this->Loader->InstanceCache['ThisScanTotal'] = $SizeOfDir;
348-
} else {
349-
$this->Loader->InstanceCache['ThisScanTotal'] += $SizeOfDir - 1;
350348
}
351349
$this->Loader->Events->fireEvent('countersChanged');
352350
foreach ($Files as $Key => $Value) {
@@ -378,8 +376,6 @@ private function recursor($Files = '', int $Depth = -1)
378376
$SizeOfDir = count($Dir);
379377
if ($this->Loader->InstanceCache['ThisScanTotal'] === 0) {
380378
$this->Loader->InstanceCache['ThisScanTotal'] = $SizeOfDir;
381-
} else {
382-
$this->Loader->InstanceCache['ThisScanTotal'] += $SizeOfDir - 1;
383379
}
384380
$this->Loader->Events->fireEvent('countersChanged');
385381
foreach ($Dir as &$Sub) {
@@ -450,8 +446,6 @@ private function recursor($Files = '', int $Depth = -1)
450446
$this->Loader->InstanceCache['ThisScanDone']++;
451447
$this->Loader->Events->fireEvent('countersChanged');
452448
if (!$this->Loader->Configuration['files']['filesize_response']) {
453-
$this->Loader->InstanceCache['ThisScanDone']++;
454-
$this->Loader->Events->fireEvent('countersChanged');
455449
$this->Loader->atHit('', $fS, $OriginalFilenameClean, '', 1, $Depth + 1);
456450
return;
457451
}
@@ -2793,9 +2787,10 @@ private function prescanDecode(string $str): string
27932787
* Used both by the scanner as well as by CLI.
27942788
*
27952789
* @param string $Base Directory root.
2790+
* @param bool $Directories Includes directories in the array when true.
27962791
* @return array Directory tree.
27972792
*/
2798-
public function directoryRecursiveList(string $Base): array
2793+
public function directoryRecursiveList(string $Base, bool $Directories = false): array
27992794
{
28002795
$Arr = [];
28012796
$Offset = strlen($Base);
@@ -2804,6 +2799,9 @@ public function directoryRecursiveList(string $Base): array
28042799
if (preg_match('~^(?:/\.\.|./\.|\.{3})$~', str_replace("\\", '/', substr($Item, -3))) || !is_readable($Item)) {
28052800
continue;
28062801
}
2802+
if (is_dir($Item) && !$Directories) {
2803+
continue;
2804+
}
28072805
$Arr[] = substr($Item, $Offset);
28082806
}
28092807
return $Arr;

0 commit comments

Comments
 (0)