From 69ebc0c0e8c77f29262ea5423d030ba5e3876bdf Mon Sep 17 00:00:00 2001 From: Jon goldberg Date: Wed, 4 Oct 2017 17:17:36 -0400 Subject: [PATCH] CRM-21262 - Add a system check for the resource URL --- CRM/Utils/Check/Component/Env.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CRM/Utils/Check/Component/Env.php b/CRM/Utils/Check/Component/Env.php index 583e09409d..4cab77bfaf 100644 --- a/CRM/Utils/Check/Component/Env.php +++ b/CRM/Utils/Check/Component/Env.php @@ -883,4 +883,27 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { return $messages; } + /** + * Check that the resource URL points to the correct location. + * @return array + */ + public function checkResourceUrl() { + $messages = array(); + // Does arrow.png exist where we expect it? + $arrowUrl = CRM_Core_Config::singleton()->userFrameworkResourceURL . 'packages/jquery/css/images/arrow.png'; + $headers = get_headers($arrowUrl); + $fileExists = stripos($headers[0], "200 OK") ? 1 : 0; + if (!$fileExists) { + $messages[] = new CRM_Utils_Check_Message( + __FUNCTION__, + ts('The Resource URL is not set correctly. Please set the CiviCRM Resource URL.', + array(1 => CRM_Utils_System::url('civicrm/admin/setting/url', 'reset=1'))), + ts('Incorrect Resource URL'), + \Psr\Log\LogLevel::ERROR, + 'fa-server' + ); + } + return $messages; + } + } -- 2.25.1