public function testBatchCopy() { $key = 'copyto' . rand(); $ops = BucketManager::buildBatchCopy($this->bucketName, array($this->key => $key), $this->bucketName); list($ret, $error) = $this->bucketManager->batch($ops); $this->assertEquals(200, $ret[0]['code']); $ops = BucketManager::buildBatchDelete($this->bucketName, array($key)); list($ret, $error) = $this->bucketManager->batch($ops); $this->assertEquals(200, $ret[0]['code']); }
/** * @inheritdoc */ public function deleteDir($dirname) { // 七牛无目录概念. 目前实现方案是.列举指定目录资源.批量删除 $keys = array_map(function ($file) { return $file['key']; }, $this->listDirContents($dirname)); list(, $err) = $this->getBucketManager()->batch(BucketManager::buildBatchDelete($keys)); return $err === null; }