JezK
Edit File: litespeed-wpconfig.php
<?php if ( ! defined( 'WPINC' ) || ! defined( 'ABSPATH' ) ) { die; } /** * wp-config.php is deployed and owned by the Raidboxes platform and must not be * written from inside WordPress. * * LiteSpeed Cache rewrites the WP_CACHE constant whenever its cache setting is * enabled. Without this filter it attempts the write and fails with a bare * "File ... is not writable", which reads like a broken Box. The filter makes * LiteSpeed skip the attempt and report the change as forbidden instead, and * the notice below states in plain terms that this is not permitted here. */ class RBLitespeedWpConfigPlugin { const NOTICE_TRANSIENT = 'rb_litespeed_wpconfig_notice'; const PLUGIN = 'litespeed-cache/litespeed-cache.php'; public function __construct() { add_filter( 'litespeed_wpconfig_readonly', '__return_true' ); add_action( 'activated_plugin', array( $this, 'remember_activation' ), 10, 1 ); add_action( 'admin_notices', array( $this, 'render_notice' ), 10, 0 ); add_action( 'network_admin_notices', array( $this, 'render_notice' ), 10, 0 ); } public function remember_activation( $plugin ) { // On Boxes where the platform ships LiteSpeed Cache itself the plugin is // banned outright and RBBannedPluginsPlugin already explains why. Adding // a wp-config notice on top would only be noise. if ( defined( 'RB_LITESPEED_CACHE_PLUGIN' ) && RB_LITESPEED_CACHE_PLUGIN ) { return; } if ( self::PLUGIN === $plugin ) { set_transient( self::NOTICE_TRANSIENT, 1, MINUTE_IN_SECONDS ); } } public function render_notice() { // Keep the transient until somebody who can act on it sees the notice. if ( ! get_transient( self::NOTICE_TRANSIENT ) || ! current_user_can( 'activate_plugins' ) ) { return; } delete_transient( self::NOTICE_TRANSIENT ); printf( '<div class="notice notice-info"><p><strong>%s</strong> %s</p></div>', esc_html( 'LiteSpeed Cache is not allowed to change wp-config.php on this Box.' ), esc_html( 'Editing wp-config.php is not permitted on Raidboxes. The WP_CACHE constant is managed by the platform, so LiteSpeed Cache reports the change as forbidden. Nothing needs to be fixed.' ) ); } } new RBLitespeedWpConfigPlugin();