Allow file mods for languages

Hi,

I’m currently available to upload files to the web/app/uploads directory (as default).
I have web/app/languages symlinked, exactly like uploads dir.

But I run Loco Translate with my WP setup and I want to be able to edit those files and override the define(DISALLOW_FILE_MODS, TRUE); setting.

How do I grant permissions to other directories like /languages?

Thanks!

/Jonas

You can set permissions in the same spot:

Thanks!

But if default is 755 and ‘directory’ my config should work.

project_shared_children:
  - path: web/app/languages
    src: languages
    mode: '0755' // tried to add this
  - path: web/app/uploads
    src: uploads

But it does not after I ran
vagrant provison

1 Like

Found this after hours of google-threads.

add_filter( 'file_mod_allowed', 'allow_file_mod_language_folder', 10, 2 );
function allow_file_mod_language_folder( $allow_file_mod, $context ) {
  if ( 'download_language_pack' === $context ) {
    return true;
  } else {
    return $allow_file_mod;
  }
}

Which allows Loco Translate to edit my files. Still need the trellis settings to not override languages on deploys.

2 Likes

A little late, but you can add this to your production.php:

Config::define('WP_LANG_DIR', Config::get('WP_CONTENT_DIR') . '/uploads/languages/');

This would add the files to uploads.

3 Likes