1<?php
2/*
3 * Plugin Name: Object Cache Pro (Drop-in)
4 * Plugin URI: https://objectcache.pro
5 * Description: A business class Redis object cache backend for WordPress.
6 * Version: 1.25.3
7 * Author: Rhubarb Group
8 * Author URI: https://rhubarb.group
9 * License: Proprietary
10 * Requires PHP: 7.2
11 */
12
13defined('ABSPATH') || exit;
14
15if (version_compare(PHP_VERSION, '7.2', '<')) {
16 return require_once ABSPATH . WPINC . '/cache.php';
17}
18
19if (defined('WP_SETUP_CONFIG')) {
20 return require_once ABSPATH . WPINC . '/cache.php';
21}
22
23if (defined('WP_REDIS_DISABLED') && WP_REDIS_DISABLED) {
24 return;
25}
26
27if (! empty(getenv('WP_REDIS_DISABLED'))) {
28 return;
29}
30
31foreach ([
32 defined('WP_REDIS_DIR') ? WP_REDIS_DIR : null,
33
34 // Redis Cache Pro
35 defined('WPMU_PLUGIN_DIR') ? WPMU_PLUGIN_DIR . '/redis-cache-pro' : null,
36 defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR . '/mu-plugins/redis-cache-pro' : null,
37 defined('WP_PLUGIN_DIR') ? WP_PLUGIN_DIR . '/redis-cache-pro' : null,
38 defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR . '/plugins/redis-cache-pro' : null,
39
40 // Object Cache Pro
41 defined('WPMU_PLUGIN_DIR') ? WPMU_PLUGIN_DIR . '/object-cache-pro' : null,
42 defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR . '/mu-plugins/object-cache-pro' : null,
43 defined('WP_PLUGIN_DIR') ? WP_PLUGIN_DIR . '/object-cache-pro' : null,
44 defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR . '/plugins/object-cache-pro' : null,
45] as $path) {
46 if ($path === null || ! is_readable("{$path}/api.php")) {
47 continue;
48 }
49
50 if (include_once "{$path}/api.php") {
51 return true;
52 }
53}
54
55error_log('objectcache.critical: Failed to locate and load object cache API');
56
57$GLOBALS['wp_object_cache_errors'] = ['Failed to locate and load object cache API'];
58
59if (defined('WP_DEBUG') && WP_DEBUG) {
60 throw new RuntimeException('Failed to locate and load object cache API');
61}
62