CRM-18058: Define cmsRootPath() for Joomla
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Thu, 7 Apr 2016 10:11:34 +0000 (15:41 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Thu, 7 Apr 2016 10:11:34 +0000 (15:41 +0530)
CRM/Utils/System/Joomla.php

index a609430659f573e82bba0ebffec29991e29f653d..14e6f6aa7eeb32566bb0fedab396ee863d3463fe 100644 (file)
@@ -677,6 +677,21 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
     return $destination;
   }
 
+  /**
+   * Determine the location of the CMS root.
+   *
+   * @return string|NULL
+   *   local file system path to CMS root, or NULL if it cannot be determined
+   */
+  public function cmsRootPath() {
+    list($url, $siteName, $siteRoot) = $this->getDefaultSiteSettings();
+    $includePath = "$siteRoot/libraries/cms/version";
+    if (file_exists("$includePath/version.php")) {
+      return $siteRoot;
+    }
+    return NULL;
+  }
+
   /**
    * @inheritDoc
    */