api4 - Fix computation of core path
authorTim Otten <totten@civicrm.org>
Sun, 15 Sep 2019 18:12:52 +0000 (14:12 -0400)
committerColeman Watts <coleman@civicrm.org>
Tue, 17 Sep 2019 03:11:24 +0000 (23:11 -0400)
The `$locations` array mostly contains the paths of *extension PHP files*,
and the subsequent code filters with`dirname()` to strip them out.

Before: The path `/var/www/sites/all/modules/civicrm` was digested to
        `/var/www/sites/all/modules/Civi/Api4/Subscribers`.

After:  The path `/var/www/sites/all/modules/civicrm/Civi.php` is digested
        `/var/www/sites/all/modules/civicrm/Civi/Api4/Subscribers`.

CRM/Api4/Services.php

index 0e78e1a931ae0678e023e5977c9e4087a8072f49..a615f1a0e27c7f0863dcc006bbbd54a64a0185cd 100644 (file)
@@ -57,7 +57,7 @@ class CRM_Api4_Services {
    */
   public static function loadServices($namespace, $tag, $container) {
     $namespace = \CRM_Utils_File::addTrailingSlash($namespace, '\\');
-    $locations = array_merge([\Civi::paths()->getPath('[civicrm.root]/.')],
+    $locations = array_merge([\Civi::paths()->getPath('[civicrm.root]/Civi.php')],
       array_column(\CRM_Extension_System::singleton()->getMapper()->getActiveModuleFiles(), 'filePath')
     );
     foreach ($locations as $location) {