Merge pull request #12621 from JKingsnorth/remove-unused-vars-process-parti
[civicrm-core.git] / civicrm-version.php
old mode 100755 (executable)
new mode 100644 (file)
index 6292f2b..f99d34c
@@ -1,8 +1,8 @@
 <?php
 
-namespace Civi {
+namespace _CiviVersion_ {
 
-  class Version {
+  class Util {
 
     /**
      * Get the CiviCRM version
@@ -26,12 +26,21 @@ namespace Civi {
       if (defined('CIVICRM_UF')) {
         return CIVICRM_UF;
       }
+      elseif (defined('BACKDROP_VERSION')) {
+        return 'Backdrop';
+      }
       elseif (function_exists('drupal_bootstrap') && version_compare(VERSION, '6.0', '>=') && version_compare(VERSION, '7.0', '<')) {
         return 'Drupal6';
       }
       elseif (function_exists('drupal_bootstrap') && version_compare(VERSION, '7.0', '>=') && version_compare(VERSION, '8.0', '<')) {
         return 'Drupal';
       }
+      elseif (defined('ABSPATH') && function_exists('get_bloginfo')) {
+        return 'WordPress';
+      }
+      elseif (defined('DRUPAL_ROOT') && class_exists('Drupal') && version_compare(\Drupal::VERSION, '8.0', '>=') && version_compare(\Drupal::VERSION, '9.0', '<')) {
+        return 'Drupal8';
+      }
       else {
         // guess CMS name from the current path
         list($cmsType,) = self::findCMSRootPath();
@@ -108,11 +117,12 @@ namespace {
    * TODO : For now this function is not included in \Civi\Version class so not to break any code
    *   which directly call civicrmVersion(). So those call need to replaced with \Civi\Version::civicrmVersion()
    *   when included in the class
+   * @deprecated
    */
   function civicrmVersion() {
     return [
-      'version' => \Civi\Version::findVersion(),
-      'cms' => \Civi\Version::findCMS(),
+      'version' => \_CiviVersion_\Util::findVersion(),
+      'cms' => \_CiviVersion_\Util::findCMS(),
     ];
   }
 }