container = $container; $this->user = $user; $this->adminNotificationManager = $adminNotificationManager; $this->systemRequirements = $systemRequirements; $this->scheduledJob = $scheduledJob; $this->dataManager = $dataManager; if (!$this->user->isAdmin()) { throw new Forbidden(); } } public function postActionRebuild(): bool { $this->dataManager->rebuild(); return true; } public function postActionClearCache(): bool { $this->dataManager->clearCache(); return true; } public function getActionJobs(): array { return $this->scheduledJob->getAvailableList(); } public function postActionUploadUpgradePackage($params, $data) { if ($this->config->get('restrictedMode')) { if (!$this->user->isSuperAdmin()) { throw new Forbidden(); } } $upgradeManager = new UpgradeManager($this->container); $upgradeId = $upgradeManager->upload($data); $manifest = $upgradeManager->getManifest(); return [ 'id' => $upgradeId, 'version' => $manifest['version'], ]; } public function postActionRunUpgrade(Request $request): bool { $data = $request->getParsedBody(); if ($this->config->get('restrictedMode')) { if (!$this->user->isSuperAdmin()) { throw new Forbidden(); } } $upgradeManager = new UpgradeManager($this->container); $upgradeManager->install(get_object_vars($data)); return true; } public function actionCronMessage(): array { return $this->scheduledJob->getSetupMessage(); } public function actionAdminNotificationList(): array { return $this->adminNotificationManager->getNotificationList(); } public function actionSystemRequirementList(): array { return $this->systemRequirements->getAllRequiredList(); } }