public function testExecute2() { global $testAuth; $pfop = new PersistentFop($testAuth, 'testres', 'sdktest', true); $url_src1 = 'http://testres.qiniudn.com/gogopher.jpg'; $url_en1 = \Qiniu\base64_urlSafeEncode($url_src1); $url_alias_en1 = \Qiniu\base64_urlSafeEncode('g.jpg'); $url_en2 = $url_en1; $fop = "mkzip/2/url/{$url_en1}/alias/{$url_alias_en1}/url/{$url_en2}"; $op = Operation::saveas($fop, 'phpsdk', 'mkziptest'); $ops = array(); array_push($ops, $op); list($id, $error) = $pfop->execute('sintel_trailer.mp4', $ops); $this->assertNull($error); list($status, $error) = PersistentFop::status($id); $this->assertNotNull($status); $this->assertNull($error); }
public function mkzip($dummy_key, $urls_and_alias, $to_bucket = null, $to_key = null, $mode = 2) { $base = 'mkzip/' . $mode; $op = array($base); foreach ($urls_and_alias as $key => $value) { if (is_int($key)) { array_push($op, 'url/' . \Qiniu\base64_urlSafeEncode($value)); } else { array_push($op, 'url/' . \Qiniu\base64_urlSafeEncode($key)); array_push($op, 'alias/' . \Qiniu\base64_urlSafeEncode($key)); } } $fop = implode('/', $op); if ($to_bucket != null) { $op = Operation::saveas($fop, $to_bucket, $to_key); } $ops = array($op); return $this->execute($dummy_key, $ops); }