phpbb / epv

Extension Pre-Validator
GNU General Public License v2.0
9 stars 17 forks source link

EPV doesn't detect language and migration files in subfolders #83

Closed kasimi closed 5 years ago

kasimi commented 5 years ago

Affected lines:

$dir is an array that usually looks like this: ['vendor', 'extname', 'language']. end($dir) returns language which makes the tryLoadFile() method successfully return a LangFile instance. However, a language file located in vendor/extname/language/sub/lang.php has a $dir of ['vendor', 'extname', 'language', 'sub']. end($dir) returns sub, resulting in a generic PHPFile instance to be returned. Similar problem for migration files.

At the moment I'm not sure how to fix this in a way that works locally as well as in production. Locally, the vendor/extname is missing, so $dir is just ['language'] and ['language', 'sub'], respectively. Any ideas?

kasimi commented 5 years ago

A naive solution would be to check for in_array('language', $dirs). It's unlikely that there's a second migrations folder somewhere in the extension, but a language folder could exist for example in styles/all, although there shouldn't be any PHP files in there. We would also have to assume that there's neither a vendor nor an extension name equal to language or migrations.

paul999 commented 5 years ago

Fixed in #84