diff --git a/HEROKU.md b/HEROKU.md index 723be0399..5e052647f 100755 --- a/HEROKU.md +++ b/HEROKU.md @@ -22,7 +22,8 @@ After clicking the Heroku button above: 7. (optional) Copy and paste your Vimeo API key into the `VIMEO_API_KEY` field. 8. (optional) If you have a Google Analytics account, you can paste your site tracking code into the `GA_TRACKING_CODE` field. 9. (optional) If you would like to enable the Admin Panel, change the `ADMIN_PANEL_ENABLED` field to `true`. -10. Click the Deploy button and wait for the process to complete. +10. (optional) If you would like to disable API Caching for dev or testing purposes, set the field to `false`. +11. Click the Deploy button and wait for the process to complete. ### Step 3: Request a Developer Key UDOIT uses Oauth2 to take actions on behalf of the user, so you'll need to ask your Canvas administrator to generate a Developer Key for you. (If you are an admin, go to your institution's account administration page in Canvas and click on 'Developer Keys'.) Here is the information you need to provide them: diff --git a/config/herokuConfig.php b/config/herokuConfig.php index f6d1896fd..dc2440c63 100755 --- a/config/herokuConfig.php +++ b/config/herokuConfig.php @@ -56,7 +56,7 @@ define('GA_TRACKING_CODE', getenv('GA_TRACKING_CODE')?:''); /* Flag for API Caching */ -define('USE_API_CACHING', getenv('USE_API_CACHING')?:'true'); +define('USE_API_CACHING', getenv('USE_API_CACHING')?:''); // Fix some issues caused by the heroku load balancer // The OAUTH signature verification doesn't know it's using https w/o this diff --git a/lib/UdoitUtils.php b/lib/UdoitUtils.php index 9705722e0..94e70b751 100644 --- a/lib/UdoitUtils.php +++ b/lib/UdoitUtils.php @@ -310,12 +310,21 @@ public function getCourseLocale($api_key, $course_id) return false; } + /** + * Checks to see if api call has been cached or needs to be made and returns the response object + * + * @param string $api_url The url of the api endpoint + * @param string $video_url The url of the video which is used as session var identifier + * @param string $api_key The api key for the endpoint being called + * + * @return object The httpful response object + */ public function checkApiCache($api_url, $video_url, $api_key = NULL) { global $logger; - // Check if session var + // Check if session var exists // If so, grab response object from session var aka 'cache' - if(isset($_SESSION[$video_url]) && constant('USE_API_CACHING') != 'false') { + if(isset($_SESSION[$video_url]) && constant( 'USE_API_CACHING' ) != 'false') { $response = $_SESSION[$video_url]; $logger->addInfo("Cached api response used"); } else {