From 4dc9d2164742bbf141133927a2f4588ef35c28b9 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 6 May 2013 17:15:05 -0700 Subject: [PATCH] extern/rest.php - Refactor (in anticipation of producing better errors during bootstrap) --- CRM/Utils/REST.php | 5 +++++ extern/rest.php | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CRM/Utils/REST.php b/CRM/Utils/REST.php index b97d023619..ce9042219a 100644 --- a/CRM/Utils/REST.php +++ b/CRM/Utils/REST.php @@ -94,6 +94,11 @@ class CRM_Utils_REST { return self::output($result); } + function bootAndRun() { + $this->loadCMSBootstrap(); + return $this->run(); + } + static function output(&$result) { $hier = FALSE; if (is_scalar($result)) { diff --git a/extern/rest.php b/extern/rest.php index 52bcce4c93..1e88ceea2a 100644 --- a/extern/rest.php +++ b/extern/rest.php @@ -32,12 +32,10 @@ $config = CRM_Core_Config::singleton(); require_once 'CRM/Utils/REST.php'; $rest = new CRM_Utils_REST(); -$rest->loadCMSBootstrap(); - if (isset($_GET['json']) && $_GET['json']) { header('Content-Type: text/javascript'); } else { header('Content-Type: text/xml'); } -echo $rest->run(); +echo $rest->bootAndRun(); -- 2.25.1