objectUtils->getObjectStore($bucket, $output); if (!$objectStore) { return ExitCode::Failure; } if (!$objectStore instanceof IObjectStoreMetaData) { $output->writeln('Configured object store does currently not support retrieve metadata'); return ExitCode::Failure; } if (!$objectStore->objectExists($object)) { $output->writeln("Object $object does not exist"); return ExitCode::Failure; } try { $meta = $objectStore->getObjectMetaData($object); } catch (\Exception $e) { $msg = $e->getMessage(); $output->writeln("Failed to read $object from object store: $msg"); return ExitCode::Failure; } if ($outputFormat === OutputFormat::Plain && isset($meta['size'])) { $meta['size'] = Util::humanFileSize($meta['size']); } if (isset($meta['mtime'])) { $meta['mtime'] = $meta['mtime']->format(\DateTimeImmutable::ATOM); } if (!isset($meta['mimetype'])) { $handle = $objectStore->readObject($object); $head = fread($handle, 8192); fclose($handle); $meta['mimetype'] = $this->mimeTypeDetector->detectString($head); } $output->writeArrayInOutputFormat($meta); return ExitCode::Success; } }