fix: glob not work with phar

This commit is contained in:
2025-11-13 02:41:53 +03:00
parent c0a6cb17b3
commit 24db69fbba

View File

@@ -5,6 +5,8 @@ namespace Openguru\OpenCartFramework\Migrations;
use Exception; use Exception;
use Openguru\OpenCartFramework\Logger\LoggerInterface; use Openguru\OpenCartFramework\Logger\LoggerInterface;
use Openguru\OpenCartFramework\QueryBuilder\Connections\ConnectionInterface; use Openguru\OpenCartFramework\QueryBuilder\Connections\ConnectionInterface;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use RuntimeException; use RuntimeException;
class MigratorService class MigratorService
@@ -68,8 +70,12 @@ SQL;
private function findMigrationsToApply(array $applied): array private function findMigrationsToApply(array $applied): array
{ {
$migrations = []; $migrations = [];
foreach (glob($this->migrationsPath . '/*.php') as $file) { $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->migrationsPath));
$migrations[] = basename($file);
foreach ($iterator as $file) {
if ($file->isFile() && $file->getExtension() === 'php') {
$migrations[] = $file->getFilename();
}
} }
return array_diff($migrations, $applied); return array_diff($migrations, $applied);