4 require_once(dirname(dirname(__FILE__)).'/lib/init-cmd.php');
5 ini_set('memory_limit', '800M');
8 "Manage service blocks / restrictions",
9 array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
10 array('quiet', 'q', 0, 1, 0, 0, 'bool', 'Quiet output'),
11 array('verbose', 'v', 0, 1, 0, 0, 'bool', 'Verbose output'),
12 array('list', 'l', 0, 1, 0, 0, 'bool', 'List recent blocks'),
13 array('delete', 'd', 0, 1, 0, 0, 'bool', 'Clear recent blocks list'),
14 array('flush', '', 0, 1, 0, 0, 'bool', 'Flush all blocks / stats'),
16 getCmdOpt($_SERVER['argv'], $aCMDOptions, $aResult, true, true);
18 $m = getBucketMemcache();
21 echo "ERROR: Bucket memcache is not configured\n";
27 $iCurrentSleeping = $m->get('sleepCounter');
28 echo "\n Sleeping blocks count: $iCurrentSleeping\n";
30 $aBlocks = getBucketBlocks();
32 printf(" %-40s | %12s | %7s | %13s | %31s\n", "Key", "Total Blocks", "Current", "Still Blocked", "Last Block Time");
33 printf(" %'--40s-|-%'-12s-|-%'-7s-|-%'-13s-|-%'-31s\n", "", "", "", "", "");
34 foreach($aBlocks as $sKey => $aDetails)
36 printf(" %-40s | %12s | %7s | %13s | %31s\n", $sKey, $aDetails['totalBlocks'],
37 (int)$aDetails['currentBucketSize'], $aDetails['currentlyBlocked']?'Y':'N',
38 date("r", $aDetails['lastBlockTimestamp']));
43 if ($aResult['delete'])
45 $m->set('sleepCounter', 0);
49 if ($aResult['flush'])