From: Tim Otten Date: Tue, 7 May 2013 00:15:05 +0000 (-0700) Subject: extern/rest.php - Refactor (in anticipation of producing better errors during bootstrap) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4dc9d2164742bbf141133927a2f4588ef35c28b9;p=civicrm-core.git extern/rest.php - Refactor (in anticipation of producing better errors during bootstrap) --- 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();