/**
  * @param string $command POSTs to /console/cache/[command] to perform various cache operations.
  *                        Currently, the only operation available at this time is "flush",
  *                        which clears the cache for the core.
  *
  *                        Example: POST http://dsp.local/console/cache/flush
  *
  * @return bool
  * @throws \CHttpException
  */
 public function actionCache($command)
 {
     if (null === ($_result = Option::get(static::$_cacheCommandMap, $command))) {
         throw new \CHttpException(HttpResponse::BadRequest, 'Invalid command "' . $command . '"');
     }
     $this->layout = false;
     $_result = static::$_cacheCommandMap[$command];
     $_response = new JsonResponse(array('command' => $command, 'success' => $_result));
     $_response->send();
     return Pii::end();
 }
Beispiel #2
0
 /**
  * @param string $cache Which cache to flush
  *
  * @return bool
  * @throws DreamFactory\Platform\Exceptions\BadRequestException
  */
 public function actionFlush($cache)
 {
     $this->layout = false;
     switch (strtolower($cache)) {
         case 'platform':
             Platform::storeDeleteAll();
             Pii::flushConfig();
             break;
         case 'swagger':
             SwaggerManager::clearCache();
             break;
         default:
             throw new BadRequestException();
     }
     echo json_encode(array('success' => true, 'cache' => $cache));
     return Pii::end();
 }
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     Pii::end();
 }