コード例 #1
0
 public function bucketDetails(Silex\Application $app)
 {
     $bucket = lmv::getDefaultBucket();
     // GET /oss/{api version}/buckets/{bucket key}/details
     // would work as well, but since we saved it locally, use the local version
     $path = $app->dataDir("/{$bucket}.bucket.json", true);
     if ($path) {
         $data = file_get_contents($path);
         $data = json_decode($data);
         return new JsonResponse($data, Response::HTTP_OK);
     }
     $lmv = new lmv($bucket);
     $response = $lmv->checkBucket();
     if ($response == false) {
         return new Response('', Response::HTTP_NOT_FOUND, ['Content-Type' => 'text/plain']);
     }
     return new JsonResponse($response, Response::HTTP_OK);
 }