From 7f93601b2550b84e228bb65440215390b8ecd322 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 27 Feb 2024 00:22:22 -0500 Subject: [PATCH] InitCommand - Fix use of \Civix::extDir() --- src/CRM/CivixBundle/Command/InitCommand.php | 1 + src/Civix.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/CRM/CivixBundle/Command/InitCommand.php b/src/CRM/CivixBundle/Command/InitCommand.php index 478a5de2..4ac66f2a 100644 --- a/src/CRM/CivixBundle/Command/InitCommand.php +++ b/src/CRM/CivixBundle/Command/InitCommand.php @@ -135,6 +135,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln("Initalize module " . $ctx['fullName']); $basedir = new Path($ctx['basedir']); + \Civix::$extDir = $basedir->string(); $info = new Info($basedir->string('info.xml')); diff --git a/src/Civix.php b/src/Civix.php index 22cad21c..131d02dd 100644 --- a/src/Civix.php +++ b/src/Civix.php @@ -10,6 +10,8 @@ class Civix { protected static $cache = []; + public static $extDir = NULL; + /** * Get a list of input/output objects for pending commands. * @@ -160,6 +162,9 @@ public static function cacheDir(...$parts): Path { * Ex: '/var/www/example.com/files/civicrm/ext/foobar' */ public static function extDir(...$parts): Path { + if (static::$extDir !== NULL) { + return Path::for(static::$extDir, ...$parts); + } $cwd = rtrim(getcwd(), '/'); if (file_exists("$cwd/info.xml")) { return Path::for($cwd, ...$parts);