phpbb / phpbb-translation-validator

A tool checking packages for compliance with the policies https://area51.phpbb.com/docs/dev/3.2.x/language/guidelines.html
GNU General Public License v2.0
8 stars 9 forks source link

Check usage of getFilename instead of getPathname #44

Closed Crizz0 closed 5 years ago

Crizz0 commented 6 years ago

https://github.com/phpbb/phpbb-translation-validator/pull/40#discussion_r140761036

battye commented 5 years ago

If I understand the comment from the other topic you linked to correctly, I think this issue can be closed @Crizz0

We can't just use $file->getFilename() because we actually need part of the path, the replacement is just to get rid of the beginning bit, but the final part of the directory structure is left intact.

Here's some examples I ran from the getFileList() function:

$file->getPathname() outputs:

3.2/en/ext/phpbb/viglink/language/en/info_acp_viglink.php
3.2/en/language/en/acp/language.php
substr($file->getPathname(), strlen($dir) + 1) outputs:

ext/phpbb/viglink/language/en/info_acp_viglink.php
language/en/acp/language.php
str_replace(DIRECTORY_SEPARATOR, '/', substr($file->getPathname(), strlen($dir) + 1)) outputs:

ext/phpbb/viglink/language/en/info_acp_viglink.php
language/en/acp/language.php