Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove obsolete code from languages.php #962

Merged
merged 4 commits into from
Aug 18, 2023

Conversation

bramley
Copy link
Contributor

@bramley bramley commented Jun 3, 2023

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 michield self-requested a review August 9, 2023 19:11
@michield
Copy link
Member

michield commented Aug 9, 2023

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.

@marianaballa marianaballa merged commit 41090df into phpList:main Aug 18, 2023
4 of 6 checks passed
marianaballa added a commit that referenced this pull request Aug 18, 2023
@bramley bramley deleted the languages_openbasedir branch September 10, 2023 17:18
@phpListDockerBot
Copy link
Contributor

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants