空间绑定域名

@param $bucket
@return array
432920
public function domains($bucket){
        list($domains, $err) = $this->bucketManager->domains($bucket);
        if($err){
            return $this->error($err->message(), ['errorCode'=>$err->code()]);
        }
        return $this->success('操作成功', $domains);
    }
38066
private function getBucket($time = null)
    {
        $time = $time ?: time();

        return (int) floor(($time % $this->bucketSpan) / $this->bucketInterval);
    }
137506
public function determineBucketRegionAsync($bucketName)
    {
        $command = $this->getCommand('HeadBucket', ['Bucket' => $bucketName]);
        $handlerList = clone $this->getHandlerList();
        $handlerList->remove('s3.permanent_redirect');
        $handlerList->remove('signer');
        $handler = $handlerList->resolve();

        return $handler($command)
            ->then(static function (ResultInterface $result) {
                return $result['@metadata']['headers']['x-amz-bucket-region'];
            }, function (AwsException $e) {
                $response = $e->getResponse();
                if ($response === null) {
                    throw $e;
                }

                if ($e->getAwsErrorCode() === 'AuthorizationHeaderMalformed') {
                    $region = $this->determineBucketRegionFromExceptionBody(
                        $response
                    );
                    if (!empty($region)) {
                        return $region;
                    }
                    throw $e;
                }

                return $response->getHeaderLine('x-amz-bucket-region');
            });
    }
921188
public function deleteObjects(string $bucket, array $objects)
    {
        try {
            $this->client->deleteObjects($bucket, $objects);
            return $this->success('批量删除文件成功');
        } catch (\Exception $exception) {
            return $this->error('调用阿里云接口出错：' . $exception->getMessage());
        }
    }
822981
public List<String> keysForBucket(String bucket) {
        AmazonS3 s3 = getClient();
        List<String> ret = new ArrayList<>();
        ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(bucket);
        ObjectListing objectListing;

        do {
            objectListing = s3.listObjects(listObjectsRequest);
            for (S3ObjectSummary objectSummary : objectListing.getObjectSummaries()) {
                ret.add(objectSummary.getKey());
            }
            listObjectsRequest.setMarker(objectListing.getNextMarker());
        } while (objectListing.isTruncated());

        return ret;
    }
1060000
public function fetch($bucket)
    {
        $resolver = new Resolver($this->configDirectory);
        $driver = $resolver->getDriver();

        return $driver->fetch($bucket);
    }
451578
public static function stat($bucketName, $path) {
        $path = self::normalizerPath($path);

        return self::statBase($bucketName, $path);
    }
50760
public function dropPrimaryIndex($bucketName)
    {
        $this->beginProfile($token = "    > drop index $bucketName ...");

        $result = $this->db->dropPrimaryIndex($bucketName);

        $this->endProfile($token);

        return $result;
    }
971650
public static function isBucketDnsCompatible($bucket)
    {
        $bucketLen = strlen($bucket);

        return ($bucketLen >= 3 && $bucketLen <= 63) &&
            // Cannot look like an IP address
            !filter_var($bucket, FILTER_VALIDATE_IP) &&
            preg_match('/^[a-z0-9]([a-z0-9\-\.]*[a-z0-9])?$/', $bucket);
    }
1353108
public function getObjectAcl($bucket, $key)
    {
        $params = [
            'Bucket' => $bucket,
            'Key'    => $key
        ];

        return $this->instance->getObjectAcl($params);
    }
494957
public function bucketDestroy($bucket)
    {
        $oBucket = $this->getBucket($bucket);

        if (!$oBucket) {
            $this->setError('Not a valid bucket');
            return false;
        }

        // --------------------------------------------------------------------------

        //  Destroy any containing objects
        $errors = 0;
        foreach ($oBucket->objects as $obj) {
            if (!$this->objectDestroy($obj->id)) {
                $this->setError('Unable to delete object "' . $obj->file->name->human . '" (ID:' . $obj->id . ').');
                $errors++;
            }
        }

        if ($errors) {

            $this->setError('Unable to delete bucket, bucket not empty.');
            return false;

        } else {

            if ($this->callDriver('bucketDestroy', [$oBucket->slug])) {

                $oDb = Factory::service('Database');
                $oDb->where('id', $oBucket->id);
                $oDb->delete(NAILS_DB_PREFIX . 'cdn_bucket');
                return true;

            } else {

                $this->setError('Unable to remove empty bucket directory. ' . $this->callDriver('lastError'));
                return false;
            }
        }
    }
416079
private static function delBase($bucketName, $path)
    {
        if ($path == '/') {
            return [
                    'code'    => self::COSAPI_PARAMS_ERROR,
                    'message' => 'can not delete bucket using api! go to http://console.qcloud.com/cos to operate bucket',
                    ];
        }

        $path = self::cosUrlEncode($path);

        $url = self::generateResUrl($bucketName, $path);
        $sign = Auth::appSign_once(
                $path, $bucketName);

        $data = [
            'op' => 'delete',
        ];

        $data = json_encode($data);

        $req = [
            'url'     => $url,
            'method'  => 'post',
            'timeout' => self::$timeout,
            'data'    => $data,
            'header'  => [
                'Authorization:'.$sign,
                'Content-Type: application/json',
            ],
        ];

        return self::sendRequest($req);
    }
1318391
public function delete($bucket, $key)
    {
        $path = '/delete/' . \Qiniu\entry($bucket, $key);
        list(, $error) = $this->rsPost($path);
        return $error;
    }
1297495
private String[] parseBucketKeyAndFileName(String s) {
        String[] ret = new String[3];

        s = s.substring("s3://".length());
        int index = s.indexOf("/");

        String bucket = s.substring(0, index);
        String key = s.substring(index + 1);
        String fn = s.substring(s.lastIndexOf("/") + 1);

        ret[0] = bucket;
        ret[1] = key;
        ret[2] = fn;

        return ret;
    }
1221780
public function fetch($bucket, $flush = true)
    {
        // Ensure that the root node exists
        if (true === empty($_SESSION[self::ROOT_NODE])) {
            $_SESSION[self::ROOT_NODE] = [];
        }
        // Ensure that the bucket exists
        if (true === empty($_SESSION[self::ROOT_NODE][$bucket])) {
            $_SESSION[self::ROOT_NODE][$bucket] = [];
        }
        // Get the messages for the bucket
        $messages = $_SESSION[self::ROOT_NODE][$bucket];
        // Flush the messages if applicable
        if (true === $flush) {
            $this->flush($bucket);
        }
        // Return the messages as an array
        return $messages;
    }
1351433
public function determineBucketRegionAsync($bucketName)
    {
        $command = $this->getCommand('HeadBucket', ['Bucket' => $bucketName]);
        $handlerList = clone $this->getHandlerList();
        $handlerList->remove('s3.permanent_redirect');
        $handlerList->remove('signer');
        $handler = $handlerList->resolve();

        return $handler($command)
            ->then(static function (ResultInterface $result) {
                return $result['@metadata']['headers']['x-amz-bucket-region'];
            });
    }
1083336
private function setNamespace()
    {
        // 注册app目录，使其成为prs-4标准注册命名空间
        $loader = new \Phalcon\Loader();
        $loader->registerDirs(array(
            QP_APP_PATH,
        ));

        // 注册用户自定义命名空间
        $ns_config = (array) Config::get('app.namespace');

        $ns = ['App' => QP_APP_PATH];

        foreach ($ns_config as $key => $value) {
            if ($key == "App") {
                continue;
            }
            $ns[$key] = QP_ROOT_PATH . $value;
        }

        $loader->registerNamespaces($ns)->register();
    }