MCPcopy Create free account
hub / github.com/Rello/analytics / installDemo

Method installDemo

lib/Service/BundleImportService.php:37–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35 }
36
37 public function installDemo(): array {
38 $key = 'analytics-demo-' . $this->userId;
39 $this->locking->acquireLock($key, ILockingProvider::LOCK_EXCLUSIVE);
40 try {
41 $id = (int)$this->config->getUserValue($this->userId, 'analytics', 'business-demo-panorama', '0');
42 if ($id > 0 && $this->panoramas->isOwn($id)) return ['kind' => 'bundle', 'panoramaId' => $id, 'reused' => true];
43 $raw = file_get_contents(__DIR__ . '/../../resources/demo.json');
44 if ($raw === false) throw new \RuntimeException('Demo bundle unavailable');
45 return $this->importBundle(json_decode($raw, true, 512, JSON_THROW_ON_ERROR), true);
46 } finally {
47 $this->locking->releaseLock($key, ILockingProvider::LOCK_EXCLUSIVE);
48 }
49 }
50
51 public function importBundle(array $bundle, bool $demo = false): array {
52 BundleDefinition::validate($bundle);

Callers

nothing calls this directly

Calls 2

importBundleMethod · 0.95
isOwnMethod · 0.45

Tested by

no test coverage detected