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