6 if(!class_exists(
'Memcache') && !class_exists(
'Memcached')) {
7 echo(
"Error: the memcached (or memcache) PHP extension appears to be unavailable.\n");
9 echo(
"This is most likely because PHP doesn't load it for the command line\n");
10 echo(
"version. You probably need to enable it somehow.\n");
12 if(is_executable(
'/usr/sbin/phpenmod')) {
13 echo(
"It is possible that running one of the following commands as root will fix it:\n");
14 echo(
" phpenmod -s cli memcached\n");
15 echo(
" phpenmod -s cli memcache\n");
25 require_once(
$baseDir.
'/lib/_autoload.php');
43 echo(
"WARNING: Server ".
$server.
" is down.\n");
48 $items =
$state[
'curr_items'];
49 echo(
"Server ".
$server.
" has ".$items.
" items.\n");
55 echo(
"Total number of keys: ".count(
$keys).
"\n");
57 echo(
"Total number of unique keys: ".count(
$keys).
"\n");
59 echo(
"Starting synchronization.\n");
73 echo(
"Synchronization done.\n");
74 echo(
$sync.
" keys in sync.\n");
77 echo(
"Keys are skipped because they are either expired, or are of a type unknown\n");
78 echo(
"to SimpleSAMLphp.\n");
82 echo(
"WARNING: ".
$warnServerDown.
" server(s) down. Not all servers are synchronized.\n");
86 echo(
"WARNING: ".
$warnBigSlab.
" slab(s) may have contained more keys than we were told about.\n");
102 echo(
"Connecting to: ".$host.
":".$port.
"\n");
103 $socket = fsockopen($host, $port);
104 echo(
"Connected. Finding keys.\n");
106 if (fwrite($socket,
"stats slabs\r\n") ===
false) {
107 echo(
"Error requesting slab dump from server.\n");
113 while (($line = fgets($socket)) !==
false) {
114 $line = rtrim($line);
115 if ($line ===
'END') {
119 if (preg_match(
'/^STAT (\d+):/', $line, $matches)) {
120 $slab = (int) $matches[1];
121 if (!in_array($slab, $slabs,
true)) {
129 foreach ($slabs as $slab) {
131 if (fwrite($socket,
"stats cachedump ".$slab.
" 1000000\r\n") ===
false) {
132 echo(
"Error requesting cache dump from server.\n");
141 while (($line = fgets($socket)) !==
false) {
142 $resultSize += strlen($line);
144 $line = rtrim($line);
145 if ($line ===
'END') {
149 if (preg_match(
'/^ITEM (.*) \[\d+ b; \d+ s\]/', $line, $matches)) {
150 $keys[] = $matches[1];
152 echo(
"Unknown result from cache dump: ".$line.
"\n");
155 if ($resultSize > 1900000 || count(
$keys) >= 1000000) {
156 echo(
"WARNING: Slab ".$slab.
" on server ".$host.
":".$port.
157 " may have contained more keys than we were told about.\n");
162 echo(
"Found ".count(
$keys).
" key(s).\n");
static getRawStats()
Retrieve statistics directly in the form returned by getExtendedStats, for all server groups...
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static get($key)
Find data stored with a given key.
static setConfigDir($path, $configSet='simplesaml')
Set the directory for configuration files for the given configuration set.
if(!class_exists('Memcache') &&!class_exists('Memcached')) $baseDir
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
foreach($_POST as $key=> $value) $res
if($skipped > 0) if($warnServerDown > 0) if($warnBigSlab > 0) getServerKeys($server)
Fetch all keys available in an server.
Create styles array
The data for the language used.