コード例 #1
0
ファイル: DeleteMaker.php プロジェクト: pentium10/riak-admin
 public function deleteAll($values)
 {
     if (is_array($values)) {
         foreach ($values as $val) {
             if (!empty($val)) {
                 set_time_limit(30);
                 $riak_key = new RiakObject($this->_riak, $this->_bucket, $val);
                 if ($riak_key) {
                     $riak_key->delete();
                 }
             }
         }
         $n = count($values);
         $this->_count += $n;
         if ($n && $this->_count) {
             echo sprintf("%d... ", $this->_count);
         }
     }
 }
コード例 #2
0
ファイル: index.php プロジェクト: pentium10/riak-admin
*/
$start_page = microtime(true);
require_once "lib/riak-client.php";
// init the RIAK connection
$riak = new RiakClient(HOST, HTTP_PORT);
if (!$riak->isAlive()) {
    die("I couldn't ping the server. Check the HOST AND PORT settings...");
}
// init the $bucket && $key
if (isset($_GET['bucketName'])) {
    $bucket = new RiakBucket($riak, $_GET['bucketName']);
    $key = new RiakObject($riak, $bucket, $_GET['key']);
}
// delete a key
if ($_GET['cmd'] == "deleteKey" && $_GET['bucketName'] && $_GET['key']) {
    $key->delete();
    unset($_GET['key']);
}
// create a bucket with key=>value : "created"=>1
if ($_GET['cmd'] == 'createBucket') {
    if ($_POST['bucketName'] && $_POST['bucketName'] != 'Create a new bucket') {
        $data = array("created" => 1);
        $bucket = new RiakBucket($riak, $_POST['bucketName']);
        $x = $bucket->newObject("", $data);
        $x->store();
        $buckets_json = $_COOKIE['buckets'];
        if (!empty($buckets_json)) {
            $buckets_array = json_decode($buckets_json, true);
            if (is_array($buckets_array)) {
                $buckets_array[] = $_POST['bucketName'];
            }