Class ‘W3_Config’ not found

  • 189 views
  • Read

I upgraded the plugin W3 Total Cache to the latest 0.9.5 version, then my Website could not work anymore.

I checked the error log and got below error message:

Class 'W3_Config' not found in /var/www/lunixdb.com/wp-content/plugins/wptouch/core/class-cache-smash.php on line 96

Because I updated the OS just before the plugin upgrade, I guessed maybe some file permissions were modified.
I spent more than one hour to check the file permission issue, and it turned out to be a wrong direction totally.

Finally I began to check the PHP class issue, and found after the upgrade of W3 Total Cache, some methods or functions had been changed.
I got some examples from the PHP code files, and updated the class-cache-smash.php as below:

line 96: $w3_config = new W3_Config( true );
to: $w3_config = w3_instance('W3_Config');
line 99: if ( $w3_config->get_cache_option( 'pgcache.enabled' ) ) {
to: if ( $w3_config->get_boolean( 'pgcache.enabled' ) ) {
line 101: $rejected_user_agents = $w3_config->get_cache_option( 'pgcache.reject.ua' );
to $rejected_user_agents = $w3_config->get_array( 'pgcache.reject.ua' );

Then I activated the WPtouch Mobile Plugin again, and it worked well.

Note: Make a backup for any change!

  • by Published on 26/09/2016 22:26:55
  • Repost please keep this link: https://www.dbcloudsvc.com/blogs/life/class-w3_config-not-found/
匿名

Comment

Anonymous Write

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

Decide