Fix for Filesystem disabled error in Redis Object Cache

Redis Object Cache by Till Kruss - screenshot of a plugin logo in the WordPress repository
Redis Object Cache showing Filesystem: Disabled error
Redis Object Cache plugin – showing a “Filesystem: Disabled” error
Redis Object Cache showing Filesystem: Not Writeable error
Redis Object Cache plugin – showing a “Filesystem: Not writeable” error (older versions of the plugin)

DISALLOW_FILE_MODS – Better leave it enabled

Fix for the problem with DISALLOW_FILE_MODS constant being on

/*B:Allow file modifications for  certain operations*/ 
add_filter( 'file_mod_allowed', 'dwp_allow_file_mod_for_certain_ops', 10, 2 );
function dwp_allow_file_mod_for_certain_ops( $allow_file_mod, $context ) {
  if ( in_array($context, ['object_cache_dropin'])) {
    return true;
  } else {
    return $allow_file_mod;
  }
}
/*E:Allow file modifications for certain operations*/ 

Why Redis Object Cache do not work with the DISALLOW_FILE_MODS being on anymore?

Read more about Redis

How to install and configure latest Redis version on AlmaLinux server

About the author
I'm a full-stack WordPress developer with a 10+ years of solid experience in the core web development languages, development processes / techniques, web security, Linux server management and with pretty good understanding about proper semantics, UX/UI, technical SEO, good design and basic knowledge of company leadership. On top of that - a distant 5+ years experience as a computer and electronics repair technician which often enables me to understand also how the things work at the hardware level.