distmaker - Don't require dummy config file for building Joomla
authorTim Otten <totten@civicrm.org>
Mon, 11 Jan 2021 00:29:26 +0000 (16:29 -0800)
committerTim Otten <totten@civicrm.org>
Mon, 11 Jan 2021 00:29:26 +0000 (16:29 -0800)
BEFORE: To run distmaker and produce Joomla ZIPs, you need to create a dummy settings file.
For example, this is how `cividist` does it:

https://github.com/civicrm/civicrm-buildkit/blob/v19.07.0/bin/cividist#L119-L121

It seems that is just a long-winded way of setting up the Civi classloader. (It wouldn't
make sense to use any other Civi services this is a pre-bootstrap environment.)

AFTER: The dummy file is neither needed nor used. We just get the classloader directly.

distmaker/utils/joomlaxml.php

index 087555ec64ffdadc6b423b9911bbce89648659ec..c2f70f9d5cd945e525d569ba714e0b3ec95ecb32 100644 (file)
@@ -33,7 +33,12 @@ else {
 ini_set('include_path',
   "{$sourceCheckoutDir}:{$sourceCheckoutDir}/packages:" . ini_get('include_path')
 );
-require_once "$sourceCheckoutDir/civicrm.config.php";
+
+define('CIVICRM_UF', 'Joomla');
+$GLOBALS['civicrm_root'] = $sourceCheckoutDir;
+require_once $sourceCheckoutDir . '/CRM/Core/ClassLoader.php';
+CRM_Core_ClassLoader::singleton()->register();
+
 require_once 'Smarty/Smarty.class.php';
 
 generateJoomlaConfig($version);