Skip to content

Commit

Permalink
Fix getComponentInstallDirectory plugintypes retrieval issue.
Browse files Browse the repository at this point in the history
fetch_plugintypes return signature was changed at MDL-79843.

Fixes #338
  • Loading branch information
kabalin committed Jan 31, 2025
1 parent 06df50c commit a10b6df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
The format of this change log follows the advice given at [Keep a CHANGELOG](https://keepachangelog.com).

## [Unreleased]
### Fixed
- Fix getComponentInstallDirectory plugintypes retrieval issue to comply with 5.0

## [4.5.5] - 2024-11-06
### Added
- Improvements to plugin validation implementation:
Expand Down
6 changes: 4 additions & 2 deletions src/Bridge/Moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,13 @@ public function getComponentInstallDirectory(string $component): string
$method->setAccessible(true);
$result = $method->invoke(null);

if (!array_key_exists($type, $result[0])) {
$plugintypes = $this->getBranch() >= 500 ? $result['plugintypes'] : $result[0];

Check warning on line 109 in src/Bridge/Moodle.php

View check run for this annotation

Codecov / codecov/patch

src/Bridge/Moodle.php#L109

Added line #L109 was not covered by tests

if (!array_key_exists($type, $plugintypes)) {

Check warning on line 111 in src/Bridge/Moodle.php

View check run for this annotation

Codecov / codecov/patch

src/Bridge/Moodle.php#L111

Added line #L111 was not covered by tests
throw new \InvalidArgumentException(sprintf('The component %s has an unknown plugin type of %s', $component, $type));
}

return $result[0][$type] . '/' . $name;
return $plugintypes[$type] . '/' . $name;

Check warning on line 115 in src/Bridge/Moodle.php

View check run for this annotation

Codecov / codecov/patch

src/Bridge/Moodle.php#L115

Added line #L115 was not covered by tests
}

/**
Expand Down

0 comments on commit a10b6df

Please sign in to comment.