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

PHP Warning: mkdir(): Read-only file system in MakePotCommand.php on line 376 #369

Closed
berkbirkan opened this issue Oct 22, 2023 · 6 comments

Comments

@berkbirkan
Copy link

hello,

When I wanted to create a pot file with the following command, I got the following error:

wp i18n make-pot . /languages/ai-comment-creator.pot --slug=ai-comment-creator

Plugin file detected.
PHP Warning: mkdir(): Read-only file system in phar:///opt/homebrew/Cellar/wp-cli/2.8.1/bin/wp/vendor/wp-cli/i18n-command/src/MakePotCommand.php on line 376

Warning: mkdir(): Read-only file system in phar:///opt/homebrew/Cellar/wp-cli/2.8.1/bin/wp/vendor/wp-cli/i18n-command/src/MakePotCommand.php on line 376
Error: Could not create destination directory!

I am 100% sure that I have given the necessary chmod permissions. but I still get the same error. what should I do ? I would be glad if you could help me, thank you.

@swissspidy
Copy link
Member

Hi there, as per our guidelines on how to write clear bug reports, could you please share the output of wp cli info?

Also, what's the output if you run the command with the --debug flag? e.g. wp i18n make-pot . /languages/ai-comment-creator.pot --slug=ai-comment-creator --debug

That line in the code tries to create the languages directory with 0777 permissions if it doesn't exist yet. (though not sure why explicitly 777)

You can try manually creating that directory, either with simple mkdir languages or mkdir -m 0777 languages. If that fails, you do have some chmod permission issues. If not, then wp i18n make-pot should succeed.


Aside: curious, is this your plugin? https://wordpress.org/plugins/ai-comment-creator/
If so, there shouldn't be a need to use this command, as WordPress.org handles all the translation stuff for you. So curious about your use case.

@swissspidy
Copy link
Member

Update

Actually, I just re-read your command and the issue is the location of your destination directory.

wp i18n make-pot . /languages/ai-comment-creator.pot

That means you are pointing at the languages folder in the root directory. The root is no longer writable in macOS.

You'll need to use a relative path, e.g. wp i18n make-pot . ./languages/ai-comment-creator.pot.

That said, you can actually simply omit the destination, as ./languages/ai-comment-creator.pot is the default location determined by the command. So simply running wp i18n make-pot . should work just fine.

@berkbirkan
Copy link
Author

Hi there, as per our guidelines on how to write clear bug reports, could you please share the output of wp cli info?

Also, what's the output if you run the command with the --debug flag? e.g. wp i18n make-pot . /languages/ai-comment-creator.pot --slug=ai-comment-creator --debug

That line in the code tries to create the languages directory with 0777 permissions if it doesn't exist yet. (though not sure why explicitly 777)

You can try manually creating that directory, either with simple mkdir languages or mkdir -m 0777 languages. If that fails, you do have some chmod permission issues. If not, then wp i18n make-pot should succeed.

Aside: curious, is this your plugin? https://wordpress.org/plugins/ai-comment-creator/ If so, there shouldn't be a need to use this command, as WordPress.org handles all the translation stuff for you. So curious about your use case.

Hello,

Yes, that plugin is mine. I noticed that wordpress.org has a translate feature. but this felt extremely slow and cumbersome. Maybe there is a practical way that I don't know about.

@swissspidy
Copy link
Member

All plugins hosted on WordPress.org will get the community-provided translations from translate.wordpress.org. There is no need to provide your own. And if you do, the ones from dotorg will take precedence if they exist.

@berkbirkan
Copy link
Author

My plugin is very small, so I don't have a community to get translation help from. I want to translate it myself on wordpress.org, but it gets stuck waiting. I think I need to confirm it myself, but I couldn't figure out how to do it.

@swissspidy
Copy link
Member

You‘ll need to ask someone from the translation team for that language to approve the translations. You can also become a translation editor for your own plugin and language as well by posting on make.wordpress.org/polyglots.
I recommend reading their handbook

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

No branches or pull requests

2 participants