phpList / phplist3

Fully functional Open Source email marketing manager for creating, sending, integrating, and analysing email campaigns and newsletters.
https://www.phplist.org
GNU Affero General Public License v3.0
737 stars 268 forks source link

Remove obsolete code from languages.php #962

Closed bramley closed 1 year ago

bramley commented 1 year ago

Description

A few commits to tidy-up the languages.php file by removing redundant or obsolete code.

With open_basedir() in effect, I noticed warnings about trying to access the root directory

PHP Warning:  is_dir(): open_basedir restriction in effect. File(/lan/) is not within the allowed path(s):
PHP Warning:  is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s):

Looking into this, it was caused by trying to derive a plugin's own language directory, which I think is now obsolete. For clarity, there are four commits each removing some code that I think is not needed now.

1) Plugins have not yet been created when the phplist_I18N constructor is called. So the chunk of code trying to derive the plugins basedir is redundant.

2) The code in the constructor looking for common.php, frontend.php etc is now obsolete. Those files have not existed for quite a while. Removing that chunk of code allows all other references to $this->lan to be removed as well.

3) The method getTranslation() takes a $basedir parameter that isn't used. Removing that parameter allows code that sets-up the parameter to be removed as well, particularly the getPluginBasedir() method.

4) The method getTranslation() takes a $page parameter that also isn't used. Removing that parameter allows code that sets-up the parameter to be removed as well.

Related Issue

Screenshots (if appropriate):

michield commented 1 year ago

Looks quite drastic the removal, but I've done a quick smoke test, switching to Dutch and translations continue to work fine.

I also can't find anything in the resources wiki on how we intended plugin translations to work. I guess it would be good to find some time to add plugins to the translation site at some point, so that they make it into the central translation system.

Looks fine to apply this.

phpListDockerBot commented 11 months ago

This pull request has been mentioned on phpList Discuss. There might be relevant details there:

https://discuss.phplist.org/t/3-6-14-release-candidate-ready-for-testing/9109/1

phpListDockerBot commented 11 months ago

This pull request has been mentioned on phpList Discuss. There might be relevant details there:

https://discuss.phplist.org/t/phplist-3-6-14-released-security-release/9158/1