| @@ 452-479 (lines=28) @@ | ||
| 449 | * |
|
| 450 | * @return \Symfony\Component\HttpFoundation\JsonResponse |
|
| 451 | */ |
|
| 452 | public function apiSchemaUpdate(Request $request) |
|
| 453 | { |
|
| 454 | $this->isTokenValid(); |
|
| 455 | ||
| 456 | $pluginCode = $request->get('pluginCode'); |
|
| 457 | ||
| 458 | try { |
|
| 459 | $Plugin = $this->pluginRepository->findByCode($pluginCode); |
|
| 460 | ||
| 461 | if (!$Plugin) { |
|
| 462 | throw new NotFoundHttpException(); |
|
| 463 | } |
|
| 464 | ||
| 465 | $config = $this->pluginService->readConfig($this->pluginService->calcPluginDir($Plugin->getCode())); |
|
| 466 | ||
| 467 | ob_start(); |
|
| 468 | $this->pluginService->generateProxyAndUpdateSchema($Plugin, $config); |
|
| 469 | $log = ob_get_clean(); |
|
| 470 | ob_end_flush(); |
|
| 471 | ||
| 472 | return $this->json(['success' => true, 'log' => $log]); |
|
| 473 | } catch (\Exception $e) { |
|
| 474 | $log = $e->getMessage(); |
|
| 475 | log_error($e); |
|
| 476 | ||
| 477 | return $this->json(['success' => false, 'log' => $log], 500); |
|
| 478 | } |
|
| 479 | } |
|
| 480 | ||
| 481 | /** |
|
| 482 | * オーナーズブラグインインストール、更新処理 |
|
| @@ 490-516 (lines=27) @@ | ||
| 487 | * |
|
| 488 | * @return \Symfony\Component\HttpFoundation\JsonResponse |
|
| 489 | */ |
|
| 490 | public function apiUpdate(Request $request) |
|
| 491 | { |
|
| 492 | $this->isTokenValid(); |
|
| 493 | ||
| 494 | $pluginCode = $request->get('pluginCode'); |
|
| 495 | ||
| 496 | $log = null; |
|
| 497 | try { |
|
| 498 | $Plugin = $this->pluginRepository->findByCode($pluginCode); |
|
| 499 | if (!$Plugin) { |
|
| 500 | throw new NotFoundHttpException(); |
|
| 501 | } |
|
| 502 | ||
| 503 | $config = $this->pluginService->readConfig($this->pluginService->calcPluginDir($Plugin->getCode())); |
|
| 504 | ob_start(); |
|
| 505 | $this->pluginService->updatePlugin($Plugin, $config); |
|
| 506 | $log = ob_get_clean(); |
|
| 507 | ob_end_flush(); |
|
| 508 | ||
| 509 | return $this->json(['success' => true, 'log' => $log]); |
|
| 510 | } catch (\Exception $e) { |
|
| 511 | $log = $e->getMessage(); |
|
| 512 | log_error($e); |
|
| 513 | } |
|
| 514 | ||
| 515 | return $this->json(['success' => false, 'log' => $log], 500); |
|
| 516 | } |
|
| 517 | ||
| 518 | /** |
|
| 519 | * Do confirm update page |
|