extern/rest.php - Refactor (in anticipation of producing better errors during bootstrap)
authorTim Otten <totten@civicrm.org>
Tue, 7 May 2013 00:15:05 +0000 (17:15 -0700)
committerTim Otten <totten@civicrm.org>
Tue, 7 May 2013 00:15:05 +0000 (17:15 -0700)
CRM/Utils/REST.php
extern/rest.php

index b97d023619401dc90375d481fecab7aa910929af..ce9042219a3040a4a824d5132abd485a5d9942c6 100644 (file)
@@ -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)) {
index 52bcce4c93fc06ed4fb03e6a6431af1118b1106b..1e88ceea2a6bfcc71a2e09c775efad9d6d83b6fc 100644 (file)
@@ -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();