Skip to content

Commit

Permalink
InitCommand - Fix use of \Civix::extDir()
Browse files Browse the repository at this point in the history
  • Loading branch information
totten committed Feb 27, 2024
1 parent af48976 commit 7f93601
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/CRM/CivixBundle/Command/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$output->writeln("<info>Initalize module</info> " . $ctx['fullName']);

$basedir = new Path($ctx['basedir']);
\Civix::$extDir = $basedir->string();

$info = new Info($basedir->string('info.xml'));

Expand Down
5 changes: 5 additions & 0 deletions src/Civix.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class Civix {

protected static $cache = [];

public static $extDir = NULL;

/**
* Get a list of input/output objects for pending commands.
*
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7f93601

Please sign in to comment.