diff options
| author | 2022-01-17 13:13:27 +0100 | |
|---|---|---|
| committer | 2022-01-17 13:13:27 +0100 | |
| commit | bc5271b0eb0efffb314ee8f5a6b80cd6c7e4979e (patch) | |
| tree | 9af45e3699c8a62fde315e7bcd66e2f11f29c0bf /lib | |
| parent | a6b6f31e9ed84e08f0e49d2d0abb774766f298b1 (diff) | |
fix: Ignore non-PHP files in migrations/ folder (#4163)
Some NAS create folders named `@eaDir` in the FreshRSS tree, including
the `migrations/` folder. This broke the migration system which expected
only valid PHP files to be present in this folder. Now, it ignores
non-PHP files.
Reference: https://github.com/FreshRSS/FreshRSS/issues/4044
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Minz/Migrator.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Minz/Migrator.php b/lib/Minz/Migrator.php index 7afc5240e..0f28237c5 100644 --- a/lib/Minz/Migrator.php +++ b/lib/Minz/Migrator.php @@ -39,7 +39,8 @@ class Minz_Migrator $migration_files = scandir($migrations_path); $migration_files = array_filter($migration_files, function ($filename) { - return $filename[0] !== '.'; + $file_extension = pathinfo($filename, PATHINFO_EXTENSION); + return $file_extension === 'php'; }); $migration_versions = array_map(function ($filename) { return basename($filename, '.php'); @@ -134,7 +135,8 @@ class Minz_Migrator } foreach (scandir($directory) as $filename) { - if ($filename[0] === '.') { + $file_extension = pathinfo($filename, PATHINFO_EXTENSION); + if ($file_extension !== 'php') { continue; } |
