1 | <?php |
---|
2 | /* |
---|
3 | * This file contains the generic admin options in the new format |
---|
4 | * look here for some examples. |
---|
5 | */ |
---|
6 | |
---|
7 | options::cat('Advanced', 'Cache', 'Cache Control'); |
---|
8 | options::fadd('Caching enabled', 'cache_enabled', 'checkbox'); |
---|
9 | options::fadd('Cache directory', 'cache_dir', 'edit:size:40'); |
---|
10 | options::fadd('Ignore pages', 'cache_ignore', 'edit:size:60'); |
---|
11 | options::fadd('Cache times', 'cache_times', 'edit:size:60'); |
---|
12 | |
---|
13 | options::cat('Advanced', 'Cache', 'Reinforced'); |
---|
14 | options::fadd('Enable Reinforced Management', 'auto_reinforced', 'checkbox'); |
---|
15 | options::fadd('Current Load', 'none', 'custom', array('admin_acache', 'showLoad')); |
---|
16 | options::fadd('Reinforcement threshold', 'reinforced_threshold', 'edit:size:4'); |
---|
17 | options::fadd('Disabling threshold', 'reinforced_disable_threshold', 'edit:size:4'); |
---|
18 | options::fadd('Reinforcement chance', 'reinforced_prob', 'edit:size:4'); |
---|
19 | options::fadd('Reinforcement end chance', 'reinforced_rf_prob', 'edit:size:4'); |
---|
20 | |
---|
21 | class admin_acache |
---|
22 | { |
---|
23 | function showLoad() |
---|
24 | { |
---|
25 | $load = @file_get_contents('/proc/loadavg'); |
---|
26 | if (false === $load) |
---|
27 | { |
---|
28 | return "Your web host does not allow access to the load metric. Reinforced mode will not work."; |
---|
29 | } |
---|
30 | else |
---|
31 | { |
---|
32 | $array = explode(' ', $load); |
---|
33 | return (float)$array[0]; |
---|
34 | } |
---|
35 | } |
---|
36 | } |
---|
37 | ?> |
---|