-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathredis-page-cache.php
More file actions
executable file
·38 lines (37 loc) · 1005 Bytes
/
redis-page-cache.php
File metadata and controls
executable file
·38 lines (37 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace RedisPageCache;
/*
Plugin Name: PSI Redis Page Cache
Description: Redis-backed Page Cache
Version: 0.8
Plugin URI:
Author: Michael McHolm
Author URI:
Network: True
*/
if (!defined('ABSPATH')) {
die();
}
if (defined('WP_INSTALLING') && WP_INSTALLING)
return;
if(empty($RedisPageCache)) {
require "lib/load.php";
}
if($is_redis_connected && is_admin()) {
add_action("save_post",array($RedisPageCache,"clear_post"));
add_action('admin_bar_menu',array($RedisPageCache,"admin_bar_menu"),100);
add_action('admin_init',array($RedisPageCache,"clear_all"));
}
\register_activation_hook(__FILE__,function() {
$target = WP_CONTENT_DIR . "/plugins/redis-page-cache/advanced-cache.php";
$link = WP_CONTENT_DIR . "/advanced-cache.php";
if(!file_exists($link) && file_exists($target)) {
@symlink($target,$link);
}
});
\register_deactivation_hook(__FILE__,function() {
$link = WP_CONTENT_DIR . "/advanced-cache.php";
if(file_exists($link)) {
@unlink($link);
}
});