mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Fix plugin path filtering when directories do not exist.
When paths do not exist we should correctly remove them from the output paths. Fixes #2748
This commit is contained in:
parent
605351d0c9
commit
4d57d3ce5b
2 changed files with 6 additions and 2 deletions
|
@ -191,9 +191,11 @@ class PluginTask extends AppShell {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
foreach ($pathOptions as $i => $path) {
|
foreach ($pathOptions as $i => $path) {
|
||||||
if (!is_dir($path)) {
|
if (!is_dir($path)) {
|
||||||
array_splice($pathOptions, $i, 1);
|
unset($pathOptions[$i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$pathOptions = array_values($pathOptions);
|
||||||
|
|
||||||
$max = count($pathOptions);
|
$max = count($pathOptions);
|
||||||
while (!$valid) {
|
while (!$valid) {
|
||||||
foreach ($pathOptions as $i => $option) {
|
foreach ($pathOptions as $i => $option) {
|
||||||
|
|
|
@ -185,7 +185,9 @@ class PluginTaskTest extends CakeTestCase {
|
||||||
public function testFindPathNonExistant() {
|
public function testFindPathNonExistant() {
|
||||||
$paths = App::path('plugins');
|
$paths = App::path('plugins');
|
||||||
$last = count($paths);
|
$last = count($paths);
|
||||||
$paths[] = '/fake/path';
|
|
||||||
|
array_unshift($paths, '/fake/path');
|
||||||
|
$paths[] = '/fake/path2';
|
||||||
|
|
||||||
$this->Task = $this->getMock('PluginTask',
|
$this->Task = $this->getMock('PluginTask',
|
||||||
array('in', 'out', 'err', 'createFile', '_stop'),
|
array('in', 'out', 'err', 'createFile', '_stop'),
|
||||||
|
|
Loading…
Reference in a new issue