Times by times users overwrite WordPress files or just simply delete some files and contact us asking to restore StackCache.
Here is how you can do it for yourself and all you need to do is ensure you have the correct file path for the plugin:
public_html > wp-content > mu-plugins > wp-stack-cache.php
The code you will need to add into wp-stack-cache.php, is:
<?php
/**
* Plugin Name: StackCache
* Plugin URI: http://cache.stackcp.com/
* Description: Wrapper to include the Stack Cache Plugin Library
* Author: Stack CP
*/
// If this file is called directly, abort.
if ( ! defined( "WPINC" ) ) die;
// Load and run
foreach ( ["/../../../wp-admin/includes/file.php", "/../../wp-admin/includes/file.php"] as $path ) {
$full_path = plugin_dir_path(__FILE__) . $path;
if ( file_exists($full_path) ) {
require_once($full_path);
define( 'PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
}
}
require "/usr/share/php/wp-stack-cache.php";
$wpsc = new WPStackCache();
Wish to copy/paste it? You can do it from here: https://pastebin.com/mWsfPH4Q
That's it :)
Have a great day,
Helmuts